From: Luca Bacci Date: Tue, 22 Feb 2022 08:15:28 +0000 (+0100) Subject: GdkWin32: Configure as needed when going fullscreen X-Git-Tag: archive/raspbian/4.8.3+ds-2+rpi1~3^2~20^2~4^2~356^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ab65e8e1789d1cda674a948fac607a7e2602fff5;p=gtk4.git GdkWin32: Configure as needed when going fullscreen Apply the fixes made by Chun-Wei Fan in [1] also for fullscreening / unfullscreen. Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4631 Also set the SWP_FRAMECHANGED flag as written by Raymond Chen in "How do I switch a window between normal and fullscreen?" [2] > An important flag to pass here is SWP_FRAME­CHANGED, which tells > the window manager to recalculate the window decorations (which we > need it to do because we just changed them). References: [1] - https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3712 [2] - https://devblogs.microsoft.com/oldnewthing/20100412-00/?p=14353 --- diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index d7582df0d4..938737e86b 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -4152,6 +4152,9 @@ gdk_win32_surface_fullscreen (GdkSurface *window) g_object_set_data (G_OBJECT (window), "fullscreen-info", fi); fi->style = GetWindowLong (GDK_SURFACE_HWND (window), GWL_STYLE); + impl->inhibit_configure = TRUE; + impl->force_recompute_size = FALSE; + /* Send state change before configure event */ gdk_synthesize_surface_state (window, 0, GDK_TOPLEVEL_STATE_FULLSCREEN); @@ -4160,7 +4163,7 @@ gdk_win32_surface_fullscreen (GdkSurface *window) API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), HWND_TOP, x, y, width, height, - SWP_NOCOPYBITS | SWP_SHOWWINDOW)); + SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED)); } } @@ -4184,11 +4187,17 @@ gdk_win32_surface_unfullscreen (GdkSurface *window) API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), HWND_NOTOPMOST, fi->r.left, fi->r.top, fi->r.right - fi->r.left, fi->r.bottom - fi->r.top, - SWP_NOCOPYBITS | SWP_SHOWWINDOW)); + SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED)); g_object_set_data (G_OBJECT (window), "fullscreen-info", NULL); g_free (fi); _gdk_win32_surface_update_style_bits (window); + + if (impl->inhibit_configure) + { + impl->inhibit_configure = FALSE; + impl->force_recompute_size = TRUE; + } } }