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
This commit is contained in:
Alexander Larsson 2011-10-26 10:21:10 +02:00
parent 8f50944904
commit ab615105b6
2 changed files with 35 additions and 33 deletions

View File

@ -2738,36 +2738,6 @@ gdk_event_translate (MSG *msg,
_gdk_win32_append_event (event); _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 */ /* Update window state */
if (windowpos->flags & (SWP_STATECHANGED | SWP_SHOWWINDOW | SWP_HIDEWINDOW)) if (windowpos->flags & (SWP_STATECHANGED | SWP_SHOWWINDOW | SWP_HIDEWINDOW))
{ {
@ -2813,6 +2783,36 @@ gdk_event_translate (MSG *msg,
ensure_stacking_on_unminimize (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 (!(windowpos->flags & SWP_NOCLIENTSIZE))
{ {
if (window->resize_count > 1) if (window->resize_count > 1)

View File

@ -2720,14 +2720,15 @@ gdk_win32_window_fullscreen (GdkWindow *window)
g_object_set_data (G_OBJECT (window), "fullscreen-info", fi); g_object_set_data (G_OBJECT (window), "fullscreen-info", fi);
fi->style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE); 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, SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE,
(fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP); (fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP);
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP, API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
x, y, width, height, x, y, width, height,
SWP_NOCOPYBITS | SWP_SHOWWINDOW)); 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); GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
impl->hint_flags = fi->hint_flags; impl->hint_flags = fi->hint_flags;
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, fi->style); SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, fi->style);
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_NOTOPMOST, 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_object_set_data (G_OBJECT (window), "fullscreen-info", NULL);
g_free (fi); g_free (fi);
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
} }
} }