From ec1e8f1f5d81223738e4cc3f7fddd1f84df65d7e Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 8 Mar 2000 06:18:41 +0000 Subject: [PATCH] Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function 2000-03-07 Tor Lillqvist * gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function for reporting errors from GDI, for which it is no use to call GetLastError on Win9x. (gdk_other_api_failed) New function, for general error reporting without calling GetLastError. (gdk_win32_api_failed) OTOH, this function always calls GetLastError. (gdk_win32_last_error_string) Remove this function, GLib has the equivalent now. * gdk/win32/gdkprivate-win32.h: Declare the above, and macros to call them with function name, file name and line number in the arguments. * gdk/win32/*.c: Use the new macros for reporting errors from GDI functions. * gtk/gtk.def: Add some missing entry points. * gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and gtk_paned_set_gutter_size, which don't exist any longer, as void. Fixes by Hans Breuer: * gdk/makefile.msc: Update for debugging. * gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or PS_DASHDOTDOT or PS_DASH styles depending on the number of entries in the dash_list. * gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in the x11 backend. * gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro. * gtk/testgtk.c: Include config.h, guard inclusion of unistd.h. --- ChangeLog | 39 ++++++++++ ChangeLog.pre-2-0 | 39 ++++++++++ ChangeLog.pre-2-10 | 39 ++++++++++ ChangeLog.pre-2-2 | 39 ++++++++++ ChangeLog.pre-2-4 | 39 ++++++++++ ChangeLog.pre-2-6 | 39 ++++++++++ ChangeLog.pre-2-8 | 39 ++++++++++ gdk/makefile.msc | 4 +- gdk/win32/gdkcolor-win32.c | 18 ++--- gdk/win32/gdkdnd-win32.c | 4 +- gdk/win32/gdkdrawable-win32.c | 105 +++++++++++++------------- gdk/win32/gdkevents-win32.c | 22 +++--- gdk/win32/gdkfont-win32.c | 4 +- gdk/win32/gdkgc-win32.c | 138 +++++++++++++++++++++++----------- gdk/win32/gdkimage-win32.c | 36 ++++----- gdk/win32/gdkmain-win32.c | 37 +++++---- gdk/win32/gdkpixmap-win32.c | 6 +- gdk/win32/gdkprivate-win32.h | 22 ++++-- gdk/win32/gdkwin32.h | 1 + gdk/win32/gdkwindow-win32.c | 2 +- gtk/gtk.def | 5 ++ gtk/gtkcompat.h.in | 3 +- gtk/testgtk.c | 5 ++ tests/testgtk.c | 5 ++ 24 files changed, 527 insertions(+), 163 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e023987e..add37fa33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2000-03-07 Tor Lillqvist + + * gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes: + (gdk_win32_gdi_failed) New function for reporting errors from GDI, + for which it is no use to call GetLastError onWin9x. + (gdk_other_api_failed) New function, for general error + reporting without calling GetLastError. + (gdk_win32_api_failed) OTOH, this function always calls + GetLastError. (gdk_win32_last_error_string) Remove this function, + GLib has the equivalent now. + + * gdk/win32/gdkprivate-win32.h: Declare the above, and macros to + call them with function name, file name and line number in the + arguments. + + * gdk/win32/*.c: Use the new macros for reporting errors from GDI + functions. + + * gtk/gtk.def: Add some missing entry points. + + * gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and + gtk_paned_set_gutter_size, which don't exist any longer, as void. + + Fixes by Hans Breuer: + + * gdk/makefile.msc: Update for debugging. + + * gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake + implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or + PS_DASHDOTDOT or PS_DASH styles depending on the number of entries + in the dash_list. + + * gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in + the x11 backend. + + * gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro. + + * gtk/testgtk.c: Include config.h, guard inclusion of unistd.h. + 2000-03-04 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (struct _GdkWindowWin32Data): Store diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 6e023987e..add37fa33 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,42 @@ +2000-03-07 Tor Lillqvist + + * gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes: + (gdk_win32_gdi_failed) New function for reporting errors from GDI, + for which it is no use to call GetLastError onWin9x. + (gdk_other_api_failed) New function, for general error + reporting without calling GetLastError. + (gdk_win32_api_failed) OTOH, this function always calls + GetLastError. (gdk_win32_last_error_string) Remove this function, + GLib has the equivalent now. + + * gdk/win32/gdkprivate-win32.h: Declare the above, and macros to + call them with function name, file name and line number in the + arguments. + + * gdk/win32/*.c: Use the new macros for reporting errors from GDI + functions. + + * gtk/gtk.def: Add some missing entry points. + + * gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and + gtk_paned_set_gutter_size, which don't exist any longer, as void. + + Fixes by Hans Breuer: + + * gdk/makefile.msc: Update for debugging. + + * gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake + implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or + PS_DASHDOTDOT or PS_DASH styles depending on the number of entries + in the dash_list. + + * gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in + the x11 backend. + + * gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro. + + * gtk/testgtk.c: Include config.h, guard inclusion of unistd.h. + 2000-03-04 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (struct _GdkWindowWin32Data): Store diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6e023987e..add37fa33 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,42 @@ +2000-03-07 Tor Lillqvist + + * gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes: + (gdk_win32_gdi_failed) New function for reporting errors from GDI, + for which it is no use to call GetLastError onWin9x. + (gdk_other_api_failed) New function, for general error + reporting without calling GetLastError. + (gdk_win32_api_failed) OTOH, this function always calls + GetLastError. (gdk_win32_last_error_string) Remove this function, + GLib has the equivalent now. + + * gdk/win32/gdkprivate-win32.h: Declare the above, and macros to + call them with function name, file name and line number in the + arguments. + + * gdk/win32/*.c: Use the new macros for reporting errors from GDI + functions. + + * gtk/gtk.def: Add some missing entry points. + + * gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and + gtk_paned_set_gutter_size, which don't exist any longer, as void. + + Fixes by Hans Breuer: + + * gdk/makefile.msc: Update for debugging. + + * gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake + implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or + PS_DASHDOTDOT or PS_DASH styles depending on the number of entries + in the dash_list. + + * gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in + the x11 backend. + + * gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro. + + * gtk/testgtk.c: Include config.h, guard inclusion of unistd.h. + 2000-03-04 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (struct _GdkWindowWin32Data): Store diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 6e023987e..add37fa33 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,42 @@ +2000-03-07 Tor Lillqvist + + * gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes: + (gdk_win32_gdi_failed) New function for reporting errors from GDI, + for which it is no use to call GetLastError onWin9x. + (gdk_other_api_failed) New function, for general error + reporting without calling GetLastError. + (gdk_win32_api_failed) OTOH, this function always calls + GetLastError. (gdk_win32_last_error_string) Remove this function, + GLib has the equivalent now. + + * gdk/win32/gdkprivate-win32.h: Declare the above, and macros to + call them with function name, file name and line number in the + arguments. + + * gdk/win32/*.c: Use the new macros for reporting errors from GDI + functions. + + * gtk/gtk.def: Add some missing entry points. + + * gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and + gtk_paned_set_gutter_size, which don't exist any longer, as void. + + Fixes by Hans Breuer: + + * gdk/makefile.msc: Update for debugging. + + * gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake + implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or + PS_DASHDOTDOT or PS_DASH styles depending on the number of entries + in the dash_list. + + * gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in + the x11 backend. + + * gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro. + + * gtk/testgtk.c: Include config.h, guard inclusion of unistd.h. + 2000-03-04 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (struct _GdkWindowWin32Data): Store diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 6e023987e..add37fa33 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,42 @@ +2000-03-07 Tor Lillqvist + + * gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes: + (gdk_win32_gdi_failed) New function for reporting errors from GDI, + for which it is no use to call GetLastError onWin9x. + (gdk_other_api_failed) New function, for general error + reporting without calling GetLastError. + (gdk_win32_api_failed) OTOH, this function always calls + GetLastError. (gdk_win32_last_error_string) Remove this function, + GLib has the equivalent now. + + * gdk/win32/gdkprivate-win32.h: Declare the above, and macros to + call them with function name, file name and line number in the + arguments. + + * gdk/win32/*.c: Use the new macros for reporting errors from GDI + functions. + + * gtk/gtk.def: Add some missing entry points. + + * gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and + gtk_paned_set_gutter_size, which don't exist any longer, as void. + + Fixes by Hans Breuer: + + * gdk/makefile.msc: Update for debugging. + + * gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake + implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or + PS_DASHDOTDOT or PS_DASH styles depending on the number of entries + in the dash_list. + + * gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in + the x11 backend. + + * gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro. + + * gtk/testgtk.c: Include config.h, guard inclusion of unistd.h. + 2000-03-04 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (struct _GdkWindowWin32Data): Store diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 6e023987e..add37fa33 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,42 @@ +2000-03-07 Tor Lillqvist + + * gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes: + (gdk_win32_gdi_failed) New function for reporting errors from GDI, + for which it is no use to call GetLastError onWin9x. + (gdk_other_api_failed) New function, for general error + reporting without calling GetLastError. + (gdk_win32_api_failed) OTOH, this function always calls + GetLastError. (gdk_win32_last_error_string) Remove this function, + GLib has the equivalent now. + + * gdk/win32/gdkprivate-win32.h: Declare the above, and macros to + call them with function name, file name and line number in the + arguments. + + * gdk/win32/*.c: Use the new macros for reporting errors from GDI + functions. + + * gtk/gtk.def: Add some missing entry points. + + * gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and + gtk_paned_set_gutter_size, which don't exist any longer, as void. + + Fixes by Hans Breuer: + + * gdk/makefile.msc: Update for debugging. + + * gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake + implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or + PS_DASHDOTDOT or PS_DASH styles depending on the number of entries + in the dash_list. + + * gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in + the x11 backend. + + * gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro. + + * gtk/testgtk.c: Include config.h, guard inclusion of unistd.h. + 2000-03-04 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (struct _GdkWindowWin32Data): Store diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 6e023987e..add37fa33 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,42 @@ +2000-03-07 Tor Lillqvist + + * gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes: + (gdk_win32_gdi_failed) New function for reporting errors from GDI, + for which it is no use to call GetLastError onWin9x. + (gdk_other_api_failed) New function, for general error + reporting without calling GetLastError. + (gdk_win32_api_failed) OTOH, this function always calls + GetLastError. (gdk_win32_last_error_string) Remove this function, + GLib has the equivalent now. + + * gdk/win32/gdkprivate-win32.h: Declare the above, and macros to + call them with function name, file name and line number in the + arguments. + + * gdk/win32/*.c: Use the new macros for reporting errors from GDI + functions. + + * gtk/gtk.def: Add some missing entry points. + + * gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and + gtk_paned_set_gutter_size, which don't exist any longer, as void. + + Fixes by Hans Breuer: + + * gdk/makefile.msc: Update for debugging. + + * gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake + implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or + PS_DASHDOTDOT or PS_DASH styles depending on the number of entries + in the dash_list. + + * gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in + the x11 backend. + + * gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro. + + * gtk/testgtk.c: Include config.h, guard inclusion of unistd.h. + 2000-03-04 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (struct _GdkWindowWin32Data): Store diff --git a/gdk/makefile.msc b/gdk/makefile.msc index 5509cefc2..88d849602 100644 --- a/gdk/makefile.msc +++ b/gdk/makefile.msc @@ -15,10 +15,12 @@ WTKIT = ..\..\wtkit126 !IFNDEF DEBUG # Full optimization: -OPTIMIZE = -Ox -MD +OPTIMIZE = -Ox -MD -Zi +LINKDEBUG = /nodefaultlib:libc.lib !ELSE # Debugging: OPTIMIZE = -Zi -MDd +LINKDEBUG = /nodefaultlib:libcd.lib /nodefaultlib:libc.lib /debug !ENDIF # cl -? describes the options diff --git a/gdk/win32/gdkcolor-win32.c b/gdk/win32/gdkcolor-win32.c index 85c7574b0..037d3d3b9 100644 --- a/gdk/win32/gdkcolor-win32.c +++ b/gdk/win32/gdkcolor-win32.c @@ -87,7 +87,7 @@ alloc_color_cells(Colormap colormap, #ifdef SOME_STRANGE_BUG if (!ResizePalette (colormap->palette, colormap->size + nmore)) { - WIN32_API_FAILED ("ResizePalette") + WIN32_GDI_FAILED ("ResizePalette") return FALSE; } g_print("alloc_color_cells: %#x to %d\n", @@ -204,7 +204,7 @@ alloc_color(Colormap colormap, /* It was a free'd entry anyway, so we can use it, and set it to the correct color. */ if (SetPaletteEntries (colormap->palette, index, 1, &entry) == 0) - WIN32_API_FAILED ("SetPaletteEntries #1"); + WIN32_GDI_FAILED ("SetPaletteEntries"); } else { @@ -217,7 +217,7 @@ alloc_color(Colormap colormap, /* A free slot, use it. */ if (SetPaletteEntries (colormap->palette, index, 1, &entry) == 0) - WIN32_API_FAILED ("SetPaletteEntries #2"); + WIN32_GDI_FAILED ("SetPaletteEntries"); index = i; break; } @@ -237,9 +237,9 @@ alloc_color(Colormap colormap, index = colormap->size; colormap->size++; if (!ResizePalette (colormap->palette, colormap->size)) - WIN32_API_FAILED ("ResizePalette"); + WIN32_GDI_FAILED ("ResizePalette"); if (SetPaletteEntries (colormap->palette, index, 1, &entry) == 0) - WIN32_API_FAILED ("SetPaletteEntries #3"); + WIN32_GDI_FAILED ("SetPaletteEntries"); } } } @@ -327,7 +327,7 @@ free_colors (Colormap colormap, if (SetPaletteEntries (colormap->palette, lowestpixel, highestpixel - lowestpixel + 1, entries + lowestpixel) == 0) - WIN32_API_FAILED ("SetPaletteEntries"); + WIN32_GDI_FAILED ("SetPaletteEntries"); #endif colormap->stale = TRUE; #if 0 @@ -1551,7 +1551,7 @@ gdk_colormap_change (GdkColormap *colormap, if (SetPaletteEntries (private->xcolormap->palette, 0, ncolors, palette) == 0) - WIN32_API_FAILED ("SetPaletteEntries"); + WIN32_GDI_FAILED ("SetPaletteEntries"); private->xcolormap->stale = TRUE; break; @@ -1858,7 +1858,7 @@ gdk_colormap_alloc_colors_private (GdkColormap *colormap, if (SetPaletteEntries (private->xcolormap->palette, 0, nstore, store) == 0) - WIN32_API_FAILED ("SetPaletteEntries"); + WIN32_GDI_FAILED ("SetPaletteEntries"); private->xcolormap->stale = TRUE; g_free (store); @@ -2116,7 +2116,7 @@ gdk_color_change (GdkColormap *colormap, if (SetPaletteEntries (private->xcolormap->palette, color->pixel, 1, &xcolor) == 0) - WIN32_API_FAILED ("SetPaletteEntries"); + WIN32_GDI_FAILED ("SetPaletteEntries"); private->xcolormap->stale = TRUE; return TRUE; diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c index 80b6df932..542f130dc 100644 --- a/gdk/win32/gdkdnd-win32.c +++ b/gdk/win32/gdkdnd-win32.c @@ -934,7 +934,7 @@ gdk_window_register_dnd (GdkWindow *window) context = target_context_new (); hres = CoLockObjectExternal ((IUnknown *) &context->idt, TRUE, FALSE); if (!SUCCEEDED (hres)) - WIN32_API_FAILED ("CoLockObjectExternal"); + OTHER_API_FAILED ("CoLockObjectExternal"); else { hres = RegisterDragDrop (GDK_DRAWABLE_XID (window), &context->idt); @@ -944,7 +944,7 @@ gdk_window_register_dnd (GdkWindow *window) CoLockObjectExternal ((IUnknown *) &context->idt, FALSE, FALSE); } else if (!SUCCEEDED (hres)) - WIN32_API_FAILED ("RegisterDragDrop"); + OTHER_API_FAILED ("RegisterDragDrop"); else { gdk_window_add_filter (window, gdk_destroy_filter, &context->idt); diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 519cc0f6d..3dd9b2015 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -225,7 +225,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable, if (gc_data->fill_style == GDK_OPAQUE_STIPPLED) { if (!BeginPath (hdc)) - WIN32_API_FAILED ("BeginPath"), ok = FALSE; + WIN32_GDI_FAILED ("BeginPath"), ok = FALSE; /* Win9x doesn't support Rectangle calls in a path, * thus use Polyline. @@ -244,24 +244,24 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable, MoveToEx (hdc, x, y, NULL); if (ok && !Polyline (hdc, pts, 4)) - WIN32_API_FAILED ("Polyline"), ok = FALSE; + WIN32_GDI_FAILED ("Polyline"), ok = FALSE; if (ok && !CloseFigure (hdc)) - WIN32_API_FAILED ("CloseFigure"), ok = FALSE; + WIN32_GDI_FAILED ("CloseFigure"), ok = FALSE; if (ok && !EndPath (hdc)) - WIN32_API_FAILED ("EndPath"), ok = FALSE; + WIN32_GDI_FAILED ("EndPath"), ok = FALSE; if (ok && !filled) if (!WidenPath (hdc)) - WIN32_API_FAILED ("WidenPath"), ok = FALSE; + WIN32_GDI_FAILED ("WidenPath"), ok = FALSE; if (ok && !FillPath (hdc)) - WIN32_API_FAILED ("FillPath"), ok = FALSE; + WIN32_GDI_FAILED ("FillPath"), ok = FALSE; if (hbr != NULL) if (!DeleteObject (hbr)) - WIN32_API_FAILED ("DeleteObject"); + WIN32_GDI_FAILED ("DeleteObject"); } else { @@ -271,7 +271,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable, oldbrush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH)); if (!Rectangle (hdc, x, y, x+width+1, y+height+1)) - WIN32_API_FAILED ("Rectangle"); + WIN32_GDI_FAILED ("Rectangle"); if (filled) SelectObject (hdc, oldpen); @@ -336,8 +336,9 @@ gdk_win32_draw_arc (GdkDrawable *drawable, x, y, x+width, y+height, nXStartArc, nYStartArc, nXEndArc, nYEndArc)); - Pie (hdc, x, y, x+width, y+height, - nXStartArc, nYStartArc, nXEndArc, nYEndArc); + if (!Pie (hdc, x, y, x+width, y+height, + nXStartArc, nYStartArc, nXEndArc, nYEndArc)) + WIN32_GDI_FAILED ("Pie"); } else { @@ -345,8 +346,9 @@ gdk_win32_draw_arc (GdkDrawable *drawable, x, y, x+width, y+height, nXStartArc, nYStartArc, nXEndArc, nYEndArc)); - Arc (hdc, x, y, x+width, y+height, - nXStartArc, nYStartArc, nXEndArc, nYEndArc); + if (!Arc (hdc, x, y, x+width, y+height, + nXStartArc, nYStartArc, nXEndArc, nYEndArc)) + WIN32_GDI_FAILED ("Arc"); } gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND); @@ -388,7 +390,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable, if (gc_data->fill_style == GDK_OPAQUE_STIPPLED) { if (!BeginPath (hdc)) - WIN32_API_FAILED ("BeginPath"), ok = FALSE; + WIN32_GDI_FAILED ("BeginPath"), ok = FALSE; MoveToEx (hdc, points[0].x, points[0].y, NULL); @@ -396,24 +398,24 @@ gdk_win32_draw_polygon (GdkDrawable *drawable, npoints--; if (ok && !Polyline (hdc, pts, 4)) - WIN32_API_FAILED ("Polyline"), ok = FALSE; + WIN32_GDI_FAILED ("Polyline"), ok = FALSE; if (ok && !CloseFigure (hdc)) - WIN32_API_FAILED ("CloseFigure"), ok = FALSE; + WIN32_GDI_FAILED ("CloseFigure"), ok = FALSE; if (ok && !EndPath (hdc)) - WIN32_API_FAILED ("EndPath"), ok = FALSE; + WIN32_GDI_FAILED ("EndPath"), ok = FALSE; if (ok && !filled) if (!WidenPath (hdc)) - WIN32_API_FAILED ("WidenPath"), ok = FALSE; + WIN32_GDI_FAILED ("WidenPath"), ok = FALSE; if (ok && !FillPath (hdc)) - WIN32_API_FAILED ("FillPath"), ok = FALSE; + WIN32_GDI_FAILED ("FillPath"), ok = FALSE; if (hbr != NULL) if (!DeleteObject (hbr)) - WIN32_API_FAILED ("DeleteObject"); + WIN32_GDI_FAILED ("DeleteObject"); } else { @@ -428,12 +430,12 @@ gdk_win32_draw_polygon (GdkDrawable *drawable, if (filled) { if (!Polygon (hdc, pts, npoints)) - WIN32_API_FAILED ("Polygon"); + WIN32_GDI_FAILED ("Polygon"); } else { if (!Polyline (hdc, pts, npoints)) - WIN32_API_FAILED ("Polyline"); + WIN32_GDI_FAILED ("Polyline"); } } g_free (pts); @@ -461,12 +463,12 @@ gdk_draw_text_handler (GdkWin32SingleFont *singlefont, if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL) { - WIN32_API_FAILED ("SelectObject"); + WIN32_GDI_FAILED ("SelectObject"); return; } if (!TextOutW (argp->hdc, argp->x, argp->y, wcstr, wclen)) - WIN32_API_FAILED ("TextOutW"); + WIN32_GDI_FAILED ("TextOutW"); GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size); argp->x += size.cx; @@ -662,20 +664,20 @@ gdk_win32_draw_drawable (GdkDrawable *drawable, if (src_private->window_type == GDK_DRAWABLE_PIXMAP) { if ((srcdc = CreateCompatibleDC (hdc)) == NULL) - WIN32_API_FAILED ("CreateCompatibleDC"); + WIN32_GDI_FAILED ("CreateCompatibleDC"); if ((hgdiobj = SelectObject (srcdc, GDK_DRAWABLE_XID (src))) == NULL) - WIN32_API_FAILED ("SelectObject #1"); + WIN32_GDI_FAILED ("SelectObject"); if (!BitBlt (hdc, xdest, ydest, width, height, srcdc, xsrc, ysrc, SRCCOPY)) - WIN32_API_FAILED ("BitBlt"); + WIN32_GDI_FAILED ("BitBlt"); if ((SelectObject (srcdc, hgdiobj) == NULL)) - WIN32_API_FAILED ("SelectObject #2"); + WIN32_GDI_FAILED ("SelectObject"); if (!DeleteDC (srcdc)) - WIN32_API_FAILED ("DeleteDC"); + WIN32_GDI_FAILED ("DeleteDC"); } else { @@ -700,20 +702,20 @@ gdk_win32_draw_drawable (GdkDrawable *drawable, if (!ScrollDC (hdc, xdest - xsrc, ydest - ysrc, &scrollRect, &clipRect, updateRgn, NULL)) - WIN32_API_FAILED ("ScrollDC"); + WIN32_GDI_FAILED ("ScrollDC"); if (!InvalidateRgn (GDK_DRAWABLE_XID (drawable), updateRgn, FALSE)) - WIN32_API_FAILED ("InvalidateRgn"); + WIN32_GDI_FAILED ("InvalidateRgn"); if (!UpdateWindow (GDK_DRAWABLE_XID (drawable))) - WIN32_API_FAILED ("UpdateWindow"); + WIN32_GDI_FAILED ("UpdateWindow"); } else { if ((srcdc = GetDC (GDK_DRAWABLE_XID (src))) == NULL) - WIN32_API_FAILED ("GetDC"); + WIN32_GDI_FAILED ("GetDC"); if (!BitBlt (hdc, xdest, ydest, width, height, srcdc, xsrc, ysrc, SRCCOPY)) - WIN32_API_FAILED ("BitBlt"); + WIN32_GDI_FAILED ("BitBlt"); ReleaseDC (GDK_DRAWABLE_XID (src), srcdc); } } @@ -761,11 +763,8 @@ gdk_win32_draw_segments (GdkDrawable *drawable, gboolean ok = TRUE; int i; - GDK_NOTE (MISC, g_print ("gdk_win32_draw_segments: %#x destdc: (%d) %#x " - "nsegs: %d\n", - GDK_DRAWABLE_XID (drawable), - gc_private, hdc, - nsegs)); + GDK_NOTE (MISC, g_print ("gdk_win32_draw_segments: %#x nsegs: %d\n", + GDK_DRAWABLE_XID (drawable), nsegs)); hdc = gdk_gc_predraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND); @@ -773,47 +772,47 @@ gdk_win32_draw_segments (GdkDrawable *drawable, if (gc_data->fill_style == GDK_OPAQUE_STIPPLED) { if (!BeginPath (hdc)) - WIN32_API_FAILED ("BeginPath"), ok = FALSE; + WIN32_GDI_FAILED ("BeginPath"), ok = FALSE; for (i = 0; i < nsegs; i++) { if (ok && !MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL)) - WIN32_API_FAILED ("MoveToEx"), ok = FALSE; + WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE; if (ok && !LineTo (hdc, segs[i].x2, segs[i].y2)) - WIN32_API_FAILED ("LineTo #1"), ok = FALSE; + WIN32_GDI_FAILED ("LineTo"), ok = FALSE; /* Draw end pixel */ if (ok && gc_data->pen_width == 1) if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2)) - WIN32_API_FAILED ("LineTo #2"), ok = FALSE; + WIN32_GDI_FAILED ("LineTo"), ok = FALSE; } if (ok && !EndPath (hdc)) - WIN32_API_FAILED ("EndPath"), ok = FALSE; + WIN32_GDI_FAILED ("EndPath"), ok = FALSE; if (ok && !WidenPath (hdc)) - WIN32_API_FAILED ("WidenPath"), ok = FALSE; + WIN32_GDI_FAILED ("WidenPath"), ok = FALSE; if (ok && !FillPath (hdc)) - WIN32_API_FAILED ("FillPath"), ok = FALSE; + WIN32_GDI_FAILED ("FillPath"), ok = FALSE; if (hbr != NULL) if (!DeleteObject (hbr)) - WIN32_API_FAILED ("DeleteObject"); + WIN32_GDI_FAILED ("DeleteObject"); } else { for (i = 0; i < nsegs; i++) { if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL)) - WIN32_API_FAILED ("MoveToEx"); + WIN32_GDI_FAILED ("MoveToEx"); if (!LineTo (hdc, segs[i].x2, segs[i].y2)) - WIN32_API_FAILED ("LineTo #1"); + WIN32_GDI_FAILED ("LineTo"); /* Draw end pixel */ if (gc_data->pen_width == 1) if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2)) - WIN32_API_FAILED ("LineTo #2"); + WIN32_GDI_FAILED ("LineTo"); } } gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND); @@ -846,7 +845,7 @@ gdk_win32_draw_lines (GdkDrawable *drawable, } if (!Polyline (hdc, pts, npoints)) - WIN32_API_FAILED ("Polyline"); + WIN32_GDI_FAILED ("Polyline"); g_free (pts); @@ -855,13 +854,13 @@ gdk_win32_draw_lines (GdkDrawable *drawable, { MoveToEx (hdc, points[npoints-1].x, points[npoints-1].y, NULL); if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y)) - WIN32_API_FAILED ("LineTo"); + WIN32_GDI_FAILED ("LineTo"); } #else MoveToEx (hdc, points[0].x, points[0].y, NULL); for (i = 1; i < npoints; i++) if (!LineTo (hdc, points[i].x, points[i].y)) - WIN32_API_FAILED ("LineTo #1"); + WIN32_GDI_FAILED ("LineTo"); /* Draw end pixel */ /* LineTo doesn't draw the last point, so if we have a pen width of 1, @@ -870,7 +869,7 @@ gdk_win32_draw_lines (GdkDrawable *drawable, */ if (gc_data->pen_width == 1 && windows_version > 0x80000000) if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y)) - WIN32_API_FAILED ("LineTo #2"); + WIN32_GDI_FAILED ("LineTo"); #endif gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND); } diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index a7a9caba5..8c362dcc1 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -332,7 +332,7 @@ gdk_events_init (void) if (p_TrackMouseEvent != NULL) GDK_NOTE (EVENTS, g_print ("Using TrackMouseEvent to detect leave events\n")); #endif - if (windows_version < 0x80000000 && (windows_version & 0xFF) == 5) + if (IS_WIN_NT (windows_version) && (windows_version & 0xFF) == 5) { /* On Win2k (Beta 3, at least) WM_IME_CHAR doesn't seem to work * correctly for non-Unicode applications. Handle @@ -2900,7 +2900,11 @@ static gboolean doesnt_want_scroll (gint mask, MSG *xevent) { +#if 0 return !(mask & GDK_SCROLL_MASK); +#else + return !(mask & GDK_BUTTON_PRESS_MASK); +#endif } static gboolean @@ -3782,9 +3786,9 @@ gdk_event_translate (GdkEvent *event, if (SelectPalette (hdc, colormap_private->xcolormap->palette, FALSE) == NULL) - WIN32_API_FAILED ("SelectPalette"); + WIN32_GDI_FAILED ("SelectPalette"); if ((k = RealizePalette (hdc)) == GDI_ERROR) - WIN32_API_FAILED ("RealizePalette"); + WIN32_GDI_FAILED ("RealizePalette"); #if 0 g_print ("WM_ERASEBKGND: selected %#x, realized %d colors\n", colormap_private->xcolormap->palette, k); @@ -3828,7 +3832,7 @@ gdk_event_translate (GdkEvent *event, g_print ("...CreateSolidBrush (%.08x) = %.08x\n", bg, hbr); #endif if (!FillRect (hdc, &rect, hbr)) - WIN32_API_FAILED ("FillRect"); + WIN32_GDI_FAILED ("FillRect"); DeleteObject (hbr); } else if (GDK_WINDOW_WIN32DATA (window)->bg_type == GDK_WIN32_BG_PIXMAP) @@ -3843,7 +3847,7 @@ gdk_event_translate (GdkEvent *event, GDK_NOTE (EVENTS, g_print ("...small pixmap, using brush\n")); hbr = CreatePatternBrush (GDK_DRAWABLE_XID (pixmap)); if (!FillRect (hdc, &rect, hbr)) - WIN32_API_FAILED ("FillRect"); + WIN32_GDI_FAILED ("FillRect"); DeleteObject (hbr); } else @@ -3859,12 +3863,12 @@ gdk_event_translate (GdkEvent *event, if (!(bgdc = CreateCompatibleDC (hdc))) { - WIN32_API_FAILED ("CreateCompatibleDC"); + WIN32_GDI_FAILED ("CreateCompatibleDC"); break; } if (!(oldbitmap = SelectObject (bgdc, GDK_DRAWABLE_XID (pixmap)))) { - WIN32_API_FAILED ("SelectObject"); + WIN32_GDI_FAILED ("SelectObject"); DeleteDC (bgdc); break; } @@ -3881,7 +3885,7 @@ gdk_event_translate (GdkEvent *event, pixmap_private->width, pixmap_private->height, bgdc, 0, 0, SRCCOPY)) { - WIN32_API_FAILED (" BitBlt"); + WIN32_GDI_FAILED ("BitBlt"); goto loopexit; } } @@ -3900,7 +3904,7 @@ gdk_event_translate (GdkEvent *event, hbr = GetStockObject (BLACK_BRUSH); GetClipBox (hdc, &rect); if (!FillRect (hdc, &rect, hbr)) - WIN32_API_FAILED ("FillRect"); + WIN32_GDI_FAILED ("FillRect"); } break; diff --git a/gdk/win32/gdkfont-win32.c b/gdk/win32/gdkfont-win32.c index 3301be3f7..7a0e35df8 100644 --- a/gdk/win32/gdkfont-win32.c +++ b/gdk/win32/gdkfont-win32.c @@ -282,7 +282,7 @@ gdk_font_full_name_get (GdkFont *font) if (GetObject (singlefont->xfont, sizeof (LOGFONT), &logfont) == 0) { - WIN32_API_FAILED ("GetObject"); + WIN32_GDI_FAILED ("GetObject"); return NULL; } @@ -1771,7 +1771,7 @@ gdk_text_size_handler (GdkWin32SingleFont *singlefont, if ((oldfont = SelectObject (gdk_DC, singlefont->xfont)) == NULL) { - WIN32_API_FAILED ("SelectObject"); + WIN32_GDI_FAILED ("SelectObject"); return; } GetTextExtentPoint32W (gdk_DC, wcstr, wclen, &this_size); diff --git a/gdk/win32/gdkgc-win32.c b/gdk/win32/gdkgc-win32.c index fa0371ba9..c832b7d00 100644 --- a/gdk/win32/gdkgc-win32.c +++ b/gdk/win32/gdkgc-win32.c @@ -256,7 +256,7 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values, { if (data->clip_region != NULL) if (!DeleteObject (data->clip_region)) - WIN32_API_FAILED ("DeleteObject"); + WIN32_GDI_FAILED ("DeleteObject"); if (values->clip_mask != NULL) { data->clip_region = @@ -531,18 +531,18 @@ gdk_win32_gc_get_values (GdkGC *gc, 1); hbr = GetStockObject (WHITE_BRUSH); if ((hdc = CreateCompatibleDC (NULL)) == NULL) - WIN32_API_FAILED ("CreateCompatibleDC"); + WIN32_GDI_FAILED ("CreateCompatibleDC"); if ((oldbitmap = SelectObject (hdc, GDK_DRAWABLE_XID (pixmap))) == NULL) - WIN32_API_FAILED ("SelectObject #1"); + WIN32_GDI_FAILED ("SelectObject"); hbr = GetStockObject (BLACK_BRUSH); if (!FillRect (hdc, &rect, hbr)) - WIN32_API_FAILED ("FillRect"); + WIN32_GDI_FAILED ("FillRect"); hbr = GetStockObject (WHITE_BRUSH); if (!FillRgn (hdc, data->clip_region, hbr)) - WIN32_API_FAILED ("FillRgn"); + WIN32_GDI_FAILED ("FillRgn"); if (SelectObject (hdc, oldbitmap) == NULL) - WIN32_API_FAILED ("SelectObject #2"); + WIN32_GDI_FAILED ("SelectObject"); DeleteDC (hdc); values->clip_mask = pixmap; } @@ -600,10 +600,62 @@ gdk_win32_gc_set_dashes (GdkGC *gc, { GdkGCWin32Data *data = GDK_GC_WIN32DATA (gc); - /* XXX ??? */ - data->pen_style &= ~(PS_STYLE_MASK); data->pen_style |= PS_DASH; + + /* + * Set the extended line style. This could be done by + * PS_USERSTYLE and ExtCreatePen; but ONLY on WinNT, + * so let's make a guess (based on the implementation + * in DIA). On Win9x this does only work for lines + * with width one ... + * + * More workarounds for Win9x descibed at: + * http://www.codeguru.com/gdi/dashed.shtml + */ + if (!IS_WIN_NT (windows_version) && data->pen_width > 1) + { + GDK_NOTE (MISC, g_print ("gdk_win32_gc_set_dashes: not fully supported\n")); + data->pen_style |= PS_SOLID; + return; + } + + /* data->pen_style = PS_COSMETIC; ??? */ + if (2 == n) + { + if ((dash_list[0] == dash_list[1]) && (dash_list[0] > 2)) + { + data->pen_style |= PS_DASH; + GDK_NOTE (MISC, g_print("gdk_win32_gc_set_dashes: PS_DASH (%d,%d)\n", + dash_list[0], dash_list[1])); + } + else + { + data->pen_style |= PS_DOT; + GDK_NOTE (MISC, g_print("gdk_win32_gc_set_dashes: PS_DOT (%d,%d)\n", + dash_list[0], dash_list[1])); + } + } + else if (4 == n) + { + data->pen_style |= PS_DASHDOT; + GDK_NOTE (MISC, g_print("gdk_win32_gc_set_dashes: PS_DASHDOT (%d,%d,%d,%d)\n", + dash_list[0], dash_list[1], + dash_list[2], dash_list[3])); + } + else if (6 == n) + { + data->pen_style |= PS_DASHDOTDOT; + GDK_NOTE (MISC, g_print("gdk_win32_gc_set_dashes: PS_DASHDOTDOT (%d,%d,%d,%d,%d,%d)\n", + dash_list[0], dash_list[1], + dash_list[2], dash_list[3], + dash_list[4], dash_list[5])); + } + else + { + data->pen_style |= PS_DASH; + GDK_NOTE (MISC, g_print("gdk_win32_gc_set_dashes: no guess for %d dashes\n", n)); + } } void @@ -618,7 +670,7 @@ gdk_gc_set_clip_rectangle (GdkGC *gc, if (data->clip_region != NULL) if (!DeleteObject (data->clip_region)) - WIN32_API_FAILED ("DeleteObject"); + WIN32_GDI_FAILED ("DeleteObject"); if (rectangle) { GDK_NOTE (MISC, @@ -630,7 +682,7 @@ gdk_gc_set_clip_rectangle (GdkGC *gc, CreateRectRgn (rectangle->x, rectangle->y, rectangle->x + rectangle->width, rectangle->y + rectangle->height)) == NULL) - WIN32_API_FAILED ("CreateRectRgn"); + WIN32_GDI_FAILED ("CreateRectRgn"); data->values_mask |= GDK_GC_CLIP_MASK; } @@ -659,7 +711,7 @@ gdk_gc_set_clip_region (GdkGC *gc, if (data->clip_region != NULL) if (!DeleteObject (data->clip_region)) - WIN32_API_FAILED ("DeleteObject"); + WIN32_GDI_FAILED ("DeleteObject"); if (region) { GdkRegionPrivate *region_private; @@ -692,7 +744,7 @@ gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc) gdk_drawable_unref (dst_data->stipple); if (dst_data->clip_region != NULL) if (!DeleteObject (dst_data->clip_region)) - WIN32_API_FAILED ("DeleteObject"); + WIN32_GDI_FAILED ("DeleteObject"); *dst_data = *src_data; @@ -702,7 +754,7 @@ gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc) rgn = g_malloc (nbytes); GetRegionData (dst_data->clip_region, nbytes, rgn); if ((dst_data->clip_region = ExtCreateRegion (NULL, nbytes, rgn)) == NULL) - WIN32_API_FAILED ("ExtCreateRegion"); + WIN32_GDI_FAILED ("ExtCreateRegion"); g_free (rgn); } @@ -773,7 +825,7 @@ predraw_set_foreground (GdkGCWin32Data *data, logpal.palPalEntry[1].peBlue = 0xFF; logpal.palPalEntry[1].peFlags = 0x00; if ((hpal = CreatePalette ((LOGPALETTE *) &logpal)) == NULL) - WIN32_API_FAILED ("CreatePalette"); + WIN32_GDI_FAILED ("CreatePalette"); } SelectPalette (data->xgc, hpal, FALSE); RealizePalette (data->xgc); @@ -784,11 +836,11 @@ predraw_set_foreground (GdkGCWin32Data *data, int k; if (SelectPalette (data->xgc, colormap_private->xcolormap->palette, FALSE) == NULL) - WIN32_API_FAILED ("SelectPalette"); + WIN32_GDI_FAILED ("SelectPalette"); if (TRUE || colormap_private->xcolormap->stale) { if ((k = RealizePalette (data->xgc)) == GDI_ERROR) - WIN32_API_FAILED ("RealizePalette"); + WIN32_GDI_FAILED ("RealizePalette"); colormap_private->xcolormap->stale = FALSE; } #if 0 @@ -800,7 +852,7 @@ predraw_set_foreground (GdkGCWin32Data *data, fg = gdk_colormap_color (colormap_private, data->foreground); if (SetTextColor (data->xgc, fg) == CLR_INVALID) - WIN32_API_FAILED ("SetTextColor"); + WIN32_GDI_FAILED ("SetTextColor"); /* Create and select pen and brush. */ @@ -809,16 +861,16 @@ predraw_set_foreground (GdkGCWin32Data *data, if ((hpen = ExtCreatePen (data->pen_style, data->pen_width, &logbrush, 0, NULL)) == NULL) - WIN32_API_FAILED ("ExtCreatePen"); + WIN32_GDI_FAILED ("ExtCreatePen"); if (SelectObject (data->xgc, hpen) == NULL) - WIN32_API_FAILED ("SelectObject #2"); + WIN32_GDI_FAILED ("SelectObject"); switch (data->fill_style) { case GDK_OPAQUE_STIPPLED: if ((hbr = CreatePatternBrush (GDK_DRAWABLE_XID (data->stipple))) == NULL) - WIN32_API_FAILED ("CreatePatternBrush"); + WIN32_GDI_FAILED ("CreatePatternBrush"); SetBrushOrgEx(data->xgc, data->ts_x_origin, data->ts_y_origin, NULL); @@ -828,11 +880,11 @@ predraw_set_foreground (GdkGCWin32Data *data, case GDK_SOLID: default: if ((hbr = CreateSolidBrush (fg)) == NULL) - WIN32_API_FAILED ("CreateSolidBrush"); + WIN32_GDI_FAILED ("CreateSolidBrush"); break; } if (SelectObject (data->xgc, hbr) == NULL) - WIN32_API_FAILED ("SelectObject #3"); + WIN32_GDI_FAILED ("SelectObject"); } void @@ -842,7 +894,7 @@ predraw_set_background (GdkGCWin32Data *data, COLORREF bg = gdk_colormap_color (colormap_private, data->background); if (SetBkColor (data->xgc, bg) == CLR_INVALID) - WIN32_API_FAILED ("SetBkColor"); + WIN32_GDI_FAILED ("SetBkColor"); } HDC @@ -862,21 +914,21 @@ gdk_gc_predraw (GdkDrawable *drawable, if (GDK_DRAWABLE_TYPE (drawable) == GDK_DRAWABLE_PIXMAP) { if ((data->xgc = CreateCompatibleDC (NULL)) == NULL) - WIN32_API_FAILED ("CreateCompatibleDC"); + WIN32_GDI_FAILED ("CreateCompatibleDC"); if ((data->saved_dc = SaveDC (data->xgc)) == 0) - WIN32_API_FAILED ("SaveDC #1"); + WIN32_GDI_FAILED ("SaveDC"); if (SelectObject (data->xgc, data->hwnd) == NULL) - WIN32_API_FAILED ("SelectObject #1"); + WIN32_GDI_FAILED ("SelectObject"); } else { if ((data->xgc = GetDC (data->hwnd)) == NULL) - WIN32_API_FAILED ("GetDC"); + WIN32_GDI_FAILED ("GetDC"); if ((data->saved_dc = SaveDC (data->xgc)) == 0) - WIN32_API_FAILED ("SaveDC #2"); + WIN32_GDI_FAILED ("SaveDC"); } if (usage & GDK_GC_FOREGROUND) @@ -888,15 +940,15 @@ gdk_gc_predraw (GdkDrawable *drawable, if (usage & GDK_GC_FONT) { if (SetBkMode (data->xgc, TRANSPARENT) == 0) - WIN32_API_FAILED ("SetBkMode"); + WIN32_GDI_FAILED ("SetBkMode"); if (SetTextAlign (data->xgc, TA_BASELINE) == GDI_ERROR) - WIN32_API_FAILED ("SetTextAlign"); + WIN32_GDI_FAILED ("SetTextAlign"); } if (data->values_mask & GDK_GC_FUNCTION) if (SetROP2 (data->xgc, data->rop2) == 0) - WIN32_API_FAILED ("SetROP2"); + WIN32_GDI_FAILED ("SetROP2"); if ((data->values_mask & GDK_GC_CLIP_MASK) && data->clip_region != NULL) @@ -925,14 +977,14 @@ gdk_gc_postdraw (GdkDrawable *drawable, if (usage & GDK_GC_FOREGROUND) { if ((hpen = GetCurrentObject (data->xgc, OBJ_PEN)) == NULL) - WIN32_API_FAILED ("GetCurrentObject #1"); + WIN32_GDI_FAILED ("GetCurrentObject"); if ((hbr = GetCurrentObject (data->xgc, OBJ_BRUSH)) == NULL) - WIN32_API_FAILED ("GetCurrentObject #2"); + WIN32_GDI_FAILED ("GetCurrentObject"); } if (!RestoreDC (data->xgc, data->saved_dc)) - WIN32_API_FAILED ("RestoreDC"); + WIN32_GDI_FAILED ("RestoreDC"); #if 0 if (colormap_private != NULL && colormap_private->xcolormap->rc_palette @@ -940,13 +992,13 @@ gdk_gc_postdraw (GdkDrawable *drawable, { SelectPalette (data->xgc, GetStockObject (DEFAULT_PALETTE), FALSE); if (!UnrealizeObject (colormap_private->xcolormap->palette)) - WIN32_API_FAILED ("UnrealizeObject"); + WIN32_GDI_FAILED ("UnrealizeObject"); } #endif if (GDK_DRAWABLE_TYPE (drawable) == GDK_DRAWABLE_PIXMAP) { if (!DeleteDC (data->xgc)) - WIN32_API_FAILED ("DeleteDC"); + WIN32_GDI_FAILED ("DeleteDC"); } else { @@ -955,11 +1007,11 @@ gdk_gc_postdraw (GdkDrawable *drawable, if (hpen != NULL) if (!DeleteObject (hpen)) - WIN32_API_FAILED ("DeleteObject #1"); + WIN32_GDI_FAILED ("DeleteObject"); if (hbr != NULL) if (!DeleteObject (hbr)) - WIN32_API_FAILED ("DeleteObject #2"); + WIN32_GDI_FAILED ("DeleteObject"); if ((data->values_mask & GDK_GC_CLIP_MASK) && data->clip_region != NULL @@ -1035,14 +1087,14 @@ BitmapToRegion (HBITMAP hBmp) logpal.palPalEntry[1].peBlue = 0xFF; logpal.palPalEntry[1].peFlags = 0; if ((bwPalette = CreatePalette ((LOGPALETTE *) &logpal)) == NULL) - WIN32_API_FAILED ("CreatePalette"); + WIN32_GDI_FAILED ("CreatePalette"); } /* Create a memory DC inside which we will scan the bitmap content */ hMemDC = CreateCompatibleDC (NULL); if (!hMemDC) { - WIN32_API_FAILED ("CreateCompatibleDC #1"); + WIN32_GDI_FAILED ("CreateCompatibleDC"); return NULL; } @@ -1085,7 +1137,7 @@ BitmapToRegion (HBITMAP hBmp) #endif if (!hbm8) { - WIN32_API_FAILED ("CreateDIBSection"); + WIN32_GDI_FAILED ("CreateDIBSection"); DeleteDC (hMemDC); return NULL; } @@ -1096,7 +1148,7 @@ BitmapToRegion (HBITMAP hBmp) hDC = CreateCompatibleDC (hMemDC); if (!hDC) { - WIN32_API_FAILED ("CreateCompatibleDC #2"); + WIN32_GDI_FAILED ("CreateCompatibleDC #2"); SelectObject (hMemDC, holdBmp); DeleteObject (hbm8); DeleteDC (hMemDC); @@ -1120,7 +1172,7 @@ BitmapToRegion (HBITMAP hBmp) if (!BitBlt (hMemDC, 0, 0, bm.bmWidth, bm.bmHeight, hDC, 0, 0, SRCCOPY)) { - WIN32_API_FAILED ("BitBlt"); + WIN32_GDI_FAILED ("BitBlt"); SelectObject (hDC, holdBmp2); SelectObject (hMemDC, holdBmp); DeleteObject (hbm8); diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c index 83fe69f2f..0ac9e1ff9 100644 --- a/gdk/win32/gdkimage-win32.c +++ b/gdk/win32/gdkimage-win32.c @@ -243,7 +243,7 @@ gdk_image_new_with_depth (GdkImageType type, if (private->ximage == NULL) { - WIN32_API_FAILED ("CreateDIBSection"); + WIN32_GDI_FAILED ("CreateDIBSection"); g_free (image); return NULL; } @@ -349,13 +349,13 @@ gdk_image_get (GdkWindow *window, { if ((hdc = CreateCompatibleDC (NULL)) == NULL) { - WIN32_API_FAILED ("CreateCompatibleDC #1"); + WIN32_GDI_FAILED ("CreateCompatibleDC"); g_free (image); return NULL; } if ((oldbitmap1 = SelectObject (hdc, GDK_DRAWABLE_XID (window))) == NULL) { - WIN32_API_FAILED ("SelectObject #1"); + WIN32_GDI_FAILED ("SelectObject"); DeleteDC (hdc); g_free (image); return NULL; @@ -378,7 +378,7 @@ gdk_image_get (GdkWindow *window, { if ((hdc = GetDC (GDK_DRAWABLE_XID (window))) == NULL) { - WIN32_API_FAILED ("GetDC"); + WIN32_GDI_FAILED ("GetDC"); g_free (image); return NULL; } @@ -395,7 +395,7 @@ gdk_image_get (GdkWindow *window, if ((memdc = CreateCompatibleDC (hdc)) == NULL) { - WIN32_API_FAILED ("CreateCompatibleDC #2"); + WIN32_GDI_FAILED ("CreateCompatibleDC"); if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP) { SelectObject (hdc, oldbitmap1); @@ -443,7 +443,7 @@ gdk_image_get (GdkWindow *window, CreateDIBSection (hdc, (BITMAPINFO *) &bmi, iUsage, &image->mem, NULL, 0)) == NULL) { - WIN32_API_FAILED ("CreateDIBSection"); + WIN32_GDI_FAILED ("CreateDIBSection"); DeleteDC (memdc); if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP) { @@ -460,7 +460,7 @@ gdk_image_get (GdkWindow *window, if ((oldbitmap2 = SelectObject (memdc, private->ximage)) == NULL) { - WIN32_API_FAILED ("SelectObject #2"); + WIN32_GDI_FAILED ("SelectObject"); DeleteObject (private->ximage); DeleteDC (memdc); if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP) @@ -478,7 +478,7 @@ gdk_image_get (GdkWindow *window, if (!BitBlt (memdc, 0, 0, width, height, hdc, x, y, SRCCOPY)) { - WIN32_API_FAILED ("BitBlt"); + WIN32_GDI_FAILED ("BitBlt"); SelectObject (memdc, oldbitmap2); DeleteObject (private->ximage); DeleteDC (memdc); @@ -496,10 +496,10 @@ gdk_image_get (GdkWindow *window, } if (SelectObject (memdc, oldbitmap2) == NULL) - WIN32_API_FAILED ("SelectObject #3"); + WIN32_GDI_FAILED ("SelectObject"); if (!DeleteDC (memdc)) - WIN32_API_FAILED ("DeleteDC"); + WIN32_GDI_FAILED ("DeleteDC"); if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP) { @@ -643,7 +643,7 @@ gdk_win32_image_destroy (GdkImage *image) case GDK_IMAGE_SHARED: if (!DeleteObject (private->ximage)) - WIN32_API_FAILED ("DeleteObject"); + WIN32_GDI_FAILED ("DeleteObject"); break; default: @@ -702,7 +702,7 @@ gdk_image_put (GdkImage *image, if (GetObject (image_private->ximage, sizeof (DIBSECTION), &ds) != sizeof (DIBSECTION)) { - WIN32_API_FAILED ("GetObject"); + WIN32_GDI_FAILED ("GetObject"); } #if 0 g_print("xdest = %d, ydest = %d, xsrc = %d, ysrc = %d, width = %d, height = %d\n", @@ -725,7 +725,7 @@ gdk_image_put (GdkImage *image, ds.dsBm.bmBits, (CONST BITMAPINFO *) &bmi, DIB_PAL_COLORS) == 0) - WIN32_API_FAILED ("SetDIBitsToDevice"); + WIN32_GDI_FAILED ("SetDIBitsToDevice"); } else { @@ -734,26 +734,26 @@ gdk_image_put (GdkImage *image, if ((memdc = CreateCompatibleDC (hdc)) == NULL) { - WIN32_API_FAILED ("CreateCompatibleDC"); + WIN32_GDI_FAILED ("CreateCompatibleDC"); gdk_gc_postdraw (drawable, gc_private, 0); return; } if ((oldbitmap = SelectObject (memdc, image_private->ximage)) == NULL) { - WIN32_API_FAILED ("SelectObject #1"); + WIN32_GDI_FAILED ("SelectObject"); gdk_gc_postdraw (drawable, gc_private, 0); return; } if (!BitBlt (hdc, xdest, ydest, width, height, memdc, xsrc, ysrc, SRCCOPY)) - WIN32_API_FAILED ("BitBlt"); + WIN32_GDI_FAILED ("BitBlt"); if (SelectObject (memdc, oldbitmap) == NULL) - WIN32_API_FAILED ("SelectObject #2"); + WIN32_GDI_FAILED ("SelectObject"); if (!DeleteDC (memdc)) - WIN32_API_FAILED ("DeleteDC"); + WIN32_GDI_FAILED ("DeleteDC"); } gdk_gc_postdraw (drawable, gc_private, 0); } diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c index 31f2cd7a6..855d9d4be 100644 --- a/gdk/win32/gdkmain-win32.c +++ b/gdk/win32/gdkmain-win32.c @@ -100,29 +100,36 @@ _gdk_windowing_init_check (int argc, return TRUE; } -gchar * -gdk_win32_last_error_string (void) +void +gdk_win32_api_failed (const gchar *where, + gint line, + const gchar *api) { - static gchar error[100]; - int nbytes; - - if ((nbytes = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError (), - 0, error, sizeof (error), NULL)) == 0) - strcat (error, "Unknown error"); - - if (nbytes > 2 && error[nbytes-1] == '\n' && error[nbytes-2] == '\r') - error[nbytes-2] = '\0'; + gchar *msg = g_win32_error_message (GetLastError ()); + g_warning ("%s:%d: %s failed: %s", where, line, api, msg); + g_free (msg); +} - return error; +void +gdk_other_api_failed (const gchar *where, + gint line, + const gchar *api) +{ + g_warning ("%s:%d: %s failed", where, line, api); } void -gdk_win32_api_failed (const gchar *where, +gdk_win32_gdi_failed (const gchar *where, gint line, const gchar *api) { - g_warning ("%s:%d: %s failed: %s", where, line, api, - gdk_win32_last_error_string ()); + /* On Win9x GDI calls are implemented in 16-bit code and thus + * don't set the 32-bit error code, sigh. + */ + if (IS_WIN_NT (windows_version)) + gdk_win32_api_failed (where, line, api); + else + gdk_other_api_failed (where, line, api); } void diff --git a/gdk/win32/gdkpixmap-win32.c b/gdk/win32/gdkpixmap-win32.c index bbe273c84..144ae7f40 100644 --- a/gdk/win32/gdkpixmap-win32.c +++ b/gdk/win32/gdkpixmap-win32.c @@ -58,7 +58,7 @@ gdk_win32_pixmap_destroy (GdkPixmap *pixmap) GDK_DRAWABLE_XID (pixmap))); if (!DeleteObject (GDK_DRAWABLE_XID (pixmap))) - WIN32_API_FAILED ("DeleteObject"); + WIN32_GDI_FAILED ("DeleteObject"); gdk_xid_table_remove (GDK_DRAWABLE_XID (pixmap)); @@ -137,7 +137,7 @@ gdk_pixmap_new (GdkWindow *window, if ((hdc = GetDC (GDK_DRAWABLE_XID (window))) == NULL) { - WIN32_API_FAILED ("GetDC"); + WIN32_GDI_FAILED ("GetDC"); g_free (private); return NULL; } @@ -207,7 +207,7 @@ gdk_pixmap_new (GdkWindow *window, CreateDIBSection (hdc, (BITMAPINFO *) &bmi, iUsage, (PVOID *) &bits, NULL, 0)) == NULL) { - WIN32_API_FAILED ("CreateDIBSection"); + WIN32_GDI_FAILED ("CreateDIBSection"); ReleaseDC (GDK_DRAWABLE_XID (window), hdc); g_free (pixmap); return NULL; diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index d4a06fc1a..5c1be52b6 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -311,15 +311,24 @@ void gdk_wchar_text_handle (GdkFont *font, void *), void *arg); -gchar *gdk_color_to_string (const GdkColor *); -gchar *gdk_win32_last_error_string (void); -void gdk_win32_api_failed (const gchar *where, - gint line, - const gchar *api); +gchar *gdk_color_to_string (const GdkColor *); +void gdk_win32_api_failed (const gchar *where, + gint line, + const gchar *api); +void gdk_other_api_failed (const gchar *where, + gint line, + const gchar *api); +void gdk_win32_gdi_failed (const gchar *where, + gint line, + const gchar *api); #ifdef __GNUC__ -#define WIN32_API_FAILED(api) gdk_win32_api_failed (__PRETTY_FUNCTION__, __LINE__, api) +#define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api) +#define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api) +#define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api) #else #define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__, __LINE__, api) +#define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__, __LINE__, api) +#define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__, __LINE__, api) #endif extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM); @@ -342,6 +351,7 @@ extern GdkAtom gdk_win32_dropfiles_atom; extern GdkAtom gdk_ole2_dnd_atom; extern DWORD windows_version; +#define IS_WIN_NT(dwVersion) (dwVersion < 0x80000000) #ifdef __cplusplus } diff --git a/gdk/win32/gdkwin32.h b/gdk/win32/gdkwin32.h index 3882a1507..8b8c61905 100644 --- a/gdk/win32/gdkwin32.h +++ b/gdk/win32/gdkwin32.h @@ -43,6 +43,7 @@ #define GDK_WINDOW_XDISPLAY GDK_DRAWABLE_XDISPLAY #define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID +#define GDK_FONT_XFONT(font) (((GdkWin32SingleFont *)((GdkFontPrivateWin32 *)font)->fonts->data)->xfont) GdkVisual* gdkx_visual_get (VisualID xvisualid); diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 4d802648e..2152a9f44 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -1060,7 +1060,7 @@ gdk_window_clear_area_e (GdkWindow *window, rect.top = y; rect.bottom = y + height; if (!InvalidateRect (GDK_DRAWABLE_XID (window), &rect, TRUE)) - WIN32_API_FAILED ("InvalidateRect"); + WIN32_GDI_FAILED ("InvalidateRect"); UpdateWindow (GDK_DRAWABLE_XID (window)); } } diff --git a/gtk/gtk.def b/gtk/gtk.def index a8cdbbb48..5cc80d511 100755 --- a/gtk/gtk.def +++ b/gtk/gtk.def @@ -160,6 +160,8 @@ EXPORTS gtk_alignment_get_type gtk_alignment_new gtk_alignment_set + gtk_arg_name_strip_type + gtk_args_collect_cleanup gtk_arrow_get_type gtk_arrow_new gtk_arrow_set @@ -560,6 +562,7 @@ EXPORTS gtk_hscrollbar_new gtk_hseparator_get_type gtk_hseparator_new + gtk_identifier_get_type gtk_idle_add gtk_idle_add_full gtk_idle_add_priority @@ -980,6 +983,8 @@ EXPORTS gtk_rc_reparse_all gtk_rc_set_default_files gtk_rc_set_image_loader + gtk_rc_style_new + gtk_rc_style_ref gtk_ruler_draw_pos gtk_ruler_draw_ticks gtk_ruler_get_type diff --git a/gtk/gtkcompat.h.in b/gtk/gtkcompat.h.in index cbd603d27..1b24d9eff 100644 --- a/gtk/gtkcompat.h.in +++ b/gtk/gtkcompat.h.in @@ -64,7 +64,8 @@ extern "C" { #define gtk_container_border_width gtk_container_set_border_width #define gtk_notebook_current_page gtk_notebook_get_current_page #define gtk_packer_configure gtk_packer_set_child_packing -#define gtk_paned_gutter_size gtk_paned_set_gutter_size +#define gtk_paned_gutter_size(p,s) (void) 0 +#define gtk_paned_set_gutter_size(p,s) (void) 0 #define gtk_paned_handle_size gtk_paned_set_handle_size #define gtk_scale_value_width gtk_scale_get_value_width #define gtk_window_position gtk_window_set_position diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 987230452..2bbaadd68 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -24,6 +24,8 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +#include "config.h" + #undef G_LOG_DOMAIN #include @@ -32,7 +34,10 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif + #include "gtk.h" #include "gdk/gdk.h" #include "gdk/gdkkeysyms.h" diff --git a/tests/testgtk.c b/tests/testgtk.c index 987230452..2bbaadd68 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -24,6 +24,8 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +#include "config.h" + #undef G_LOG_DOMAIN #include @@ -32,7 +34,10 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif + #include "gtk.h" #include "gdk/gdk.h" #include "gdk/gdkkeysyms.h" -- 2.43.2