diff --git a/ChangeLog b/ChangeLog index 32a951b98b..7286577da0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2005-04-03 Hans Breuer + + [merged from gtk-2-6 branch] + * gdk/win32/gdkdrawable-win32.c : let dash_offset shift the start of + the line pattern not the start of the line. Fixes bug #171641. + + * gtk/makefile.msc.in : follow .symbols changes + + * gdk/win32/gdkwindow-win32.c : declare and resolve GetAncestor() + dynamically. (It is not available in _WIN_VER <= 0x0400) + + * gdk/win32/makefile.msc : removed gdkpango-win32.obj + + * gtk/gtkhsv.c gtk/gtkstyle.c : use G_PI instead of M_PI + + [also applied to gtk-2-6 branch] + * gdk/makefile.msc gdk-pixbuf/makefile.msc : handle gdk*alias.def + + * gdk/makefile.msc.in : add gtkmnemonichash.obj + + * test/testgtk.c(set_parent_signal) : use g_message instead of + g_print to keep the 'testgtk --bench=all' output clean + 2005-04-03 Matthias Clasen * gtk/gtkruler.c: Add a "metric" property. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 32a951b98b..7286577da0 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,26 @@ +2005-04-03 Hans Breuer + + [merged from gtk-2-6 branch] + * gdk/win32/gdkdrawable-win32.c : let dash_offset shift the start of + the line pattern not the start of the line. Fixes bug #171641. + + * gtk/makefile.msc.in : follow .symbols changes + + * gdk/win32/gdkwindow-win32.c : declare and resolve GetAncestor() + dynamically. (It is not available in _WIN_VER <= 0x0400) + + * gdk/win32/makefile.msc : removed gdkpango-win32.obj + + * gtk/gtkhsv.c gtk/gtkstyle.c : use G_PI instead of M_PI + + [also applied to gtk-2-6 branch] + * gdk/makefile.msc gdk-pixbuf/makefile.msc : handle gdk*alias.def + + * gdk/makefile.msc.in : add gtkmnemonichash.obj + + * test/testgtk.c(set_parent_signal) : use g_message instead of + g_print to keep the 'testgtk --bench=all' output clean + 2005-04-03 Matthias Clasen * gtk/gtkruler.c: Add a "metric" property. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 32a951b98b..7286577da0 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,26 @@ +2005-04-03 Hans Breuer + + [merged from gtk-2-6 branch] + * gdk/win32/gdkdrawable-win32.c : let dash_offset shift the start of + the line pattern not the start of the line. Fixes bug #171641. + + * gtk/makefile.msc.in : follow .symbols changes + + * gdk/win32/gdkwindow-win32.c : declare and resolve GetAncestor() + dynamically. (It is not available in _WIN_VER <= 0x0400) + + * gdk/win32/makefile.msc : removed gdkpango-win32.obj + + * gtk/gtkhsv.c gtk/gtkstyle.c : use G_PI instead of M_PI + + [also applied to gtk-2-6 branch] + * gdk/makefile.msc gdk-pixbuf/makefile.msc : handle gdk*alias.def + + * gdk/makefile.msc.in : add gtkmnemonichash.obj + + * test/testgtk.c(set_parent_signal) : use g_message instead of + g_print to keep the 'testgtk --bench=all' output clean + 2005-04-03 Matthias Clasen * gtk/gtkruler.c: Add a "metric" property. diff --git a/gdk-pixbuf/makefile.msc b/gdk-pixbuf/makefile.msc index cf13aaeb1c..583b95ea6a 100644 --- a/gdk-pixbuf/makefile.msc +++ b/gdk-pixbuf/makefile.msc @@ -72,10 +72,14 @@ gdk-pixbuf-marshal.c: gdk-pixbuf-marshal.h gdk-pixbuf-marshal.list gdk-pixbuf-alias.h: gdk-pixbuf.symbols perl makegdkpixbufalias.pl < gdk-pixbuf.symbols > gdk-pixbuf-alias.h -gdk_pixbuf.def: gdk-pixbuf.symbols +gdk_pixbuf.def: gdk-pixbuf.symbols makefile.msc echo EXPORTS > gdk_pixbuf.def - cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 gdk-pixbuf.symbols >> gdk_pixbuf.def + cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES \ +# -FI $(GLIB)\glib\gmacros.h \ + gdk-pixbuf.symbols >> gdk_pixbuf.def +gdk-pixbuf-aliasdef.c: gdk-pixbuf.symbols + perl makegdkpixbufalias.pl -def < gdk-pixbuf.symbols > gdk-pixbuf-aliasdef.c ## common stuff @@ -92,6 +96,7 @@ sub-pixops : all : \ $(PRJ_TOP)\config.h \ gdk-pixbuf-alias.h \ + gdk-pixbuf-aliasdef.c \ gdk-pixbuf-marshal.h \ gdk-pixbuf-marshal.c \ sub-pixops \ diff --git a/gdk/makefile.msc b/gdk/makefile.msc index e376c515ad..ab34dded67 100644 --- a/gdk/makefile.msc +++ b/gdk/makefile.msc @@ -48,7 +48,8 @@ CFLAGS = -FImsvc_recommended_pragmas.h -I . -I .. \ EXTRALIBS = $(WTKIT)\lib\i386\wntab32x.lib $(GLIB_LIBS) \ ..\gdk-pixbuf\gdk_pixbuf-$(GDK_PIXBUF_VER).lib \ - $(PANGOWIN32_LIBS) $(INTL_LIBS) $(CAIRO_LIBS) + $(PANGOWIN32_LIBS) $(INTL_LIBS) $(CAIRO_LIBS) \ + $(PANGOCAIRO_LIBS) gdk-win32-backend : cd win32 @@ -59,6 +60,7 @@ all: \ ..\config.h \ gdkconfig.h \ gdkalias.h \ + gdkaliasdef.c \ gdkenumtypes.h \ gdkenumtypes.c \ gdkmarshalers.h \ @@ -146,9 +148,12 @@ gdkconfig.h : gdkconfig.h.win32 gdkalias.h: gdk.symbols perl makegdkalias.pl < gdk.symbols > gdkalias.h +gdkaliasdef.c: gdk.symbols + perl makegdkalias.pl -def < gdk.symbols > gdkaliasdef.c + gdk.def: gdk.symbols echo EXPORTS > gdk.def - cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DGDK_WINDOWING_WIN32 gdk.symbols >> gdk.def + cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DGDK_WINDOWING_WIN32 -DALL_FILES gdk.symbols >> gdk.def libgdk-win32-$(GTK_VER)-0.dll : $(gdk_OBJECTS) gdk.def win32\gdk-win32.lib $(CC) $(CFLAGS) -LD -Fe$@ $(gdk_OBJECTS) win32\gdk-win32.lib $(EXTRALIBS) \ diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index 44488e19e3..eca6de6a73 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -1,5 +1,5 @@ /* GDK - The GIMP Drawing Kit - * Copyright (C) 2002 Hans Breuer + * Copyright (C) 2002,2005 Hans Breuer * Copyright (C) 2003 Tor Lillqvist * * This library is free software; you can redistribute it and/or @@ -20,7 +20,6 @@ #include #include "gdk.h" -#define _WIN32_WINNT 0x0500 /* To get ProcessIdToSessionId */ #include "gdkprivate-win32.h" #define HAVE_MONITOR_INFO @@ -176,6 +175,33 @@ _gdk_monitor_init (void) } +/* + * Dynamic version of ProcessIdToSessionId() form Terminal Service. + * It is only returning something else than 0 when running under + * Terminal Service, available since NT4 SP4 and not for win9x + */ +static guint +get_session_id (void) +{ + typedef BOOL (WINAPI *t_ProcessIdToSessionId) (DWORD, DWORD*); + static t_ProcessIdToSessionId p_ProcessIdToSessionId = NULL; + static HMODULE kernel32 = NULL; + DWORD id = 0; + + if (kernel32 == NULL) + { + kernel32 = GetModuleHandle ("kernel32.dll"); + + g_assert (kernel32 != NULL); + + p_ProcessIdToSessionId = (t_ProcessIdToSessionId) GetProcAddress (kernel32, "ProcessIdToSessionId"); + } + if (p_ProcessIdToSessionId) + p_ProcessIdToSessionId (GetCurrentProcessId (), &id); /* got it (or not ;) */ + + return id; +} + GdkDisplay * gdk_display_open (const gchar *display_name) { @@ -259,10 +285,8 @@ gdk_display_get_name (GdkDisplay *display) window_station_name = "WinSta0"; } - ProcessIdToSessionId (GetCurrentProcessId (), &session_id); - display_name = g_strdup_printf ("%ld\\%s\\%s", - session_id, window_station_name, + get_session_id (), window_station_name, desktop_name); retval = g_quark_to_string (g_quark_from_string (display_name)); diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 41e1d07200..cf4412ccd6 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -1,7 +1,7 @@ /* GDK - The GIMP Drawing Kit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * Copyright (C) 1998-2004 Tor Lillqvist - * Copyright (C) 2001-2004 Hans Breuer + * Copyright (C) 2001-2005 Hans Breuer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -232,6 +232,28 @@ gdk_win32_set_colormap (GdkDrawable *drawable, static DWORD default_double_dashes[] = { 3, 3 }; +static inline int +align_with_dash_offset (int a, DWORD *dashes, int num_dashes, GdkGCWin32 *gcwin32) +{ + int n = 0; + int len_sum = 0; + /* + * We can't simply add the dashoffset, it can be an arbitrary larger + * or smaller value not even between x1 and x2. It just says use the + * dash pattern aligned to the offset. So ensure x1 is smaller _x1 + * and we start with the appropriate dash. + */ + for (n = 0; n < num_dashes; n++) + len_sum += dashes[n]; + if ( len_sum > 0 /* pathological api usage? */ + && gcwin32->pen_dash_offset > a) + a -= (((gcwin32->pen_dash_offset/len_sum - a/len_sum) + 1) * len_sum); + else + a = gcwin32->pen_dash_offset; + + return a; +} + /* Render a dashed line 'by hand'. Used for all dashes on Win9x (where * GDI is way too limited), and for double dashes on all Windowses. */ @@ -241,7 +263,7 @@ render_line_horizontal (GdkGCWin32 *gcwin32, int x2, int y) { - int n; + int n = 0; HDC hdc = gcwin32->hdc; int pen_width = gcwin32->pen_width; DWORD *dashes; @@ -252,7 +274,7 @@ render_line_horizontal (GdkGCWin32 *gcwin32, { dashes = gcwin32->pen_dashes; num_dashes = gcwin32->pen_num_dashes; - x1 += gcwin32->pen_dash_offset; + x1 = align_with_dash_offset (x1, dashes, num_dashes, gcwin32); } else { @@ -266,8 +288,10 @@ render_line_horizontal (GdkGCWin32 *gcwin32, if (x1 + len > x2) len = x2 - x1; - if (n % 2 == 0) - if (!GDI_CALL (PatBlt, (hdc, x1, y - pen_width / 2, + if (n % 2 == 0 && x1 + len > _x1) + if (!GDI_CALL (PatBlt, (hdc, + x1 < _x1 ? _x1 : x1, + y - pen_width / 2, len, pen_width, PATCOPY))) return FALSE; @@ -322,7 +346,7 @@ render_line_vertical (GdkGCWin32 *gcwin32, { dashes = gcwin32->pen_dashes; num_dashes = gcwin32->pen_num_dashes; - y1 += gcwin32->pen_dash_offset; + y1 = align_with_dash_offset (y1, dashes, num_dashes, gcwin32); } else { @@ -335,8 +359,9 @@ render_line_vertical (GdkGCWin32 *gcwin32, int len = dashes[n % num_dashes]; if (y1 + len > y2) len = y2 - y1; - if (n % 2 == 0) - if (!GDI_CALL (PatBlt, (hdc, x - pen_width / 2, y1, + if (n % 2 == 0 && y1 + len > _y1) + if (!GDI_CALL (PatBlt, (hdc, x - pen_width / 2, + y1 < _y1 ? _y1 : y1, pen_width, len, PATCOPY))) return FALSE; diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 1e1f4936cb..53b4d63a05 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -65,6 +65,32 @@ typedef struct { DWORD bV5Reserved; } BITMAPV5HEADER; +#define GetAncestor(hwnd,what) _gdk_win32_get_ancestor_parent(hwnd) + +static HWND +_gdk_win32_get_ancestor_parent (HWND hwnd) +{ +#ifndef GA_PARENT +# define GA_PARENT 1 +#endif + typedef HWND (WINAPI *PFN_GetAncestor) (HWND,UINT); + static PFN_GetAncestor p_GetAncestor = NULL; + static gboolean once = FALSE; + + if (!once) + { + HMODULE user32; + + user32 = GetModuleHandle ("user32.dll"); + p_GetAncestor = (PFN_GetAncestor)GetProcAddress (user32, "GetAncestor"); + once = TRUE; + } + if (p_GetAncestor) + return p_GetAncestor (hwnd, GA_PARENT); + else /* not completely right, but better than nothing ? */ + return GetParent (hwnd); +} + #endif #if 0 diff --git a/gdk/win32/makefile.msc b/gdk/win32/makefile.msc index 9274ad4cd1..ce79923ef5 100644 --- a/gdk/win32/makefile.msc +++ b/gdk/win32/makefile.msc @@ -41,7 +41,6 @@ gdk_win32_OBJECTS = \ gdkinput-win32.obj \ gdkkeys-win32.obj \ gdkmain-win32.obj \ - gdkpango-win32.obj \ gdkpixmap-win32.obj \ gdkproperty-win32.obj \ # gdkregion-win32.obj \ diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c index 61353a92d0..991e3a1099 100644 --- a/gtk/gtkhsv.c +++ b/gtk/gtkhsv.c @@ -1051,7 +1051,7 @@ paint_ring (GtkHSV *hsv, cairo_arc (cr, center, center, priv->size / 2. - priv->ring_width / 2., - 0, 2 * M_PI); + 0, 2 * G_PI); cairo_stroke (cr); cairo_restore (cr); @@ -1257,7 +1257,7 @@ paint_triangle (GtkHSV *hsv, #define FOCUS_RADIUS 6 cairo_new_path (cr); - cairo_arc (cr, xx, yy, RADIUS, 0, 2 * M_PI); + cairo_arc (cr, xx, yy, RADIUS, 0, 2 * G_PI); cairo_stroke (cr); /* Draw focus outline */ diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index ad4093ba9a..cca2b27b9c 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -3782,7 +3782,7 @@ gtk_default_draw_option (GtkStyle *style, x + exterior_size / 2., y + exterior_size / 2., (exterior_size - 1) / 2., - 0, 2 * M_PI); + 0, 2 * G_PI); cairo_save (cr); cairo_fill (cr); @@ -3828,7 +3828,7 @@ gtk_default_draw_option (GtkStyle *style, x + pad + interior_size / 2., y + pad + interior_size / 2., interior_size / 2., - 0, 2 * M_PI); + 0, 2 * G_PI); cairo_fill (cr); } else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ diff --git a/tests/testgtk.c b/tests/testgtk.c index 3a1f6791a6..22919bd23c 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2922,11 +2922,11 @@ set_parent_signal (GtkWidget *child, GtkWidget *old_parent, gpointer func_data) { - g_print ("set_parent for \"%s\": new parent: \"%s\", old parent: \"%s\", data: %d\n", - g_type_name (G_OBJECT_TYPE (child)), - child->parent ? g_type_name (G_OBJECT_TYPE (child->parent)) : "NULL", - old_parent ? g_type_name (G_OBJECT_TYPE (old_parent)) : "NULL", - GPOINTER_TO_INT (func_data)); + g_message ("set_parent for \"%s\": new parent: \"%s\", old parent: \"%s\", data: %d\n", + g_type_name (G_OBJECT_TYPE (child)), + child->parent ? g_type_name (G_OBJECT_TYPE (child->parent)) : "NULL", + old_parent ? g_type_name (G_OBJECT_TYPE (old_parent)) : "NULL", + GPOINTER_TO_INT (func_data)); } static void