Add an extra parameter so that we don't have to do unnecessary settings to

2000-02-13  Tor Lillqvist  <tml@iki.fi>

* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.

* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.

* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).

* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.

* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.

* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.

* gdk/win32/*.c: Use the WIN32_API_FAILED macro.

* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.

* gdk/makefile.cygwin: Link in the resource object separately.

* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
This commit is contained in:
Tor Lillqvist 2000-02-13 14:52:47 +00:00 committed by Tor Lillqvist
parent ef03cb5287
commit ff99eb7cc1
26 changed files with 1218 additions and 780 deletions

View File

@ -1,3 +1,42 @@
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.

View File

@ -1,3 +1,42 @@
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.

View File

@ -1,3 +1,42 @@
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.

View File

@ -1,3 +1,42 @@
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.

View File

@ -1,3 +1,42 @@
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.

View File

@ -1,3 +1,42 @@
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.

View File

@ -1,3 +1,42 @@
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.

View File

@ -48,7 +48,7 @@ gdk_OBJECTS = \
gdkconfig.h : gdkconfig.h.win32
$(CP) gdkconfig.h.win32 gdkconfig.h
gdk-$(GTK_VER).dll : $(gdk_OBJECTS) gdk.def win32/libgdk-win32.a
gdk-$(GTK_VER).dll : $(gdk_OBJECTS) gdk.def win32/libgdk-win32.a win32/gdk-win32res.o
$(GLIB)/build-dll gdk $(GTK_VER) gdk.def $(gdk_OBJECTS) -L win32 -lgdk-win32 -lwntab32x -L $(GLIB) -lglib-$(GLIB_VER) -lgdi32 -luser32 -limm32 -lshell32 -lole32 -luuid $(LDFLAGS) win32/gdk-win32res.o
.SUFFIXES: .c .o .i

View File

@ -87,8 +87,7 @@ alloc_color_cells(Colormap colormap,
#ifdef SOME_STRANGE_BUG
if (!ResizePalette (colormap->palette, colormap->size + nmore))
{
g_warning ("alloc_color_cells: ResizePalette to %d failed",
colormap->size + nmore);
WIN32_API_FAILED ("ResizePalette")
return FALSE;
}
g_print("alloc_color_cells: %#x to %d\n",
@ -205,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)
g_warning ("alloc_color: SetPaletteEntries #1 failed");
WIN32_API_FAILED ("SetPaletteEntries #1");
}
else
{
@ -218,7 +217,7 @@ alloc_color(Colormap colormap,
/* A free slot, use it. */
if (SetPaletteEntries (colormap->palette,
index, 1, &entry) == 0)
g_warning ("alloc_color: SetPaletteEntries #2 failed");
WIN32_API_FAILED ("SetPaletteEntries #2");
index = i;
break;
}
@ -238,10 +237,9 @@ alloc_color(Colormap colormap,
index = colormap->size;
colormap->size++;
if (!ResizePalette (colormap->palette, colormap->size))
g_warning ("alloc_color: ResizePalette to %d failed",
colormap->size);
WIN32_API_FAILED ("ResizePalette");
if (SetPaletteEntries (colormap->palette, index, 1, &entry) == 0)
g_warning ("alloc_color: SetPaletteEntries #3 failed");
WIN32_API_FAILED ("SetPaletteEntries #3");
}
}
}
@ -329,7 +327,7 @@ free_colors (Colormap colormap,
if (SetPaletteEntries (colormap->palette, lowestpixel,
highestpixel - lowestpixel + 1,
entries + lowestpixel) == 0)
g_warning ("free_colors: SetPaletteEntries failed");
WIN32_API_FAILED ("SetPaletteEntries");
#endif
colormap->stale = TRUE;
#if 0
@ -1553,7 +1551,7 @@ gdk_colormap_change (GdkColormap *colormap,
if (SetPaletteEntries (private->xcolormap->palette,
0, ncolors, palette) == 0)
g_warning ("gdk_colormap_change: SetPaletteEntries failed");
WIN32_API_FAILED ("SetPaletteEntries");
private->xcolormap->stale = TRUE;
break;
@ -1860,7 +1858,7 @@ gdk_colormap_alloc_colors_private (GdkColormap *colormap,
if (SetPaletteEntries (private->xcolormap->palette,
0, nstore, store) == 0)
g_warning ("gdk_colormap_alloc_colors_private: SetPaletteEntries failed");
WIN32_API_FAILED ("SetPaletteEntries");
private->xcolormap->stale = TRUE;
g_free (store);
@ -2118,7 +2116,7 @@ gdk_color_change (GdkColormap *colormap,
if (SetPaletteEntries (private->xcolormap->palette,
color->pixel, 1, &xcolor) == 0)
g_warning ("gdk_color_change: SetPaletteEntries failed");
WIN32_API_FAILED ("SetPaletteEntries");
private->xcolormap->stale = TRUE;
return TRUE;
@ -2215,12 +2213,12 @@ gdk_colormap_cmp (Colormap *a,
return (*a == *b);
}
char *
gchar *
gdk_color_to_string (const GdkColor *color)
{
static char buf[100];
sprintf (buf, "(%.04x,%.04x,%.04x): %.06x",
sprintf (buf, "(%.04x,%.04x,%.04x):%.06x",
color->red, color->green, color->blue, color->pixel);
return buf;

View File

@ -117,7 +117,7 @@ gdk_cursor_new (GdkCursorType cursor_type)
{
xcursor = LoadCursor (gdk_DLLInstance, cursors[i].name);
if (xcursor == NULL)
g_warning ("gdk_cursor_new: LoadCursor failed");
WIN32_API_FAILED ("LoadCursor");
GDK_NOTE (MISC, g_print ("gdk_cursor_new: %#x %d\n",
xcursor, cursor_type));
}
@ -132,7 +132,7 @@ gdk_cursor_new (GdkCursorType cursor_type)
private->xcursor = xcursor;
cursor = (GdkCursor*) private;
cursor->type = cursor_type;
cursor->refcount = 1;
cursor->ref_count = 1;
return cursor;
}
@ -268,7 +268,7 @@ _gdk_cursor_destroy (GdkCursor *cursor)
if (cursor->type == GDK_CURSOR_IS_PIXMAP)
if (!DestroyIcon (private->xcursor))
g_warning ("_gdk_cursor_destroy: DestroyIcon failed");
WIN32_API_FAILED ("DestroyIcon");
g_free (private);
}

View File

@ -934,7 +934,7 @@ gdk_window_register_dnd (GdkWindow *window)
context = target_context_new ();
hres = CoLockObjectExternal ((IUnknown *) &context->idt, TRUE, FALSE);
if (!SUCCEEDED (hres))
g_warning ("gdk_window_register_dnd: CoLockObjectExternal failed");
WIN32_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))
g_warning ("gdk_window_register_dnd: RegisterDragDrop failed");
WIN32_API_FAILED ("RegisterDragDrop");
else
{
gdk_window_add_filter (window, gdk_destroy_filter, &context->idt);

View File

@ -163,8 +163,8 @@ gdk_drawable_set_colormap (GdkDrawable *drawable,
drawable_private->colormap = colormap;
gdk_colormap_ref (drawable_private->colormap);
if (GDK_IS_WINDOW (drawable) &&
drawable_private->window_type != GDK_WINDOW_TOPLEVEL)
if (GDK_IS_WINDOW (drawable)
&& drawable_private->window_type != GDK_WINDOW_TOPLEVEL)
gdk_window_add_colormap_windows (drawable);
}
}
@ -186,20 +186,20 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
gint width,
gint height)
{
GdkGCPrivate *gc_private;
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
HDC hdc;
HGDIOBJ oldpen, oldbrush;
gc_private = (GdkGCPrivate*) gc;
hdc = gdk_gc_predraw (drawable, gc_private);
GDK_NOTE (MISC, g_print ("gdk_draw_rectangle: %#x (%d) %s%dx%d@+%d+%d\n",
GDK_NOTE (MISC, g_print ("gdk_win32_draw_rectangle: %#x (%d) %s%dx%d@+%d+%d\n",
GDK_DRAWABLE_XID (drawable),
gc_private,
(filled ? "fill " : ""),
width, height, x, y));
hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
#if 0
{
HBRUSH hbr = GetCurrentObject (hdc, OBJ_BRUSH);
@ -219,20 +219,62 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
}
#endif
if (filled)
oldpen = SelectObject (hdc, GetStockObject (NULL_PEN));
else
oldbrush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH));
if (!Rectangle (hdc, x, y, x+width+1, y+height+1))
g_warning ("gdk_draw_rectangle: Rectangle failed");
if (filled)
SelectObject (hdc, oldpen);
else
SelectObject (hdc, oldbrush);
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED)
{
if (!BeginPath (hdc))
WIN32_API_FAILED ("BeginPath");
else
{
/* Win9x doesn't support Rectangle calls in a path,
* thus use Polyline.
*/
POINT pts[4];
pts[0].x = x;
pts[0].y = y;
pts[1].x = x + width + 1;
pts[1].y = y;
pts[2].x = x + width + 1;
pts[2].y = y + height + 1;
pts[3].x = x;
pts[3].y = y + height + 1;
MoveToEx (hdc, x, y, NULL);
if (!Polyline (hdc, pts, 4))
WIN32_API_FAILED ("Polyline");
if (!CloseFigure (hdc))
WIN32_API_FAILED ("CloseFigure");
gdk_gc_postdraw (drawable, gc_private);
if (!EndPath (hdc))
WIN32_API_FAILED ("EndPath");
if (!filled)
if (!WidenPath (hdc))
WIN32_API_FAILED ("WidenPath");
if (!FillPath (hdc))
WIN32_API_FAILED ("FillPath");
}
}
else
{
if (filled)
oldpen = SelectObject (hdc, GetStockObject (NULL_PEN));
else
oldbrush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH));
if (!Rectangle (hdc, x, y, x+width+1, y+height+1))
WIN32_API_FAILED ("Rectangle");
if (filled)
SelectObject (hdc, oldpen);
else
SelectObject (hdc, oldbrush);
}
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
}
static void
@ -258,7 +300,8 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
if (width != 0 && height != 0 && angle2 != 0)
{
hdc = gdk_gc_predraw (drawable, gc_private);
hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
if (angle2 >= 360*64)
{
@ -280,6 +323,8 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
nYStartArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.);
}
/* GDK_OPAQUE_STIPPLED arcs not implemented. */
if (filled)
{
GDK_NOTE (MISC, g_print ("...Pie(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n",
@ -298,7 +343,8 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
Arc (hdc, x, y, x+width, y+height,
nXStartArc, nYStartArc, nXEndArc, nYEndArc);
}
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
}
}
@ -309,22 +355,22 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
GdkGCPrivate *gc_private;
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
HDC hdc;
POINT *pts;
int i;
gc_private = (GdkGCPrivate*) gc;
GDK_NOTE (MISC, g_print ("gdk_draw_polygon: %#x (%d) %d\n",
GDK_NOTE (MISC, g_print ("gdk_win32_draw_polygon: %#x (%d) %d\n",
GDK_DRAWABLE_XID (drawable), gc_private,
npoints));
if (npoints < 2)
return;
hdc = gdk_gc_predraw (drawable, gc_private);
pts = g_malloc ((npoints+1) * sizeof (POINT));
hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
pts = g_new (POINT, npoints+1);
for (i = 0; i < npoints; i++)
{
@ -332,25 +378,57 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
pts[i].y = points[i].y;
}
if ((points[0].x != points[npoints-1].x) ||
(points[0].y != points[npoints-1].y))
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED)
{
pts[npoints].x = points[0].x;
pts[npoints].y = points[0].y;
npoints++;
}
if (filled)
{
if (!Polygon (hdc, pts, npoints))
g_warning ("gdk_draw_polygon: Polygon failed");
if (!BeginPath (hdc))
WIN32_API_FAILED ("BeginPath");
else
{
MoveToEx (hdc, points[0].x, points[0].y, NULL);
if (pts[0].x == pts[npoints-1].x && pts[0].y == pts[npoints-1].y)
npoints--;
if (!Polyline (hdc, pts, 4))
WIN32_API_FAILED ("Polyline");
if (!CloseFigure (hdc))
WIN32_API_FAILED ("CloseFigure");
if (!EndPath (hdc))
WIN32_API_FAILED ("EndPath");
if (!filled)
if (!WidenPath (hdc))
WIN32_API_FAILED ("WidenPath");
if (!FillPath (hdc))
WIN32_API_FAILED ("FillPath");
}
}
else
{
if (!Polyline (hdc, pts, npoints))
g_warning ("gdk_draw_polygon: Polyline failed");
if (points[0].x != points[npoints-1].x
|| points[0].y != points[npoints-1].y)
{
pts[npoints].x = points[0].x;
pts[npoints].y = points[0].y;
npoints++;
}
if (filled)
{
if (!Polygon (hdc, pts, npoints))
WIN32_API_FAILED ("Polygon");
}
else
{
if (!Polyline (hdc, pts, npoints))
WIN32_API_FAILED ("Polyline");
}
}
g_free (pts);
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
}
typedef struct
@ -374,12 +452,12 @@ gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL)
{
g_warning ("gdk_draw_text_handler: SelectObject failed");
WIN32_API_FAILED ("SelectObject");
return;
}
if (!TextOutW (argp->hdc, argp->x, argp->y, wcstr, wclen))
g_warning ("gdk_draw_text_handler: TextOutW failed");
WIN32_API_FAILED ("TextOutW");
GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size);
argp->x += size.cx;
@ -413,7 +491,8 @@ gdk_win32_draw_text (GdkDrawable *drawable,
arg.x = x;
arg.y = y;
arg.hdc = gdk_gc_predraw (drawable, gc_private);
arg.hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_FONT);
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d,%d) \"%.*s\" (len %d)\n",
GDK_DRAWABLE_XID (drawable),
@ -430,7 +509,7 @@ gdk_win32_draw_text (GdkDrawable *drawable,
g_free (wcstr);
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_FONT);
}
static void
@ -460,7 +539,8 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
arg.x = x;
arg.y = y;
arg.hdc = gdk_gc_predraw (drawable, gc_private);
arg.hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_FONT);
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d,%d) len: %d\n",
GDK_DRAWABLE_XID (drawable),
@ -481,7 +561,7 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_FONT);
}
static void
@ -514,7 +594,7 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
width, height, xsrc, ysrc,
GDK_DRAWABLE_XID (drawable), xdest, ydest));
hdc = gdk_gc_predraw (drawable, gc_private);
hdc = gdk_gc_predraw (drawable, gc_private, 0);
src_rgn = CreateRectRgn (0, 0, src_private->width + 1, src_private->height + 1);
draw_rgn = CreateRectRgn (xsrc, ysrc, xsrc + width + 1, ysrc + height + 1);
@ -573,20 +653,20 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
if (src_private->window_type == GDK_DRAWABLE_PIXMAP)
{
if ((srcdc = CreateCompatibleDC (hdc)) == NULL)
g_warning ("gdk_draw_pixmap: CreateCompatibleDC failed");
WIN32_API_FAILED ("CreateCompatibleDC");
if ((hgdiobj = SelectObject (srcdc, GDK_DRAWABLE_XID (src))) == NULL)
g_warning ("gdk_draw_pixmap: SelectObject #1 failed");
WIN32_API_FAILED ("SelectObject #1");
if (!BitBlt (hdc, xdest, ydest, width, height,
srcdc, xsrc, ysrc, SRCCOPY))
g_warning ("gdk_draw_pixmap: BitBlt failed");
WIN32_API_FAILED ("BitBlt");
if ((SelectObject (srcdc, hgdiobj) == NULL))
g_warning ("gdk_draw_pixmap: SelectObject #2 failed");
WIN32_API_FAILED ("SelectObject #2");
if (!DeleteDC (srcdc))
g_warning ("gdk_draw_pixmap: DeleteDC failed");
WIN32_API_FAILED ("DeleteDC");
}
else
{
@ -611,24 +691,24 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
if (!ScrollDC (hdc, xdest - xsrc, ydest - ysrc,
&scrollRect, &clipRect,
updateRgn, NULL))
g_warning ("gdk_draw_pixmap: ScrollDC failed");
WIN32_API_FAILED ("ScrollDC");
if (!InvalidateRgn (GDK_DRAWABLE_XID (drawable), updateRgn, FALSE))
g_warning ("gdk_draw_pixmap: InvalidateRgn failed");
WIN32_API_FAILED ("InvalidateRgn");
if (!UpdateWindow (GDK_DRAWABLE_XID (drawable)))
g_warning ("gdk_draw_pixmap: UpdateWindow failed");
WIN32_API_FAILED ("UpdateWindow");
}
else
{
if ((srcdc = GetDC (GDK_DRAWABLE_XID (src))) == NULL)
g_warning ("gdk_draw_pixmap: GetDC failed");
WIN32_API_FAILED ("GetDC");
if (!BitBlt (hdc, xdest, ydest, width, height,
srcdc, xsrc, ysrc, SRCCOPY))
g_warning ("gdk_draw_pixmap: BitBlt failed");
WIN32_API_FAILED ("BitBlt");
ReleaseDC (GDK_DRAWABLE_XID (src), srcdc);
}
}
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private, 0);
}
static void
@ -637,28 +717,26 @@ gdk_win32_draw_points (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
GdkGCPrivate *gc_private;
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
HDC hdc;
COLORREF fg;
int i;
gc_private = (GdkGCPrivate*) gc;
hdc = gdk_gc_predraw (drawable, gc_private);
GDK_NOTE (MISC, g_print ("gdk_draw_points: %#x destdc: (%d) %#x "
"npoints: %d\n",
GDK_DRAWABLE_XID (drawable),
gc_private, hdc,
npoints));
hdc = gdk_gc_predraw (drawable, gc_private, GDK_GC_FOREGROUND);
fg = GetTextColor (hdc);
for (i = 0; i < npoints; i++)
{
if (!MoveToEx (hdc, points[i].x, points[i].y, NULL))
g_warning ("gdk_draw_points: MoveToEx failed");
if (!LineTo (hdc, points[i].x + 1, points[i].y))
g_warning ("gdk_draw_points: LineTo failed");
SetPixel (hdc, points[i].x, points[i].y, fg);
}
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND);
}
static void
@ -667,27 +745,65 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
GdkSegment *segs,
gint nsegs)
{
GdkGCPrivate *gc_private;
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
HDC hdc;
int i;
gc_private = (GdkGCPrivate*) gc;
GDK_NOTE (MISC, g_print ("gdk_win32_draw_segments: %#x destdc: (%d) %#x "
"nsegs: %d\n",
GDK_DRAWABLE_XID (drawable),
gc_private, hdc,
nsegs));
hdc = gdk_gc_predraw (drawable, gc_private);
hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
for (i = 0; i < nsegs; i++)
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED)
{
if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
g_warning ("gdk_draw_segments: MoveToEx failed");
if (!LineTo (hdc, segs[i].x2, segs[i].y2))
g_warning ("gdk_draw_segments: LineTo #1 failed");
/* Draw end pixel */
if (GDK_GC_WIN32DATA (gc)->pen_width == 1)
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
g_warning ("gdk_draw_segments: LineTo #2 failed");
if (!BeginPath (hdc))
WIN32_API_FAILED ("BeginPath");
else
{
for (i = 0; i < nsegs; i++)
{
if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
WIN32_API_FAILED ("MoveToEx");
if (!LineTo (hdc, segs[i].x2, segs[i].y2))
WIN32_API_FAILED ("LineTo #1");
/* Draw end pixel */
if (gc_data->pen_width == 1)
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
WIN32_API_FAILED ("LineTo #2");
}
if (!EndPath (hdc))
WIN32_API_FAILED ("EndPath");
if (!WidenPath (hdc))
WIN32_API_FAILED ("WidenPath");
if (!FillPath (hdc))
WIN32_API_FAILED ("FillPath");
}
}
gdk_gc_postdraw (drawable, gc_private);
else
{
for (i = 0; i < nsegs; i++)
{
if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
WIN32_API_FAILED ("MoveToEx");
if (!LineTo (hdc, segs[i].x2, segs[i].y2))
WIN32_API_FAILED ("LineTo #1");
/* Draw end pixel */
if (gc_data->pen_width == 1)
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
WIN32_API_FAILED ("LineTo #2");
}
}
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
}
static void
@ -696,7 +812,8 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
GdkGCPrivate *gc_private;
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
HDC hdc;
POINT *pts;
int i;
@ -704,11 +821,10 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
if (npoints < 2)
return;
gc_private = (GdkGCPrivate*) gc;
hdc = gdk_gc_predraw (drawable, gc_private);
hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
#if 1
pts = g_malloc (npoints * sizeof (POINT));
pts = g_new (POINT, npoints);
for (i = 0; i < npoints; i++)
{
@ -717,31 +833,31 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
}
if (!Polyline (hdc, pts, npoints))
g_warning ("gdk_draw_lines: Polyline(,,%d) failed", npoints);
WIN32_API_FAILED ("Polyline");
g_free (pts);
/* Draw end pixel */
if (GDK_GC_WIN32DATA (gc)->pen_width == 1)
if (gc_data->pen_width == 1)
{
MoveToEx (hdc, points[npoints-1].x, points[npoints-1].y, NULL);
if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y))
g_warning ("gdk_draw_lines: LineTo failed");
WIN32_API_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))
g_warning ("gdk_draw_lines: LineTo #1 failed");
WIN32_API_FAILED ("LineTo #1");
/* Draw end pixel */
/* LineTo doesn't draw the last point, so if we have a pen width of 1,
* we draw the end pixel separately... With wider pens we don't care.
* //HB: But the NT developers don't read their API documentation ...
*/
if (GDK_GC_WIN32DATA (gc)->pen_width == 1 && windows_version > 0x80000000)
if (gc_data->pen_width == 1 && windows_version > 0x80000000)
if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y))
g_warning ("gdk_draw_lines: LineTo #2 failed");
WIN32_API_FAILED ("LineTo #2");
#endif
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
}

