Commit 0ba6aed7 authored by Hans Breuer's avatar Hans Breuer Committed by Hans Breuer

[merged from gtk-2-6 branch] let dash_offset shift the start of the line

2005-04-03  Hans Breuer  <hans@breuer.org>

	[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
parent 4a6d631c
2005-04-03 Hans Breuer <hans@breuer.org>
[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 <mclasen@redhat.com> 2005-04-03 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkruler.c: Add a "metric" property. * gtk/gtkruler.c: Add a "metric" property.
......
2005-04-03 Hans Breuer <hans@breuer.org>
[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 <mclasen@redhat.com> 2005-04-03 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkruler.c: Add a "metric" property. * gtk/gtkruler.c: Add a "metric" property.
......
2005-04-03 Hans Breuer <hans@breuer.org>
[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 <mclasen@redhat.com> 2005-04-03 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkruler.c: Add a "metric" property. * gtk/gtkruler.c: Add a "metric" property.
......
...@@ -72,10 +72,14 @@ gdk-pixbuf-marshal.c: gdk-pixbuf-marshal.h gdk-pixbuf-marshal.list ...@@ -72,10 +72,14 @@ gdk-pixbuf-marshal.c: gdk-pixbuf-marshal.h gdk-pixbuf-marshal.list
gdk-pixbuf-alias.h: gdk-pixbuf.symbols gdk-pixbuf-alias.h: gdk-pixbuf.symbols
perl makegdkpixbufalias.pl < gdk-pixbuf.symbols > gdk-pixbuf-alias.h 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 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 ## common stuff
...@@ -92,6 +96,7 @@ sub-pixops : ...@@ -92,6 +96,7 @@ sub-pixops :
all : \ all : \
$(PRJ_TOP)\config.h \ $(PRJ_TOP)\config.h \
gdk-pixbuf-alias.h \ gdk-pixbuf-alias.h \
gdk-pixbuf-aliasdef.c \
gdk-pixbuf-marshal.h \ gdk-pixbuf-marshal.h \
gdk-pixbuf-marshal.c \ gdk-pixbuf-marshal.c \
sub-pixops \ sub-pixops \
......
...@@ -48,7 +48,8 @@ CFLAGS = -FImsvc_recommended_pragmas.h -I . -I .. \ ...@@ -48,7 +48,8 @@ CFLAGS = -FImsvc_recommended_pragmas.h -I . -I .. \
EXTRALIBS = $(WTKIT)\lib\i386\wntab32x.lib $(GLIB_LIBS) \ EXTRALIBS = $(WTKIT)\lib\i386\wntab32x.lib $(GLIB_LIBS) \
..\gdk-pixbuf\gdk_pixbuf-$(GDK_PIXBUF_VER).lib \ ..\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 : gdk-win32-backend :
cd win32 cd win32
...@@ -59,6 +60,7 @@ all: \ ...@@ -59,6 +60,7 @@ all: \
..\config.h \ ..\config.h \
gdkconfig.h \ gdkconfig.h \
gdkalias.h \ gdkalias.h \
gdkaliasdef.c \
gdkenumtypes.h \ gdkenumtypes.h \
gdkenumtypes.c \ gdkenumtypes.c \
gdkmarshalers.h \ gdkmarshalers.h \
...@@ -146,9 +148,12 @@ gdkconfig.h : gdkconfig.h.win32 ...@@ -146,9 +148,12 @@ gdkconfig.h : gdkconfig.h.win32
gdkalias.h: gdk.symbols gdkalias.h: gdk.symbols
perl makegdkalias.pl < gdk.symbols > gdkalias.h perl makegdkalias.pl < gdk.symbols > gdkalias.h
gdkaliasdef.c: gdk.symbols
perl makegdkalias.pl -def < gdk.symbols > gdkaliasdef.c
gdk.def: gdk.symbols gdk.def: gdk.symbols
echo EXPORTS > gdk.def 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 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) \ $(CC) $(CFLAGS) -LD -Fe$@ $(gdk_OBJECTS) win32\gdk-win32.lib $(EXTRALIBS) \
......
/* GDK - The GIMP Drawing Kit /* GDK - The GIMP Drawing Kit
* Copyright (C) 2002 Hans Breuer * Copyright (C) 2002,2005 Hans Breuer
* Copyright (C) 2003 Tor Lillqvist * Copyright (C) 2003 Tor Lillqvist
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <config.h> #include <config.h>
#include "gdk.h" #include "gdk.h"
#define _WIN32_WINNT 0x0500 /* To get ProcessIdToSessionId */
#include "gdkprivate-win32.h" #include "gdkprivate-win32.h"
#define HAVE_MONITOR_INFO #define HAVE_MONITOR_INFO
...@@ -176,6 +175,33 @@ _gdk_monitor_init (void) ...@@ -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 * GdkDisplay *
gdk_display_open (const gchar *display_name) gdk_display_open (const gchar *display_name)
{ {
...@@ -259,10 +285,8 @@ gdk_display_get_name (GdkDisplay *display) ...@@ -259,10 +285,8 @@ gdk_display_get_name (GdkDisplay *display)
window_station_name = "WinSta0"; window_station_name = "WinSta0";
} }
ProcessIdToSessionId (GetCurrentProcessId (), &session_id);
display_name = g_strdup_printf ("%ld\\%s\\%s", display_name = g_strdup_printf ("%ld\\%s\\%s",
session_id, window_station_name, get_session_id (), window_station_name,
desktop_name); desktop_name);
retval = g_quark_to_string (g_quark_from_string (display_name)); retval = g_quark_to_string (g_quark_from_string (display_name));
......
/* GDK - The GIMP Drawing Kit /* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
* Copyright (C) 1998-2004 Tor Lillqvist * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -232,6 +232,28 @@ gdk_win32_set_colormap (GdkDrawable *drawable, ...@@ -232,6 +232,28 @@ gdk_win32_set_colormap (GdkDrawable *drawable,
static DWORD default_double_dashes[] = { 3, 3 }; 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 /* 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. * GDI is way too limited), and for double dashes on all Windowses.
*/ */
...@@ -241,7 +263,7 @@ render_line_horizontal (GdkGCWin32 *gcwin32, ...@@ -241,7 +263,7 @@ render_line_horizontal (GdkGCWin32 *gcwin32,
int x2, int x2,
int y) int y)
{ {
int n; int n = 0;
HDC hdc = gcwin32->hdc; HDC hdc = gcwin32->hdc;
int pen_width = gcwin32->pen_width; int pen_width = gcwin32->pen_width;
DWORD *dashes; DWORD *dashes;
...@@ -252,7 +274,7 @@ render_line_horizontal (GdkGCWin32 *gcwin32, ...@@ -252,7 +274,7 @@ render_line_horizontal (GdkGCWin32 *gcwin32,
{ {
dashes = gcwin32->pen_dashes; dashes = gcwin32->pen_dashes;
num_dashes = gcwin32->pen_num_dashes; num_dashes = gcwin32->pen_num_dashes;
x1 += gcwin32->pen_dash_offset; x1 = align_with_dash_offset (x1, dashes, num_dashes, gcwin32);
} }
else else
{ {
...@@ -266,8 +288,10 @@ render_line_horizontal (GdkGCWin32 *gcwin32, ...@@ -266,8 +288,10 @@ render_line_horizontal (GdkGCWin32 *gcwin32,
if (x1 + len > x2) if (x1 + len > x2)
len = x2 - x1; len = x2 - x1;
if (n % 2 == 0) if (n % 2 == 0 && x1 + len > _x1)
if (!GDI_CALL (PatBlt, (hdc, x1, y - pen_width / 2, if (!GDI_CALL (PatBlt, (hdc,
x1 < _x1 ? _x1 : x1,
y - pen_width / 2,
len, pen_width, len, pen_width,
PATCOPY))) PATCOPY)))
return FALSE; return FALSE;
...@@ -322,7 +346,7 @@ render_line_vertical (GdkGCWin32 *gcwin32, ...@@ -322,7 +346,7 @@ render_line_vertical (GdkGCWin32 *gcwin32,
{ {
dashes = gcwin32->pen_dashes; dashes = gcwin32->pen_dashes;
num_dashes = gcwin32->pen_num_dashes; num_dashes = gcwin32->pen_num_dashes;
y1 += gcwin32->pen_dash_offset; y1 = align_with_dash_offset (y1, dashes, num_dashes, gcwin32);
} }
else else
{ {
...@@ -335,8 +359,9 @@ render_line_vertical (GdkGCWin32 *gcwin32, ...@@ -335,8 +359,9 @@ render_line_vertical (GdkGCWin32 *gcwin32,
int len = dashes[n % num_dashes]; int len = dashes[n % num_dashes];
if (y1 + len > y2) if (y1 + len > y2)
len = y2 - y1; len = y2 - y1;
if (n % 2 == 0) if (n % 2 == 0 && y1 + len > _y1)
if (!GDI_CALL (PatBlt, (hdc, x - pen_width / 2, y1, if (!GDI_CALL (PatBlt, (hdc, x - pen_width / 2,
y1 < _y1 ? _y1 : y1,
pen_width, len, pen_width, len,
PATCOPY))) PATCOPY)))
return FALSE; return FALSE;
......
...@@ -65,6 +65,32 @@ typedef struct { ...@@ -65,6 +65,32 @@ typedef struct {
DWORD bV5Reserved; DWORD bV5Reserved;
} BITMAPV5HEADER; } 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 #endif
#if 0 #if 0
......
...@@ -41,7 +41,6 @@ gdk_win32_OBJECTS = \ ...@@ -41,7 +41,6 @@ gdk_win32_OBJECTS = \
gdkinput-win32.obj \ gdkinput-win32.obj \
gdkkeys-win32.obj \ gdkkeys-win32.obj \
gdkmain-win32.obj \ gdkmain-win32.obj \
gdkpango-win32.obj \
gdkpixmap-win32.obj \ gdkpixmap-win32.obj \
gdkproperty-win32.obj \ gdkproperty-win32.obj \
# gdkregion-win32.obj \ # gdkregion-win32.obj \
......
...@@ -1051,7 +1051,7 @@ paint_ring (GtkHSV *hsv, ...@@ -1051,7 +1051,7 @@ paint_ring (GtkHSV *hsv,
cairo_arc (cr, cairo_arc (cr,
center, center, center, center,
priv->size / 2. - priv->ring_width / 2., priv->size / 2. - priv->ring_width / 2.,
0, 2 * M_PI); 0, 2 * G_PI);
cairo_stroke (cr); cairo_stroke (cr);
cairo_restore (cr); cairo_restore (cr);
...@@ -1257,7 +1257,7 @@ paint_triangle (GtkHSV *hsv, ...@@ -1257,7 +1257,7 @@ paint_triangle (GtkHSV *hsv,
#define FOCUS_RADIUS 6 #define FOCUS_RADIUS 6
cairo_new_path (cr); 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); cairo_stroke (cr);
/* Draw focus outline */ /* Draw focus outline */
......
...@@ -3782,7 +3782,7 @@ gtk_default_draw_option (GtkStyle *style, ...@@ -3782,7 +3782,7 @@ gtk_default_draw_option (GtkStyle *style,
x + exterior_size / 2., x + exterior_size / 2.,
y + exterior_size / 2., y + exterior_size / 2.,
(exterior_size - 1) / 2., (exterior_size - 1) / 2.,
0, 2 * M_PI); 0, 2 * G_PI);
cairo_save (cr); cairo_save (cr);
cairo_fill (cr); cairo_fill (cr);
...@@ -3828,7 +3828,7 @@ gtk_default_draw_option (GtkStyle *style, ...@@ -3828,7 +3828,7 @@ gtk_default_draw_option (GtkStyle *style,
x + pad + interior_size / 2., x + pad + interior_size / 2.,
y + pad + interior_size / 2., y + pad + interior_size / 2.,
interior_size / 2., interior_size / 2.,
0, 2 * M_PI); 0, 2 * G_PI);
cairo_fill (cr); cairo_fill (cr);
} }
else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */
......
...@@ -2922,11 +2922,11 @@ set_parent_signal (GtkWidget *child, ...@@ -2922,11 +2922,11 @@ set_parent_signal (GtkWidget *child,
GtkWidget *old_parent, GtkWidget *old_parent,
gpointer func_data) gpointer func_data)
{ {
g_print ("set_parent for \"%s\": new parent: \"%s\", old parent: \"%s\", data: %d\n", g_message ("set_parent for \"%s\": new parent: \"%s\", old parent: \"%s\", data: %d\n",
g_type_name (G_OBJECT_TYPE (child)), g_type_name (G_OBJECT_TYPE (child)),
child->parent ? g_type_name (G_OBJECT_TYPE (child->parent)) : "NULL", child->parent ? g_type_name (G_OBJECT_TYPE (child->parent)) : "NULL",
old_parent ? g_type_name (G_OBJECT_TYPE (old_parent)) : "NULL", old_parent ? g_type_name (G_OBJECT_TYPE (old_parent)) : "NULL",
GPOINTER_TO_INT (func_data)); GPOINTER_TO_INT (func_data));
} }
static void static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment