diff options
author | Cody Russell <bratsche@gnome.org> | 2008-01-31 22:42:11 +0000 |
---|---|---|
committer | Cody Russell <bratsche@src.gnome.org> | 2008-01-31 22:42:11 +0000 |
commit | 4152cd0cc9665040ba8c27339b4885a7986dd500 (patch) | |
tree | 4487f8120998218935cb0c8cf41a195f153290b6 | |
parent | dd5f8231d7f11700d0656b6f312d2772ee653165 (diff) | |
download | gdk-pixbuf-4152cd0cc9665040ba8c27339b4885a7986dd500.tar.gz |
Merge from trunk:
2008-01-31 Cody Russell <bratsche@gnome.org>
Merge from trunk:
* gdk/win32/gdkevents-win32.c:
Refactored some of the window hiding/showing code from
WM_ACTIVATE to WM_SIZE and WM_SYSCOMMAND. Having this
under WM_ACTIVATE was causing the application to go into
a weird state when the user right-clicked on the taskbar
entry of a window that was minimized. (#505928)
svn path=/branches/gtk-2-12/; revision=19452
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | gdk/win32/gdkevents-win32.c | 106 |
2 files changed, 70 insertions, 47 deletions
@@ -2,6 +2,17 @@ Merge from trunk: + * gdk/win32/gdkevents-win32.c: + Refactored some of the window hiding/showing code from + WM_ACTIVATE to WM_SIZE and WM_SYSCOMMAND. Having this + under WM_ACTIVATE was causing the application to go into + a weird state when the user right-clicked on the taskbar + entry of a window that was minimized. (#505928) + +2008-01-31 Cody Russell <bratsche@gnome.org> + + Merge from trunk: + * gtk/gtkpaned.c (gtk_paned_set_position): Change queue_resize() to queue_draw(), and add a check for child2 != NULL in case someone calls this before there is diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index a91622841..584c2145e 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-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-2002 Tor Lillqvist - * Copyright (C) 2007 Cody Russell + * Copyright (C) 2007-2008 Cody Russell * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1266,6 +1266,19 @@ apply_filters (GdkWindow *window, return result; } +/* + * On Windows, transient windows will not have their own taskbar entries. + * Because of this, we must hide and restore groups of transients in both + * directions. That is, all transient children must be hidden or restored + * with this window, but if this window's transient owner also has a + * transient owner then this window's transient owner must be hidden/restored + * with this one. And etc, up the chain until we hit an ancestor that has no + * transient owner. + * + * It would be a good idea if applications don't chain transient windows + * together. There's a limit to how much evil GTK can try to shield you + * from. + */ static void show_window_recurse (GdkWindow *window, gboolean hide_window) { @@ -1300,6 +1313,32 @@ show_window_recurse (GdkWindow *window, gboolean hide_window) } } +static void +show_window_internal (GdkWindow *window, gboolean hide_window) +{ + GdkWindow *tmp_window = NULL; + GdkWindowImplWin32 *tmp_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl); + + if (!tmp_impl->changing_state) + { + /* Find the top-level window in our transient chain. */ + while (tmp_impl->transient_owner != NULL) + { + tmp_window = tmp_impl->transient_owner; + tmp_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (tmp_window)->impl); + } + + /* If we couldn't find one, use the window provided. */ + if (tmp_window == NULL) + { + tmp_window = window; + } + + /* Recursively show/hide every window in the chain. */ + show_window_recurse (tmp_window, hide_window); + } +} + static gboolean gdk_window_is_ancestor (GdkWindow *ancestor, GdkWindow *window) @@ -2875,6 +2914,14 @@ gdk_event_translate (MSG *msg, return_val = TRUE; break; + case WM_SYSCOMMAND: + + if (msg->wParam == SC_MINIMIZE || msg->wParam == SC_RESTORE) + { + show_window_internal (window, msg->wParam == SC_MINIMIZE ? TRUE : FALSE); + } + break; + case WM_SIZE: GDK_NOTE (EVENTS, g_print (" %s %dx%d", @@ -2898,6 +2945,7 @@ gdk_event_translate (MSG *msg, gdk_synthesize_window_state (window, GDK_WINDOW_STATE_WITHDRAWN, GDK_WINDOW_STATE_ICONIFIED); + show_window_internal (window, TRUE); } else if ((msg->wParam == SIZE_RESTORED || msg->wParam == SIZE_MAXIMIZED) && @@ -2910,11 +2958,14 @@ gdk_event_translate (MSG *msg, handle_configure_event (msg, window); if (msg->wParam == SIZE_RESTORED) - gdk_synthesize_window_state (window, - GDK_WINDOW_STATE_ICONIFIED | - GDK_WINDOW_STATE_MAXIMIZED | - withdrawn_bit, - 0); + { + gdk_synthesize_window_state (window, + GDK_WINDOW_STATE_ICONIFIED | + GDK_WINDOW_STATE_MAXIMIZED | + withdrawn_bit, + 0); + show_window_internal (window, FALSE); + } else if (msg->wParam == SIZE_MAXIMIZED) gdk_synthesize_window_state (window, GDK_WINDOW_STATE_ICONIFIED | @@ -3366,46 +3417,7 @@ gdk_event_translate (MSG *msg, } break; - case WM_ACTIVATE: { - /* - * On Windows, transient windows will not have their own taskbar entries. - * Because of this, we must hide and restore groups of transients in both - * directions. That is, all transient children must be hidden or restored - * with this window, but if this window's transient owner also has a - * transient owner then this window's transient owner must be hidden/restored - * with this one. And etc, up the chain until we hit an ancestor that has no - * transient owner. - * - * It would be a good idea if applications don't chain transient windows - * together. There's a limit to how much evil GTK can try to shield you - * from. - */ - GdkWindow *tmp_window = NULL; - GdkWindowImplWin32 *tmp_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl); - - while (tmp_impl->transient_owner != NULL) - { - tmp_window = tmp_impl->transient_owner; - tmp_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (tmp_window)->impl); - } - - if (tmp_window == NULL) - tmp_window = window; - - if (LOWORD (msg->wParam) == WA_INACTIVE && HIWORD (msg->wParam)) - { - if (!tmp_impl->changing_state) - { - show_window_recurse (tmp_window, TRUE); - } - } - else if (LOWORD (msg->wParam) == WA_ACTIVE && HIWORD (msg->wParam)) - { - if (!tmp_impl->changing_state) - { - show_window_recurse (tmp_window, FALSE); - } - } + case WM_ACTIVATE: /* Bring any tablet contexts to the top of the overlap order when * one of our windows is activated. @@ -3415,7 +3427,7 @@ gdk_event_translate (MSG *msg, if (LOWORD(msg->wParam) != WA_INACTIVE) _gdk_input_set_tablet_active (); break; - } + /* Handle WINTAB events here, as we know that gdkinput.c will * use the fixed WT_DEFBASE as lcMsgBase, and we thus can use the |