View File

@ -3692,9 +3692,9 @@ gdk_event_translate (GdkEvent *event,
if (SelectPalette (hdc, colormap_private->xcolormap->palette,
FALSE) == NULL)
g_warning ("WM_ERASEBKGND: SelectPalette failed");
WIN32_API_FAILED ("SelectPalette");
if ((k = RealizePalette (hdc)) == GDI_ERROR)
g_warning ("WM_ERASEBKGND: RealizePalette failed");
WIN32_API_FAILED ("RealizePalette");
#if 0
g_print ("WM_ERASEBKGND: selected %#x, realized %d colors\n",
colormap_private->xcolormap->palette, k);
@ -3740,7 +3740,7 @@ gdk_event_translate (GdkEvent *event,
g_print ("...CreateSolidBrush (%.08x) = %.08x\n", bg, hbr);
#endif
if (!FillRect (hdc, &rect, hbr))
g_warning ("WM_ERASEBKGND: FillRect failed");
WIN32_API_FAILED ("FillRect");
DeleteObject (hbr);
}
else if (GDK_WINDOW_WIN32DATA(window)->bg_type == GDK_WIN32_BG_PIXMAP)
@ -3755,7 +3755,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))
g_warning ("WM_ERASEBKGND: FillRect failed");
WIN32_API_FAILED ("FillRect");
DeleteObject (hbr);
}
else
@ -3771,12 +3771,12 @@ gdk_event_translate (GdkEvent *event,
if (!(bgdc = CreateCompatibleDC (hdc)))
{
g_warning ("WM_ERASEBKGND: CreateCompatibleDC failed");
WIN32_API_FAILED ("CreateCompatibleDC");
break;
}
if (!(oldbitmap = SelectObject (bgdc, GDK_DRAWABLE_XID (pixmap))))
{
g_warning ("WM_ERASEBKGND: SelectObject failed");
WIN32_API_FAILED ("SelectObject");
DeleteDC (bgdc);
break;
}
@ -3793,7 +3793,7 @@ gdk_event_translate (GdkEvent *event,
pixmap_private->width, pixmap_private->height,
bgdc, 0, 0, SRCCOPY))
{
g_warning ("WM_ERASEBKGND: BitBlt failed");
WIN32_API_FAILED (" BitBlt");
goto loopexit;
}
}
@ -3812,7 +3812,7 @@ gdk_event_translate (GdkEvent *event,
hbr = GetStockObject (BLACK_BRUSH);
GetClipBox (hdc, &rect);
if (!FillRect (hdc, &rect, hbr))
g_warning ("WM_ERASEBKGND: FillRect failed");
WIN32_API_FAILED ("FillRect");
}
break;
@ -4073,7 +4073,7 @@ gdk_event_translate (GdkEvent *event,
strcpy (ptr, "Huhhaa");
GlobalUnlock (hdata);
if (!SetClipboardData (CF_TEXT, hdata))
g_print ("SetClipboardData failed: %d\n", GetLastError ());
WIN32_API_FAILED ("SetClipboardData");
}
*ret_valp = 0;
*ret_val_flagp = TRUE;

