From: G.Willems Date: Tue, 19 Sep 2023 18:29:04 +0000 (+0200) Subject: GdkWin32: ignore invalid client rects X-Git-Tag: archive/raspbian/4.12.4+ds-3+rpi1^2~21^2^2~26^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c69e19c9c50dec167af9a8dda61f118cd87b0a32;p=gtk4.git GdkWin32: ignore invalid client rects Gdk-Win32 uses GetClientRect() internally to query the surfaces coordinates, but this API may fail in some transient contexts (observed when iconifying a maximized window). Check if the rect area is null, and don't update the surface position in that case. This will keep the current surface size, until Win32 notifies the new valid window state later. This prevents using a nulled next_layout for toplevel size computation, which would break widgets allocation once notified on gtk side. Fixes #5724 Closes #5724 --- diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index a41b3e3576..8c32ad224f 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -4442,6 +4442,10 @@ _gdk_win32_surface_request_layout (GdkSurface *surface) { _gdk_win32_get_window_rect (surface, &rect); + /* Keep current position if rect is invalid (i.e. queried in bad context) */ + if (rect.right == rect.left || rect.bottom == rect.top) + return; + impl->next_layout.configured_width = (rect.right - rect.left + scale - 1) / scale; impl->next_layout.configured_height = (rect.bottom - rect.top + scale - 1) / scale;