From: dgsasha Date: Tue, 30 May 2023 00:11:44 +0000 (-0400) Subject: win32: Center newly created transient windows X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~153^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=84840f1f2e24135bb31b01c6c9e62c2901639ecb;p=gtk4.git win32: Center newly created transient windows Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5407 --- diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index df4cf37f9a..25ee928998 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -725,11 +725,7 @@ show_window_internal (GdkSurface *window, if (center) { - window_rect.left = 0; - window_rect.top = 0; - window_rect.right = window->width * surface->surface_scale; - window_rect.bottom = window->height * surface->surface_scale; - _gdk_win32_adjust_client_rect (window, &window_rect); + GetWindowRect (GDK_SURFACE_HWND (window), &window_rect); x = center_on_rect.left + ((center_on_rect.right - center_on_rect.left) - (window_rect.right - window_rect.left)) / 2; y = center_on_rect.top + ((center_on_rect.bottom - center_on_rect.top) - (window_rect.bottom - window_rect.top)) / 2;