From ab615105b6a491702fc2aa8888dc8631b05d090b Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 26 Oct 2011 10:21:10 +0200 Subject: [PATCH] win32: Send window-state-changes before configure events This is requires to that the state of the window is right when you get the configure event (and to match what X does). Fixes bug #169811 --- gdk/win32/gdkevents-win32.c | 60 ++++++++++++++++++------------------- gdk/win32/gdkwindow-win32.c | 8 +++-- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 47e248f13f..b99c03d992 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -2738,36 +2738,6 @@ gdk_event_translate (MSG *msg, _gdk_win32_append_event (event); } - /* Show, New size or position => configure event */ - if (!(windowpos->flags & SWP_NOCLIENTMOVE) || - !(windowpos->flags & SWP_NOCLIENTSIZE) || - (windowpos->flags & SWP_SHOWWINDOW)) - { - if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && - !IsIconic (msg->hwnd) && - !GDK_WINDOW_DESTROYED (window)) - handle_configure_event (msg, window); - - if (window->extension_events != 0) - _gdk_device_wintab_update_window_coords (window); - } - - if ((windowpos->flags & SWP_HIDEWINDOW) && - !GDK_WINDOW_DESTROYED (window)) - { - /* Send UNMAP events */ - event = gdk_event_new (GDK_UNMAP); - event->any.window = window; - _gdk_win32_append_event (event); - - /* Make transient parent the forground window when window unmaps */ - impl = GDK_WINDOW_IMPL_WIN32 (window->impl); - - if (impl->transient_owner && - GetForegroundWindow () == GDK_WINDOW_HWND (window)) - SetForegroundWindow (GDK_WINDOW_HWND (impl->transient_owner)); - } - /* Update window state */ if (windowpos->flags & (SWP_STATECHANGED | SWP_SHOWWINDOW | SWP_HIDEWINDOW)) { @@ -2813,6 +2783,36 @@ gdk_event_translate (MSG *msg, ensure_stacking_on_unminimize (msg); } + /* Show, New size or position => configure event */ + if (!(windowpos->flags & SWP_NOCLIENTMOVE) || + !(windowpos->flags & SWP_NOCLIENTSIZE) || + (windowpos->flags & SWP_SHOWWINDOW)) + { + if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && + !IsIconic (msg->hwnd) && + !GDK_WINDOW_DESTROYED (window)) + handle_configure_event (msg, window); + + if (window->extension_events != 0) + _gdk_device_wintab_update_window_coords (window); + } + + if ((windowpos->flags & SWP_HIDEWINDOW) && + !GDK_WINDOW_DESTROYED (window)) + { + /* Send UNMAP events */ + event = gdk_event_new (GDK_UNMAP); + event->any.window = window; + _gdk_win32_append_event (event); + + /* Make transient parent the forground window when window unmaps */ + impl = GDK_WINDOW_IMPL_WIN32 (window->impl); + + if (impl->transient_owner && + GetForegroundWindow () == GDK_WINDOW_HWND (window)) + SetForegroundWindow (GDK_WINDOW_HWND (impl->transient_owner)); + } + if (!(windowpos->flags & SWP_NOCLIENTSIZE)) { if (window->resize_count > 1) diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index b08d74b570..d1b2c8f1c7 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -2720,14 +2720,15 @@ gdk_win32_window_fullscreen (GdkWindow *window) g_object_set_data (G_OBJECT (window), "fullscreen-info", fi); fi->style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE); + /* Send state change before configure event */ + gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); + SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, (fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP); API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP, x, y, width, height, SWP_NOCOPYBITS | SWP_SHOWWINDOW)); - - gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); } } @@ -2743,6 +2744,8 @@ gdk_win32_window_unfullscreen (GdkWindow *window) { GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl); + gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0); + impl->hint_flags = fi->hint_flags; SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, fi->style); API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_NOTOPMOST, @@ -2753,7 +2756,6 @@ gdk_win32_window_unfullscreen (GdkWindow *window) g_object_set_data (G_OBJECT (window), "fullscreen-info", NULL); g_free (fi); - gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0); } }