+2002-12-09 Tor Lillqvist <tml@iki.fi>
+
+ Merge from stable:
+
+ * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
+ stipple_gc. More checks for errors. Use correct ternary ROP when
+ blitting the foreground into the tile pixmap onto those pixels
+ where the stipple is set. (I didn't notice that I had used the
+ wrong one, as it didn't matter on Win2k, where DIB sections
+ apparently are zeroed upon creation. But on Win98 they have random
+ initial contents. Thanks to Hans Breuer for reporting this.)
+ (gdk_win32_draw_rectangle, gdk_win32_draw_arc,
+ gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
+ generic_draw() if drawing a filled figure.
+
+ * gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
+ (_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
+ (_gdk_win32_window_state_to_string): New debugging output helper
+ function.
+
+ * gdk/win32/gdkevents-win32.c: Minor debugging output changes.
+ (gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
+ SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
+ WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
+ unmapping on X11. Set window state correctly for all three of
+ SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
+ ("minimized" in Windows terminology) window still has the
+ "maximized" property, i.e. when deiconified, it will reappear as
+ maximized. (#10557)
+
+ * gdk/win32/gdkprivate-win32.h: Declare new function.
+ (WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
+ __PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
+
+ * gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
+ situations. Add parameter to tell whether deiconifying. Code
+ reorg: Return early when appropriate instead of using nested if
+ statements. If just deiconifying without raising, restore active
+ window. (#10557)
+
+ (gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
+ gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
+ gdk_window_focus): Use _gdk_win32_window_state_to_string() in
+ debugging output.
+
+ (gdk_window_iconify): Restore active window after calling
+ ShowWindow(). Otherwise the "next" window gets activated.
+
+ (gdk_window_stick, gdk_window_unstick): Don't output any warnings.
+
+ (gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
+ with GWL_HWNDPARENT, which despite its name sets the *owner*
+ window, which should be exactly what we want. The PSDK
+ documentation is said to be misleading. testgtk's modal window
+ test now works much better. (#50586)
+
Sun Dec 8 18:28:51 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_fg/bg/base/text/font):
+2002-12-09 Tor Lillqvist <tml@iki.fi>
+
+ Merge from stable:
+
+ * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
+ stipple_gc. More checks for errors. Use correct ternary ROP when
+ blitting the foreground into the tile pixmap onto those pixels
+ where the stipple is set. (I didn't notice that I had used the
+ wrong one, as it didn't matter on Win2k, where DIB sections
+ apparently are zeroed upon creation. But on Win98 they have random
+ initial contents. Thanks to Hans Breuer for reporting this.)
+ (gdk_win32_draw_rectangle, gdk_win32_draw_arc,
+ gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
+ generic_draw() if drawing a filled figure.
+
+ * gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
+ (_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
+ (_gdk_win32_window_state_to_string): New debugging output helper
+ function.
+
+ * gdk/win32/gdkevents-win32.c: Minor debugging output changes.
+ (gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
+ SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
+ WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
+ unmapping on X11. Set window state correctly for all three of
+ SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
+ ("minimized" in Windows terminology) window still has the
+ "maximized" property, i.e. when deiconified, it will reappear as
+ maximized. (#10557)
+
+ * gdk/win32/gdkprivate-win32.h: Declare new function.
+ (WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
+ __PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
+
+ * gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
+ situations. Add parameter to tell whether deiconifying. Code
+ reorg: Return early when appropriate instead of using nested if
+ statements. If just deiconifying without raising, restore active
+ window. (#10557)
+
+ (gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
+ gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
+ gdk_window_focus): Use _gdk_win32_window_state_to_string() in
+ debugging output.
+
+ (gdk_window_iconify): Restore active window after calling
+ ShowWindow(). Otherwise the "next" window gets activated.
+
+ (gdk_window_stick, gdk_window_unstick): Don't output any warnings.
+
+ (gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
+ with GWL_HWNDPARENT, which despite its name sets the *owner*
+ window, which should be exactly what we want. The PSDK
+ documentation is said to be misleading. testgtk's modal window
+ test now works much better. (#50586)
+
Sun Dec 8 18:28:51 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_fg/bg/base/text/font):
+2002-12-09 Tor Lillqvist <tml@iki.fi>
+
+ Merge from stable:
+
+ * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
+ stipple_gc. More checks for errors. Use correct ternary ROP when
+ blitting the foreground into the tile pixmap onto those pixels
+ where the stipple is set. (I didn't notice that I had used the
+ wrong one, as it didn't matter on Win2k, where DIB sections
+ apparently are zeroed upon creation. But on Win98 they have random
+ initial contents. Thanks to Hans Breuer for reporting this.)
+ (gdk_win32_draw_rectangle, gdk_win32_draw_arc,
+ gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
+ generic_draw() if drawing a filled figure.
+
+ * gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
+ (_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
+ (_gdk_win32_window_state_to_string): New debugging output helper
+ function.
+
+ * gdk/win32/gdkevents-win32.c: Minor debugging output changes.
+ (gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
+ SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
+ WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
+ unmapping on X11. Set window state correctly for all three of
+ SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
+ ("minimized" in Windows terminology) window still has the
+ "maximized" property, i.e. when deiconified, it will reappear as
+ maximized. (#10557)
+
+ * gdk/win32/gdkprivate-win32.h: Declare new function.
+ (WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
+ __PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
+
+ * gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
+ situations. Add parameter to tell whether deiconifying. Code
+ reorg: Return early when appropriate instead of using nested if
+ statements. If just deiconifying without raising, restore active
+ window. (#10557)
+
+ (gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
+ gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
+ gdk_window_focus): Use _gdk_win32_window_state_to_string() in
+ debugging output.
+
+ (gdk_window_iconify): Restore active window after calling
+ ShowWindow(). Otherwise the "next" window gets activated.
+
+ (gdk_window_stick, gdk_window_unstick): Don't output any warnings.
+
+ (gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
+ with GWL_HWNDPARENT, which despite its name sets the *owner*
+ window, which should be exactly what we want. The PSDK
+ documentation is said to be misleading. testgtk's modal window
+ test now works much better. (#50586)
+
Sun Dec 8 18:28:51 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_fg/bg/base/text/font):
+2002-12-09 Tor Lillqvist <tml@iki.fi>
+
+ Merge from stable:
+
+ * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
+ stipple_gc. More checks for errors. Use correct ternary ROP when
+ blitting the foreground into the tile pixmap onto those pixels
+ where the stipple is set. (I didn't notice that I had used the
+ wrong one, as it didn't matter on Win2k, where DIB sections
+ apparently are zeroed upon creation. But on Win98 they have random
+ initial contents. Thanks to Hans Breuer for reporting this.)
+ (gdk_win32_draw_rectangle, gdk_win32_draw_arc,
+ gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
+ generic_draw() if drawing a filled figure.
+
+ * gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
+ (_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
+ (_gdk_win32_window_state_to_string): New debugging output helper
+ function.
+
+ * gdk/win32/gdkevents-win32.c: Minor debugging output changes.
+ (gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
+ SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
+ WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
+ unmapping on X11. Set window state correctly for all three of
+ SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
+ ("minimized" in Windows terminology) window still has the
+ "maximized" property, i.e. when deiconified, it will reappear as
+ maximized. (#10557)
+
+ * gdk/win32/gdkprivate-win32.h: Declare new function.
+ (WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
+ __PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
+
+ * gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
+ situations. Add parameter to tell whether deiconifying. Code
+ reorg: Return early when appropriate instead of using nested if
+ statements. If just deiconifying without raising, restore active
+ window. (#10557)
+
+ (gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
+ gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
+ gdk_window_focus): Use _gdk_win32_window_state_to_string() in
+ debugging output.
+
+ (gdk_window_iconify): Restore active window after calling
+ ShowWindow(). Otherwise the "next" window gets activated.
+
+ (gdk_window_stick, gdk_window_unstick): Don't output any warnings.
+
+ (gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
+ with GWL_HWNDPARENT, which despite its name sets the *owner*
+ window, which should be exactly what we want. The PSDK
+ documentation is said to be misleading. testgtk's modal window
+ test now works much better. (#50586)
+
Sun Dec 8 18:28:51 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_fg/bg/base/text/font):
+2002-12-09 Tor Lillqvist <tml@iki.fi>
+
+ Merge from stable:
+
+ * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
+ stipple_gc. More checks for errors. Use correct ternary ROP when
+ blitting the foreground into the tile pixmap onto those pixels
+ where the stipple is set. (I didn't notice that I had used the
+ wrong one, as it didn't matter on Win2k, where DIB sections
+ apparently are zeroed upon creation. But on Win98 they have random
+ initial contents. Thanks to Hans Breuer for reporting this.)
+ (gdk_win32_draw_rectangle, gdk_win32_draw_arc,
+ gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
+ generic_draw() if drawing a filled figure.
+
+ * gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
+ (_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
+ (_gdk_win32_window_state_to_string): New debugging output helper
+ function.
+
+ * gdk/win32/gdkevents-win32.c: Minor debugging output changes.
+ (gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
+ SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
+ WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
+ unmapping on X11. Set window state correctly for all three of
+ SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
+ ("minimized" in Windows terminology) window still has the
+ "maximized" property, i.e. when deiconified, it will reappear as
+ maximized. (#10557)
+
+ * gdk/win32/gdkprivate-win32.h: Declare new function.
+ (WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
+ __PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
+
+ * gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
+ situations. Add parameter to tell whether deiconifying. Code
+ reorg: Return early when appropriate instead of using nested if
+ statements. If just deiconifying without raising, restore active
+ window. (#10557)
+
+ (gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
+ gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
+ gdk_window_focus): Use _gdk_win32_window_state_to_string() in
+ debugging output.
+
+ (gdk_window_iconify): Restore active window after calling
+ ShowWindow(). Otherwise the "next" window gets activated.
+
+ (gdk_window_stick, gdk_window_unstick): Don't output any warnings.
+
+ (gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
+ with GWL_HWNDPARENT, which despite its name sets the *owner*
+ window, which should be exactly what we want. The PSDK
+ documentation is said to be misleading. testgtk's modal window
+ test now works much better. (#50586)
+
Sun Dec 8 18:28:51 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_fg/bg/base/text/font):
+2002-12-09 Tor Lillqvist <tml@iki.fi>
+
+ Merge from stable:
+
+ * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
+ stipple_gc. More checks for errors. Use correct ternary ROP when
+ blitting the foreground into the tile pixmap onto those pixels
+ where the stipple is set. (I didn't notice that I had used the
+ wrong one, as it didn't matter on Win2k, where DIB sections
+ apparently are zeroed upon creation. But on Win98 they have random
+ initial contents. Thanks to Hans Breuer for reporting this.)
+ (gdk_win32_draw_rectangle, gdk_win32_draw_arc,
+ gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
+ generic_draw() if drawing a filled figure.
+
+ * gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
+ (_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
+ (_gdk_win32_window_state_to_string): New debugging output helper
+ function.
+
+ * gdk/win32/gdkevents-win32.c: Minor debugging output changes.
+ (gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
+ SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
+ WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
+ unmapping on X11. Set window state correctly for all three of
+ SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
+ ("minimized" in Windows terminology) window still has the
+ "maximized" property, i.e. when deiconified, it will reappear as
+ maximized. (#10557)
+
+ * gdk/win32/gdkprivate-win32.h: Declare new function.
+ (WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
+ __PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
+
+ * gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
+ situations. Add parameter to tell whether deiconifying. Code
+ reorg: Return early when appropriate instead of using nested if
+ statements. If just deiconifying without raising, restore active
+ window. (#10557)
+
+ (gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
+ gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
+ gdk_window_focus): Use _gdk_win32_window_state_to_string() in
+ debugging output.
+
+ (gdk_window_iconify): Restore active window after calling
+ ShowWindow(). Otherwise the "next" window gets activated.
+
+ (gdk_window_stick, gdk_window_unstick): Don't output any warnings.
+
+ (gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
+ with GWL_HWNDPARENT, which despite its name sets the *owner*
+ window, which should be exactly what we want. The PSDK
+ documentation is said to be misleading. testgtk's modal window
+ test now works much better. (#50586)
+
Sun Dec 8 18:28:51 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_fg/bg/base/text/font):
#include "gdkprivate-win32.h"
#define ROP3_D 0x00AA0029
-#define ROP3_DPSao 0x00EA02E9
#define ROP3_DSna 0x00220326
+#define ROP3_DSPDxax 0x00E20746
#define LINE_ATTRIBUTES (GDK_GC_LINE_WIDTH|GDK_GC_LINE_STYLE| \
GDK_GC_CAP_STYLE|GDK_GC_JOIN_STYLE)
gdk_draw_rectangle (tile_pixmap, tile_gc, TRUE,
0, 0, width, height);
}
+ gdk_gc_unref (stipple_gc);
}
gdk_gc_unref (mask_gc);
if (gcwin32->fill_style == GDK_STIPPLED ||
gcwin32->fill_style == GDK_OPAQUE_STIPPLED)
{
- HDC stipple_hdc = CreateCompatibleDC (hdc);
- HGDIOBJ old_stipple_hbm = SelectObject (stipple_hdc, GDK_PIXMAP_HBITMAP (stipple_bitmap));
- HBRUSH fg_brush = CreateSolidBrush
- (_gdk_win32_colormap_color (impl->colormap, gcwin32->foreground));
- HGDIOBJ old_tile_brush = SelectObject (tile_hdc, fg_brush);
-
- /* Paint tile with foreround where stipple is one */
+ HDC stipple_hdc;
+ HGDIOBJ old_stipple_hbm;
+ HBRUSH fg_brush;
+ HGDIOBJ old_tile_brush;
+
+ if ((stipple_hdc = CreateCompatibleDC (hdc)) == NULL)
+ WIN32_GDI_FAILED ("CreateCompatibleDC");
+
+ if ((old_stipple_hbm =
+ SelectObject (stipple_hdc,
+ GDK_PIXMAP_HBITMAP (stipple_bitmap))) == NULL)
+ WIN32_GDI_FAILED ("SelectObject");
+
+ if ((fg_brush = CreateSolidBrush
+ (_gdk_win32_colormap_color (impl->colormap,
+ gcwin32->foreground))) == NULL)
+ WIN32_GDI_FAILED ("CreateSolidBrush");
+
+ if ((old_tile_brush = SelectObject (tile_hdc, fg_brush)) == NULL)
+ WIN32_GDI_FAILED ("SelectObject");
+
+ /* Paint tile with foreround where stipple is one
+ *
+ * Desired ternary ROP: (P=foreground, S=stipple, D=destination)
+ * P S D ?
+ * 0 0 0 0
+ * 0 0 1 1
+ * 0 1 0 0
+ * 0 1 1 0
+ * 1 0 0 0
+ * 1 0 1 1
+ * 1 1 0 1
+ * 1 1 1 1
+ *
+ * Reading bottom-up: 11100010 = 0xE2. PSDK docs say this is
+ * known as DSPDxax, with hex value 0x00E20746.
+ */
GDI_CALL (BitBlt, (tile_hdc, 0, 0, width, height,
- stipple_hdc, 0, 0, ROP3_DPSao));
+ stipple_hdc, 0, 0, ROP3_DSPDxax));
if (gcwin32->fill_style == GDK_STIPPLED)
{
- /* Punch holes in mask where stipple bitmap is zero */
+ /* Punch holes in mask where stipple is zero */
GDI_CALL (BitBlt, (mask_hdc, 0, 0, width, height,
stipple_hdc, 0, 0, SRCAND));
}
bounds.height = height;
region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width);
- generic_draw (drawable, gc, GDK_GC_FOREGROUND|LINE_ATTRIBUTES,
+ generic_draw (drawable, gc,
+ GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES),
draw_rectangle, region, filled, x, y, width, height);
gdk_region_destroy (region);
bounds.height = height;
region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width);
- generic_draw (drawable, gc, GDK_GC_FOREGROUND|LINE_ATTRIBUTES,
+ generic_draw (drawable, gc,
+ GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES),
draw_arc, region, filled, x, y, width, height, angle1, angle2);
gdk_region_destroy (region);
region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width);
- generic_draw (drawable, gc, GDK_GC_FOREGROUND|LINE_ATTRIBUTES,
+ generic_draw (drawable, gc,
+ GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES),
draw_polygon, region, filled, pts, npoints);
gdk_region_destroy (region);
#undef CASE
}
-static void
-print_window_state (GdkWindowState state)
-{
-#define CASE(bit) if (state & GDK_WINDOW_STATE_ ## bit ) g_print (#bit " ");
- CASE (WITHDRAWN);
- CASE (ICONIFIED);
- CASE (MAXIMIZED);
- CASE (STICKY);
-#undef CASE
-}
-
static void
print_event (GdkEvent *event)
{
print_event_state (event->scroll.state);
break;
case GDK_WINDOW_STATE:
- print_window_state (event->window_state.changed_mask);
- print_window_state (event->window_state.new_window_state);
+ g_print ("%s: %s",
+ _gdk_win32_window_state_to_string (event->window_state.changed_mask),
+ _gdk_win32_window_state_to_string (event->window_state.new_window_state));
default:
/* Nothing */
break;
if (!(private->event_mask & GDK_STRUCTURE_MASK))
break;
+ if (msg->lParam == SW_OTHERUNZOOM ||
+ msg->lParam == SW_OTHERZOOM)
+ break;
+
event->any.type = (msg->wParam ? GDK_MAP : GDK_UNMAP);
event->any.window = window;
(msg->wParam == SIZE_RESTORED ? "RESTORED" : "?"))))),
LOWORD (msg->lParam), HIWORD (msg->lParam)));
- if (!(private->event_mask & GDK_STRUCTURE_MASK))
- break;
-
if (msg->wParam == SIZE_MINIMIZED)
{
- event->any.type = GDK_UNMAP;
- event->any.window = window;
+ /* Don't generate any GDK event. This is *not* an UNMAP. */
if (p_grab_window == window)
gdk_pointer_ungrab (msg->time);
if (k_grab_window == window)
gdk_keyboard_ungrab (msg->time);
- if (window && GDK_WINDOW_IS_MAPPED (window))
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_MAXIMIZED,
- GDK_WINDOW_STATE_ICONIFIED);
-
- return_val = !GDK_WINDOW_DESTROYED (window);
+ gdk_synthesize_window_state (window,
+ GDK_WINDOW_STATE_WITHDRAWN,
+ GDK_WINDOW_STATE_ICONIFIED);
}
else if ((msg->wParam == SIZE_RESTORED
|| msg->wParam == SIZE_MAXIMIZED)
#endif
)
{
+ if (!(private->event_mask & GDK_STRUCTURE_MASK))
+ break;
+
event->configure.type = GDK_CONFIGURE;
event->configure.window = window;
pt.x = 0;
if (msg->wParam == SIZE_RESTORED)
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
- GDK_WINDOW_STATE_MAXIMIZED,
+ GDK_WINDOW_STATE_MAXIMIZED |
+ GDK_WINDOW_STATE_WITHDRAWN,
0);
else if (msg->wParam == SIZE_MAXIMIZED)
gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_ICONIFIED,
+ GDK_WINDOW_STATE_ICONIFIED |
+ GDK_WINDOW_STATE_WITHDRAWN,
GDK_WINDOW_STATE_MAXIMIZED);
if (private->resize_count > 1)
RECT rect;
int flag;
- g_print ("%p\n", hdc);
+ g_print ("%p:\n", hdc);
obj = GetCurrentObject (hdc, OBJ_BRUSH);
GetObject (obj, sizeof (LOGBRUSH), &logbrush);
g_print ("brush: %s color=%06lx hatch=%p\n",
gchar *bufp = buf;
gchar *s = "";
+ buf[0] = '\0';
+
#define BIT(x) \
if (mask & GDK_GC_##x) \
(bufp += sprintf (bufp, "%s" #x, s), s = "|")
return static_printf ("%s", buf);
}
+gchar *
+_gdk_win32_window_state_to_string (GdkWindowState state)
+{
+ gchar buf[100];
+ gchar *bufp = buf;
+ gchar *s = "";
+
+ buf[0] = '\0';
+
+#define BIT(x) \
+ if (state & GDK_WINDOW_STATE_ ## x) \
+ (bufp += sprintf (bufp, "%s" #x, s), s = "|")
+
+ /* For clarity, also show the complement of WITHDRAWN, i.e. "MAPPED" */
+ if (!(state & GDK_WINDOW_STATE_WITHDRAWN))
+ (bufp += sprintf (bufp, "MAPPED"), s = "|");
+
+ BIT (WITHDRAWN);
+ BIT (ICONIFIED);
+ BIT (MAXIMIZED);
+ BIT (STICKY);
+#undef BIT
+
+ return static_printf ("%s", buf);
+}
+
gchar *
_gdk_win32_rop2_to_string (int rop2)
{
gchar *_gdk_win32_join_style_to_string (GdkJoinStyle join_style);
gchar *_gdk_win32_line_style_to_string (GdkLineStyle line_style);
gchar *_gdk_win32_gcvalues_mask_to_string (GdkGCValuesMask mask);
+gchar *_gdk_win32_window_state_to_string (GdkWindowState state);
gchar *_gdk_win32_drawable_description (GdkDrawable *d);
gchar *_gdk_win32_rop2_to_string (int rop2);
gint line,
const gchar *api);
-#ifdef __GNUC__
+#if defined(__GNUC__) && (__GNUC__ < 3)
#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)
static void
show_window_internal (GdkWindow *window,
- gboolean raise)
+ gboolean raise,
+ gboolean deiconify)
{
GdkWindowObject *private;
+ HWND old_active_window;
private = GDK_WINDOW_OBJECT (window);
- if (!private->destroyed)
- {
- GDK_NOTE (MISC, g_print ("gdk_window_show: %p\n",
- GDK_WINDOW_HWND (window)));
+ if (private->destroyed)
+ return;
- private->state &= (~GDK_WINDOW_STATE_WITHDRAWN);
- if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
- {
- ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNOACTIVATE);
- SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOPMOST, 0, 0, 0, 0,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
-#if 0
- /* Don't put on toolbar */
- ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
-#endif
- }
- else
- {
- if (GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE) & WS_EX_TRANSPARENT)
- {
- SetWindowPos(GDK_WINDOW_HWND (window), HWND_TOP, 0, 0, 0, 0,
- SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE);
- }
- else
- {
- GdkWindow *parent = GDK_WINDOW (private->parent);
-
- /* Todo: GDK_WINDOW_STATE_STICKY */
- if (private->state & GDK_WINDOW_STATE_ICONIFIED)
- ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMINIMIZED);
- else if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
- ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMAXIMIZED);
- else
- {
- ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
- ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
- }
- if (parent == _gdk_parent_root)
- SetForegroundWindow (GDK_WINDOW_HWND (window));
- if (raise)
- BringWindowToTop (GDK_WINDOW_HWND (window));
-#if 0
- ShowOwnedPopups (GDK_WINDOW_HWND (window), TRUE);
-#endif
- }
- }
+ GDK_NOTE (MISC, g_print ("show_window_internal: %p %s%s%s\n",
+ GDK_WINDOW_HWND (window),
+ _gdk_win32_window_state_to_string (private->state),
+ (raise ? " raise" : ""),
+ (deiconify ? " deiconify" : "")));
+
+ /* If asked to show (not deiconify) an withdrawn and iconified
+ * window, do that.
+ */
+ if (!deiconify &&
+ !GDK_WINDOW_IS_MAPPED (window) &&
+ (private->state & GDK_WINDOW_STATE_ICONIFIED))
+ {
+ ShowWindow (GDK_WINDOW_HWND (window), SW_MINIMIZE);
+ return;
}
+
+ /* If asked to just show an iconified window, do nothing. */
+ if (!deiconify && (private->state & GDK_WINDOW_STATE_ICONIFIED))
+ return;
+
+ /* If asked to deiconify an already noniconified window, do
+ * nothing. (Especially, don't cause the window to rise and
+ * activate. There are different calls for that.)
+ */
+ if (deiconify && !(private->state & GDK_WINDOW_STATE_ICONIFIED))
+ return;
+
+ /* If asked to show (but not raise) a window that is already
+ * visible, do nothing.
+ */
+ if (!deiconify && !raise && IsWindowVisible (GDK_WINDOW_HWND (window)))
+ return;
+
+ /* Other cases */
+
+ if (!GDK_WINDOW_IS_MAPPED (window))
+ gdk_synthesize_window_state (window,
+ GDK_WINDOW_STATE_WITHDRAWN,
+ 0);
+ if (GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE) & WS_EX_TRANSPARENT)
+ {
+ /* Don't really know if this makes sense, can't remember whether
+ * this case is handled like this because it is necessary, or
+ * if this is just old crap.
+ */
+ SetWindowPos(GDK_WINDOW_HWND (window), HWND_TOP, 0, 0, 0, 0,
+ SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE);
+ return;
+ }
+
+ old_active_window = GetActiveWindow ();
+
+ if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
+ ShowWindow (GDK_WINDOW_HWND (window), SW_MAXIMIZE);
+ else if (private->state & GDK_WINDOW_STATE_ICONIFIED)
+ ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
+ else
+ ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
+
+ if (raise)
+ BringWindowToTop (GDK_WINDOW_HWND (window));
+ else if (old_active_window != GDK_WINDOW_HWND (window))
+ SetActiveWindow (old_active_window);
}
void
{
g_return_if_fail (GDK_IS_WINDOW (window));
- show_window_internal (window, FALSE);
+ show_window_internal (window, FALSE, FALSE);
}
void
{
g_return_if_fail (GDK_IS_WINDOW (window));
- show_window_internal (window, TRUE);
+ show_window_internal (window, TRUE, FALSE);
}
void
private = (GdkWindowObject*) window;
if (!private->destroyed)
{
- GDK_NOTE (MISC, g_print ("gdk_window_hide: %p\n",
- GDK_WINDOW_HWND (window)));
+ GDK_NOTE (MISC, g_print ("gdk_window_hide: %p %s\n",
+ GDK_WINDOW_HWND (window),
+ _gdk_win32_window_state_to_string (private->state)));
- private->state |= GDK_WINDOW_STATE_WITHDRAWN;
+ if (GDK_WINDOW_IS_MAPPED (window))
+ gdk_synthesize_window_state (window,
+ 0,
+ GDK_WINDOW_STATE_WITHDRAWN);
_gdk_window_clear_update_area (window);
private = (GdkWindowObject*) window;
if (!private->destroyed)
{
- GDK_NOTE (MISC, g_print ("gdk_window_withdraw: %p\n",
- GDK_WINDOW_HWND (window)));
+ GDK_NOTE (MISC, g_print ("gdk_window_withdraw: %p %s\n",
+ GDK_WINDOW_HWND (window),
+ _gdk_win32_window_state_to_string (private->state)));
gdk_window_hide (window); /* ??? */
}
GdkWindow *parent)
{
HWND window_id, parent_id;
- LONG style;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window) || GDK_WINDOW_DESTROYED (parent))
return;
+ if (((GdkWindowObject *) window)->window_type == GDK_WINDOW_CHILD)
+ {
+ GDK_NOTE (MISC, g_print ("...a child window!\n"));
+ return;
+ }
+
window_id = GDK_WINDOW_HWND (window);
parent_id = GDK_WINDOW_HWND (parent);
- if ((style = GetWindowLong (window_id, GWL_STYLE)) == 0)
- WIN32_API_FAILED ("GetWindowLong");
-
- style |= WS_POPUP;
-#if 0 /* not sure if we want to do this */
- style &= ~(WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
-#endif
-
- if (!SetWindowLong (window_id, GWL_STYLE, style))
+ /* This changes the *owner* of the window, despite the misleading
+ * name. (Owner and parent are unrelated concepts.) At least that's
+ * what people who seem to know what they talk about say on
+ * USENET. Search on Google.
+ */
+ SetLastError (0);
+ if (SetWindowLong (window_id, GWL_HWNDPARENT, (long) parent_id) == 0 &&
+ GetLastError () != 0)
WIN32_API_FAILED ("SetWindowLong");
-#if 0 /* not sure if we want to do this, clipping to parent size! */
- if (!SetParent (window_id, parent_id))
- WIN32_API_FAILED ("SetParent");
-#else /* make the modal window topmost instead */
- if (!SetWindowPos (window_id, HWND_NOTOPMOST, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE))
- WIN32_API_FAILED ("SetWindowPos");
-#endif
-
- if (!RedrawWindow (window_id, NULL, NULL,
- RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW))
- WIN32_API_FAILED ("RedrawWindow");
}
void
void
gdk_window_iconify (GdkWindow *window)
{
+ HWND old_active_window;
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
+ GDK_NOTE (MISC, g_print ("gdk_window_iconify: %p %s\n",
+ GDK_WINDOW_HWND (window),
+ _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
+
if (GDK_WINDOW_IS_MAPPED (window))
{
+ old_active_window = GetActiveWindow ();
ShowWindow (GDK_WINDOW_HWND (window), SW_MINIMIZE);
+ if (old_active_window != GDK_WINDOW_HWND (window))
+ SetActiveWindow (old_active_window);
}
else
{
- /* Flip our client side flag, the real work happens on map. */
gdk_synthesize_window_state (window,
0,
GDK_WINDOW_STATE_ICONIFIED);
if (GDK_WINDOW_DESTROYED (window))
return;
+ GDK_NOTE (MISC, g_print ("gdk_window_deiconify: %p %s\n",
+ GDK_WINDOW_HWND (window),
+ _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
+
if (GDK_WINDOW_IS_MAPPED (window))
{
- gdk_window_show (window);
+ show_window_internal (window, FALSE, TRUE);
}
else
{
- /* Flip our client side flag, the real work happens on map. */
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED,
0);
if (GDK_WINDOW_DESTROYED (window))
return;
- if (GDK_WINDOW_IS_MAPPED (window))
- {
- /* "stick" means stick to all desktops _and_ do not scroll with the
- * viewport. i.e. glue to the monitor glass in all cases.
- */
- g_warning ("gdk_window_stick (%p) ???", GDK_WINDOW_HWND (window));
- }
- else
- {
- /* Flip our client side flag, the real work happens on map. */
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_STICKY);
- }
+ /* FIXME: Do something? */
}
void
if (GDK_WINDOW_DESTROYED (window))
return;
- if (GDK_WINDOW_IS_MAPPED (window))
- {
- g_warning ("gdk_window_unstick (%p) ???", GDK_WINDOW_HWND (window));
- }
- else
- {
- /* Flip our client side flag, the real work happens on map. */
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_STICKY,
- 0);
- }
+ /* FIXME: Do something? */
}
void
if (GDK_WINDOW_DESTROYED (window))
return;
+ GDK_NOTE (MISC, g_print ("gdk_window_maximize: %p %s\n",
+ GDK_WINDOW_HWND (window),
+ _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
+
if (GDK_WINDOW_IS_MAPPED (window))
ShowWindow (GDK_WINDOW_HWND (window), SW_MAXIMIZE);
else
if (GDK_WINDOW_DESTROYED (window))
return;
+ GDK_NOTE (MISC, g_print ("gdk_window_unmaximize: %p %s\n",
+ GDK_WINDOW_HWND (window),
+ _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
+
if (GDK_WINDOW_IS_MAPPED (window))
ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
else
if (GDK_WINDOW_DESTROYED (window))
return;
- GDK_NOTE (MISC, g_print ("gdk_window_focus: %p\n", GDK_WINDOW_HWND (window)));
+ GDK_NOTE (MISC, g_print ("gdk_window_focus: %p %s\n",
+ GDK_WINDOW_HWND (window),
+ _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
SetFocus (GDK_WINDOW_HWND (window));