From e1431f31c18d185fe1021a6bda0b0080573bbf07 Mon Sep 17 00:00:00 2001 From: Mat Date: Sun, 19 May 2024 23:29:39 +0300 Subject: [PATCH] macos: Take shadows into account when positioning popups Otherwise popups will be misaligned. This becomes noticeable when larger shadows are used, like in libadwaita. Regression in 08216dcee949f5a7762290dfc9121609b156f5cb --- gdk/macos/gdkmacospopupsurface.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gdk/macos/gdkmacospopupsurface.c b/gdk/macos/gdkmacospopupsurface.c index ba84e57297..033d6ed2f2 100644 --- a/gdk/macos/gdkmacospopupsurface.c +++ b/gdk/macos/gdkmacospopupsurface.c @@ -52,6 +52,7 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self, GdkRectangle bounds; GdkRectangle final_rect; int x, y; + int shadow_left, shadow_right, shadow_top, shadow_bottom; g_assert (GDK_IS_MACOS_POPUP_SURFACE (self)); g_assert (layout != NULL); @@ -68,10 +69,19 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self, monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self)); gdk_macos_monitor_get_workarea (monitor, &bounds); + gdk_popup_layout_get_shadow_width (layout, + &shadow_left, + &shadow_right, + &shadow_top, + &shadow_bottom); + gdk_surface_layout_popup_helper (GDK_SURFACE (self), width, height, - 0, 0, 0, 0, /* shadow-left/right/top/bottom */ + shadow_left, + shadow_right, + shadow_top, + shadow_bottom, monitor, &bounds, self->layout,