View File

@ -282,7 +282,7 @@ gdk_font_full_name_get (GdkFont *font)
if (GetObject (singlefont->xfont, sizeof (LOGFONT), &logfont) == 0)
{
g_warning ("gdk_font_full_name_get: GetObject failed");
WIN32_API_FAILED ("GetObject");
return NULL;
}
@ -1771,7 +1771,7 @@ gdk_text_size_handler (GdkWin32SingleFont *singlefont,
if ((oldfont = SelectObject (gdk_DC, singlefont->xfont)) == NULL)
{
g_warning ("gdk_text_size_handler: SelectObject failed");
WIN32_API_FAILED ("SelectObject");
return;
}
GetTextExtentPoint32W (gdk_DC, wcstr, wclen, &this_size);

File diff suppressed because it is too large Load Diff

View File

@ -243,7 +243,7 @@ gdk_image_new_with_depth (GdkImageType type,
if (private->ximage == NULL)
{
g_warning ("gdk_image_new_with_depth: CreateDIBSection failed");
WIN32_API_FAILED ("CreateDIBSection");
g_free (image);
return NULL;
}
@ -349,13 +349,13 @@ gdk_image_get (GdkWindow *window,
{
if ((hdc = CreateCompatibleDC (NULL)) == NULL)
{
g_warning ("gdk_image_get: CreateCompatibleDC #1 failed");
WIN32_API_FAILED ("CreateCompatibleDC #1");
g_free (image);
return NULL;
}
if ((oldbitmap1 = SelectObject (hdc, GDK_DRAWABLE_XID (window))) == NULL)
{
g_warning ("gdk_image_get: SelectObject #1 failed");
WIN32_API_FAILED ("SelectObject #1");
DeleteDC (hdc);
g_free (image);
return NULL;
@ -378,7 +378,7 @@ gdk_image_get (GdkWindow *window,
{
if ((hdc = GetDC (GDK_DRAWABLE_XID (window))) == NULL)
{
g_warning ("gdk_image_get: GetDC failed");
WIN32_API_FAILED ("GetDC");
g_free (image);
return NULL;
}
@ -395,7 +395,7 @@ gdk_image_get (GdkWindow *window,
if ((memdc = CreateCompatibleDC (hdc)) == NULL)
{
g_warning ("gdk_image_get: CreateCompatibleDC #2 failed");
WIN32_API_FAILED ("CreateCompatibleDC #2");
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)
{
g_warning ("gdk_image_get: CreateDIBSection failed");
WIN32_API_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)
{
g_warning ("gdk_image_get: SelectObject #2 failed");
WIN32_API_FAILED ("SelectObject #2");
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))
{
g_warning ("gdk_image_get: BitBlt failed");
WIN32_API_FAILED ("BitBlt");
SelectObject (memdc, oldbitmap2);
DeleteObject (private->ximage);
DeleteDC (memdc);
@ -496,10 +496,10 @@ gdk_image_get (GdkWindow *window,
}
if (SelectObject (memdc, oldbitmap2) == NULL)
g_warning ("gdk_image_get: SelectObject #3 failed");
WIN32_API_FAILED ("SelectObject #3");
if (!DeleteDC (memdc))
g_warning ("gdk_image_get: DeleteDC failed");
WIN32_API_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))
g_warning ("gdk_win32_image_destroy: DeleteObject failed");
WIN32_API_FAILED ("DeleteObject");
break;
default:
@ -680,9 +680,7 @@ gdk_image_put (GdkImage *image,
drawable_private = (GdkDrawablePrivate *) drawable;
gc_private = (GdkGCPrivate *) gc;
/* The image can in fact be "shared", so don't test */
hdc = gdk_gc_predraw (drawable, gc_private);
hdc = gdk_gc_predraw (drawable, gc_private, 0);
colormap_private = (GdkColormapPrivateWin32 *) drawable_private->colormap;
if (colormap_private && colormap_private->xcolormap->rc_palette)
{
@ -704,7 +702,7 @@ gdk_image_put (GdkImage *image,
if (GetObject (image_private->ximage, sizeof (DIBSECTION),
&ds) != sizeof (DIBSECTION))
{
g_warning ("gdk_image_put: GetObject failed");
WIN32_API_FAILED ("GetObject");
}
#if 0
g_print("xdest = %d, ydest = %d, xsrc = %d, ysrc = %d, width = %d, height = %d\n",
@ -727,7 +725,7 @@ gdk_image_put (GdkImage *image,
ds.dsBm.bmBits,
(CONST BITMAPINFO *) &bmi,
DIB_PAL_COLORS) == 0)
g_warning ("SetDIBitsToDevice failed");
WIN32_API_FAILED ("SetDIBitsToDevice");
}
else
{
@ -736,26 +734,26 @@ gdk_image_put (GdkImage *image,
if ((memdc = CreateCompatibleDC (hdc)) == NULL)
{
g_warning ("gdk_image_put: CreateCompatibleDC failed");
gdk_gc_postdraw (drawable, gc_private);
WIN32_API_FAILED ("CreateCompatibleDC");
gdk_gc_postdraw (drawable, gc_private, 0);
return;
}
if ((oldbitmap = SelectObject (memdc, image_private->ximage)) == NULL)
{
g_warning ("gdk_image_put: SelectObject #1 failed");
gdk_gc_postdraw (drawable, gc_private);
WIN32_API_FAILED ("SelectObject #1");
gdk_gc_postdraw (drawable, gc_private, 0);
return;
}
if (!BitBlt (hdc, xdest, ydest, width, height,
memdc, xsrc, ysrc, SRCCOPY))
g_warning ("gdk_image_put: BitBlt failed");
WIN32_API_FAILED ("BitBlt");
if (SelectObject (memdc, oldbitmap) == NULL)
g_warning ("gdk_image_put_normal: SelectObject #2 failed");
WIN32_API_FAILED ("SelectObject #2");
if (!DeleteDC (memdc))
g_warning ("gdk_image_put: DeleteDC failed");
WIN32_API_FAILED ("DeleteDC");
}
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private, 0);
}

View File

@ -54,9 +54,6 @@ GdkArgDesc _gdk_windowing_args[] = {
{ NULL }
};
/* Private variable declarations
*/
int __stdcall
DllMain(HINSTANCE hinstDLL,
DWORD dwReason,
@ -103,6 +100,31 @@ _gdk_windowing_init_check (int argc,
return TRUE;
}
gchar *
gdk_win32_last_error_string (void)
{
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';
return error;
}
void
gdk_win32_api_failed (const gchar *where,
gint line,
const gchar *api)
{
g_warning ("%s:%d: %s failed: %s", where, line, api,
gdk_win32_last_error_string ());
}
void
gdk_set_use_xshm (gint use_xshm)
{

View File

@ -58,7 +58,7 @@ gdk_win32_pixmap_destroy (GdkPixmap *pixmap)
GDK_DRAWABLE_XID (pixmap)));
if (!DeleteObject (GDK_DRAWABLE_XID (pixmap)))
g_warning ("gdk_win32_pixmap_destroy: DeleteObject failed");
WIN32_API_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)
{
g_warning ("gdk_pixmap_new: GetDC failed");
WIN32_API_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)
{
g_warning ("gdk_pixmap_new: CreateDIBSection failed: %d", GetLastError ());
WIN32_API_FAILED ("CreateDIBSection");
ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
g_free (pixmap);
return NULL;
@ -334,6 +334,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
for (i = 0; i < height; i++)
for (j = 0; j < bpl; j++)
bits[i*aligned_bpl + j] = mirror[(guchar) data[i*bpl + j]];
GDK_DRAWABLE_WIN32DATA (pixmap)->xid =
CreateBitmap (width, height, 1, 1, bits);

View File

@ -153,8 +153,8 @@ struct _GdkGCWin32Data
*/
HDC xgc;
GdkGCValuesMask values_mask;
GdkColor foreground;
GdkColor background;
gulong foreground;
gulong background;
GdkFont *font;
gint rop2;
GdkFill fill_style;
@ -278,9 +278,11 @@ GdkGC * _gdk_win32_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
HDC gdk_gc_predraw (GdkDrawable *drawable,
GdkGCPrivate *gc_private);
GdkGCPrivate *gc_private,
GdkGCValuesMask usage);
void gdk_gc_postdraw (GdkDrawable *drawable,
GdkGCPrivate *gc_private);
GdkGCPrivate *gc_private,
GdkGCValuesMask usage);
HRGN BitmapToRegion (HBITMAP hBmp);
void gdk_sel_prop_store (GdkWindow *owner,
@ -307,8 +309,17 @@ void gdk_wchar_text_handle (GdkFont *font,
void *),
void *arg);
char *gdk_color_to_string (const GdkColor *);
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);
#ifdef __GNUC__
#define WIN32_API_FAILED(api) gdk_win32_api_failed (__PRETTY_FUNCTION__, __LINE__, api)
#else
#define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__, __LINE__, api)
#endif
extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
extern GdkDrawableClass _gdk_win32_drawable_class;

View File

@ -179,7 +179,7 @@ gdk_property_change (GdkWindow *window,
GDK_DRAWABLE_XID (window)));
if (!OpenClipboard (GDK_DRAWABLE_XID (window)))
{
g_warning ("gdk_property_change: OpenClipboard failed");
WIN32_API_FAILED ("OpenClipboard");
return;
}
#endif
@ -198,15 +198,11 @@ gdk_property_change (GdkWindow *window,
GDK_NOTE (MISC, g_print ("...SetClipboardData(CF_TEXT, %#x)\n",
hdata));
if (!SetClipboardData(CF_TEXT, hdata))
g_warning ("gdk_property_change: SetClipboardData failed: %d",
GetLastError ());
WIN32_API_FAILED ("SetClipboardData");
#if 1
GDK_NOTE (MISC, g_print ("...CloseClipboard()\n"));
if (!CloseClipboard ())
{
g_warning ("gdk_property_change: CloseClipboard failed");
return;
}
WIN32_API_FAILED ("CloseClipboard");
#endif
}
else

View File

@ -101,13 +101,13 @@ gdk_selection_owner_set (GdkWindow *owner,
GDK_NOTE (MISC, g_print ("...OpenClipboard(%#x)\n", xwindow));
if (!OpenClipboard (xwindow))
{
g_warning ("gdk_selection_owner_set: OpenClipboard failed");
WIN32_API_FAILED ("OpenClipboard");
return FALSE;
}
GDK_NOTE (MISC, g_print ("...EmptyClipboard()\n"));
if (!EmptyClipboard ())
{
g_warning ("gdk_selection_owner_set: EmptyClipboard failed");
WIN32_API_FAILED ("EmptyClipboard");
CloseClipboard ();
return FALSE;
}
@ -119,7 +119,7 @@ gdk_selection_owner_set (GdkWindow *owner,
GDK_NOTE (MISC, g_print ("...CloseClipboard()\n"));
if (!CloseClipboard ())
{
g_warning ("gdk_selection_owner_set: CloseClipboard failed");
WIN32_API_FAILED ("CloseClipboard");
return FALSE;
}
if (owner != NULL)
@ -198,7 +198,7 @@ gdk_selection_convert (GdkWindow *requestor,
GDK_DRAWABLE_XID (requestor)));
if (!OpenClipboard (GDK_DRAWABLE_XID (requestor)))
{
g_warning ("gdk_selection_convert: OpenClipboard failed");
WIN32_API_FAILED ("OpenClipboard");
return;
}

View File

@ -51,7 +51,10 @@ SafeAdjustWindowRectEx (RECT* lpRect,
DWORD dwExStyle)
{
if (!AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle))
return FALSE;
{
WIN32_API_FAILED ("AdjustWindowRectEx");
return FALSE;
}
if (lpRect->left < 0)
{
lpRect->right -= lpRect->left;
@ -253,6 +256,11 @@ RegisterGdkClass (GdkDrawableType wtype)
break;
}
if (klass == 0)
{
WIN32_API_FAILED ("RegisterClassEx");
g_error ("That is a fatal error");
}
return klass;
}
@ -382,8 +390,6 @@ gdk_window_new (GdkWindow *parent,
}
klass = RegisterGdkClass (private->drawable.window_type);
if (!klass)
g_error ("RegisterClassEx failed");
if (private->drawable.window_type != GDK_WINDOW_CHILD)
{
@ -401,8 +407,7 @@ gdk_window_new (GdkWindow *parent,
rect.right = rect.left + private->drawable.width;
rect.bottom = rect.top + private->drawable.height;
if (!SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
g_warning ("gdk_window_new: AdjustWindowRectEx failed");
SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
if (x != CW_USEDEFAULT)
{
@ -439,7 +444,7 @@ gdk_window_new (GdkWindow *parent,
NULL);
GDK_NOTE (MISC,
g_print ("gdk_window_create: %s %s %dx%d@+%d+%d %#x = %#x\n"
g_print ("gdk_window_new: %s %s %dx%d@+%d+%d %#x = %#x\n"
"...locale %#x codepage %d\n",
(private->drawable.window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
(private->drawable.window_type == GDK_WINDOW_CHILD ? "CHILD" :
@ -458,7 +463,7 @@ gdk_window_new (GdkWindow *parent,
if (GDK_DRAWABLE_XID (window) == NULL)
{
g_warning ("gdk_window_create: CreateWindowEx failed");
WIN32_API_FAILED ("CreateWindowEx");
g_free (GDK_DRAWABLE_WIN32DATA (window));
g_free (private);
return NULL;
@ -782,8 +787,7 @@ gdk_window_move (GdkWindow *window,
dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
if (!SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
g_warning ("gdk_window_move: AdjustWindowRectEx failed");
SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
x = rect.left;
y = rect.top;
@ -800,7 +804,7 @@ gdk_window_move (GdkWindow *window,
if (!MoveWindow (GDK_DRAWABLE_XID (window),
x, y, rect.right - rect.left, rect.bottom - rect.top,
TRUE))
g_warning ("gdk_window_move: MoveWindow failed");
WIN32_API_FAILED ("MoveWindow");
}
}
@ -848,7 +852,7 @@ gdk_window_resize (GdkWindow *window,
dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
g_warning ("gdk_window_resize: AdjustWindowRectEx failed");
WIN32_API_FAILED ("AdjustWindowRectEx");
x = rect.left;
y = rect.top;
@ -871,7 +875,7 @@ gdk_window_resize (GdkWindow *window,
if (!MoveWindow (GDK_DRAWABLE_XID (window),
x, y, width, height,
TRUE))
g_warning ("gdk_window_resize: MoveWindow failed");
WIN32_API_FAILED ("MoveWindow");
}
}
@ -909,7 +913,7 @@ gdk_window_move_resize (GdkWindow *window,
dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
g_warning ("gdk_window_move_resize: AdjustWindowRectEx failed");
WIN32_API_FAILED ("AdjustWindowRectEx");
if (private->drawable.window_type == GDK_WINDOW_CHILD)
{
@ -926,7 +930,7 @@ gdk_window_move_resize (GdkWindow *window,
rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
TRUE))
g_warning ("gdk_window_move_resize: MoveWindow failed");
WIN32_API_FAILED ("MoveWindow");
if (private->guffaw_gravity)
{
@ -972,14 +976,14 @@ gdk_window_reparent (GdkWindow *window,
GDK_DRAWABLE_XID (new_parent)));
if (!SetParent (GDK_DRAWABLE_XID (window),
GDK_DRAWABLE_XID (new_parent)))
g_warning ("gdk_window_reparent: SetParent failed");
WIN32_API_FAILED ("SetParent");
if (!MoveWindow (GDK_DRAWABLE_XID (window),
x, y,
window_private->drawable.width,
window_private->drawable.height,
TRUE))
g_warning ("gdk_window_reparent: MoveWindow failed");
WIN32_API_FAILED ("MoveWindow");
}
window_private->parent = new_parent;
@ -1056,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))
g_warning ("gdk_window_clear_area_e: InvalidateRect failed");
WIN32_API_FAILED ("InvalidateRect");
UpdateWindow (GDK_DRAWABLE_XID (window));
}
}
@ -1073,7 +1077,7 @@ gdk_window_raise (GdkWindow *window)
GDK_DRAWABLE_XID (window)));
if (!BringWindowToTop (GDK_DRAWABLE_XID (window)))
g_warning ("gdk_window_raise: BringWindowToTop failed");
WIN32_API_FAILED ("BringWindowToTop");
}
}
@ -1090,7 +1094,7 @@ gdk_window_lower (GdkWindow *window)
if (!SetWindowPos (GDK_DRAWABLE_XID (window), HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
g_warning ("gdk_window_lower: SetWindowPos failed");
WIN32_API_FAILED ("SetWindowPos");
}
}
@ -1128,7 +1132,7 @@ gdk_window_set_hints (GdkWindow *window,
{
if (flags & GDK_HINT_POS)
if (!GetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
g_warning ("gdk_window_set_hints: GetWindowPlacement failed");
WIN32_API_FAILED ("GetWindowPlacement");
else
{
GDK_NOTE (MISC, g_print ("...rcNormalPosition:"
@ -1165,7 +1169,7 @@ gdk_window_set_hints (GdkWindow *window,
size_hints.rcNormalPosition.right,
size_hints.rcNormalPosition.bottom));
if (!SetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
g_warning ("gdk_window_set_hints: SetWindowPlacement failed");
WIN32_API_FAILED ("SetWindowPlacement");
GDK_WINDOW_WIN32DATA (window)->hint_x = rect.left;
GDK_WINDOW_WIN32DATA (window)->hint_y = rect.top;
}
@ -1294,7 +1298,7 @@ gdk_window_set_geometry_hints (GdkWindow *window,
&& geometry->base_width > 0
&& geometry->base_height > 0)
if (!GetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
g_warning ("gdk_window_set_hints: GetWindowPlacement failed");
WIN32_API_FAILED ("GetWindowPlacement");
else
{
GDK_NOTE (MISC, g_print ("gdk_window_set_geometry_hints:"
@ -1313,7 +1317,7 @@ gdk_window_set_geometry_hints (GdkWindow *window,
size_hints.rcNormalPosition.right,
size_hints.rcNormalPosition.bottom));
if (!SetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
g_warning ("gdk_window_set_hints: SetWindowPlacement failed");
WIN32_API_FAILED ("SetWindowPlacement");
}
if (geom_mask & GDK_HINT_RESIZE_INC)
@ -1355,7 +1359,7 @@ gdk_window_set_title (GdkWindow *window,
mbstr, 3*titlelen, NULL, NULL);
if (!SetWindowText (GDK_DRAWABLE_XID (window), mbstr))
g_warning ("gdk_window_set_title: SetWindowText failed");
WIN32_API_FAILED ("SetWindowText");
g_free (mbstr);
g_free (wcstr);
@ -1497,7 +1501,7 @@ gdk_window_get_geometry (GdkWindow *window,
RECT rect;
if (!GetClientRect (GDK_DRAWABLE_XID (window), &rect))
g_warning ("gdk_window_get_geometry: GetClientRect failed");
WIN32_API_FAILED ("GetClientRect");
if (x)
*x = rect.left;
@ -1824,7 +1828,10 @@ gdk_window_set_icon (GdkWindow *window,
if (GDK_DRAWABLE_DESTROYED (window))
return;
g_warning ("gdk_window_set_icon not implemented");
/* Nothing to do, really. As we share window classes between windows
* we can't have window-specific icons, sorry. Don't print any warning
* either.
*/
}
void
@ -1838,7 +1845,7 @@ gdk_window_set_icon_name (GdkWindow *window,
return;
if (!SetWindowText (GDK_DRAWABLE_XID (window), name))
g_warning ("gdk_window_set_icon_name: SetWindowText failed");
WIN32_API_FAILED ("SetWindowText");
}
void

View File

@ -13,9 +13,6 @@ OPTIMIZE = -g -O
CC = gcc -mno-cygwin -mpentium -fnative-struct
CP = cp
LD = ld
GLIB_VER=1.3
GTK_VER=1.3
@ -52,13 +49,23 @@ gdk_win32_OBJECTS = \
gdkwindow-win32.o
../../config.h : ../../config.h.win32
$(CP) ../../config.h.win32 ../../config.h
cp ../../config.h.win32 ../../config.h
../gdkconfig.h : ../gdkconfig.h.win32
$(CP) ../gdkconfig.h.win32 ../gdkconfig.h
cp ../gdkconfig.h.win32 ../gdkconfig.h
gdk-win32res.o : rc/gdk.rc
windres --include-dir rc rc/gdk.rc gdk-win32res.o
# Kludge to get the path to the win32 headers
WIN32APIHEADERS = $(shell echo "\#include <winver.h>" | $(CC) -M -E - | tail -1 | sed -e 's!/winver.h!!')
gdk-win32res.o : rc/gdk.rc gdk-build.tmp
m4 -DBUILDNUMBER=`cat gdk-build.tmp` <rc/gdk.rc >gdk-win32res.rc
windres --include-dir rc --include-dir $(WIN32APIHEADERS) gdk-win32res.rc gdk-win32res.o
rm gdk-build.tmp gdk-win32res.rc
# Magic to bump the build number
gdk-build.tmp :
bash -c "read number && echo $$[number+1]" <gdk-build.stamp >gdk-build.tmp
cp gdk-build.tmp gdk-build.stamp
libgdk-win32.a : $(gdk_win32_OBJECTS)
-rm -f $@

View File

@ -1,3 +1,5 @@
#include <winver.h>
GTK_ICON ICON "gtk.ico"
X_cursor CURSOR DISCARDABLE "cursor00.cur"
arrow CURSOR DISCARDABLE "cursor02.cur"
@ -76,3 +78,32 @@ umbrella CURSOR DISCARDABLE "cursor92.cur"
ur_angle CURSOR DISCARDABLE "cursor94.cur"
xterm CURSOR DISCARDABLE "cursor98.cur"
watch CURSOR DISCARDABLE "cursor96.cur"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,BUILDNUMBER
PRODUCTVERSION 1,3,0,0
FILEFLAGSMASK 0
FILEFLAGS 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "The GTk+ developer community"
VALUE "FileDescription", "GIMP Drawing Kit"
VALUE "FileVersion", "1.3.0.BUILDNUMBER"
VALUE "InternalName", "gdk-1.3"
VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2000."
VALUE "OriginalFilename", "gdk-1.3.dll"
VALUE "ProductName", "GTk+"
VALUE "ProductVersion", "1.3.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

30
gtk/gtk.rc Normal file
View File

@ -0,0 +1,30 @@
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,BUILDNUMBER
PRODUCTVERSION 1,3,0,0
FILEFLAGSMASK 0
FILEFLAGS 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "The GTk+ developer community"
VALUE "FileDescription", "GIMP Toolkit"
VALUE "FileVersion", "1.3.0.BUILDNUMBER"
VALUE "InternalName", "gtk-1.3"
VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2000."
VALUE "OriginalFilename", "gtk-1.3.dll"
VALUE "ProductName", "GTk+"
VALUE "ProductVersion", "1.3.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@ -327,11 +327,24 @@ gtkmarshal.h gtkmarshal.c : gtkmarshal.list genmarshal.pl
#
# Linking:
#
gtk-$(GTK_VER).dll : generated $(gtk_OBJECTS) gtk.def
$(GLIB)/build-dll gtk $(GTK_VER) gtk.def $(gtk_OBJECTS) -L ../gdk -lgdk-$(GTK_VER) -L$(INTL) -lgnu-intl -L $(GLIB) -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lgdi32 -luser32
gtk-$(GTK_VER).dll : generated $(gtk_OBJECTS) gtk.def gtk-win32res.o
$(GLIB)/build-dll gtk $(GTK_VER) gtk.def $(gtk_OBJECTS) gtk-win32res.o -L ../gdk -lgdk-$(GTK_VER) -L$(INTL) -lgnu-intl -L $(GLIB) -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lgdi32 -luser32
.SUFFIXES: .c .o .i
# Kludge to get the path to the win32 headers
WIN32APIHEADERS = $(shell echo "\#include <winver.h>" | $(CC) -M -E - | tail -1 | sed -e 's!/winver.h!!')
gtk-win32res.o : gtk.rc gtk-build.tmp
m4 -DBUILDNUMBER=`cat gtk-build.tmp` <gtk.rc >gtk-win32res.rc
windres --include-dir $(WIN32APIHEADERS) gtk-win32res.rc gtk-win32res.o
rm gtk-build.tmp gtk-win32res.rc
# Magic to bump the build number
gtk-build.tmp :
bash -c "read number && echo $$[number+1]" <gtk-build.stamp >gtk-build.tmp
cp gtk-build.tmp gtk-build.stamp
# General rule for compiling the objects into the DLL
.c.o :
$(CC) $(CFLAGS) -c -DGTK_COMPILATION -DG_LOG_DOMAIN=\"Gtk\" $<