[gtk/wip/chergert/for-main: 1/6] macos: move popup surfaces when toplevel changes monitors
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/for-main: 1/6] macos: move popup surfaces when toplevel changes monitors
- Date: Tue, 1 Mar 2022 09:16:34 +0000 (UTC)
commit a1f79f27809394068666b040277854933eea43a6
Author: Christian Hergert <christian hergert me>
Date: Tue Mar 1 00:04:37 2022 -0800
macos: move popup surfaces when toplevel changes monitors
This just helps ensure we are moving the popover as soon as we can to be
in the right position.
gdk/macos/gdkmacossurface.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 5da25f2da1..128ca91b77 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -1172,15 +1172,21 @@ _gdk_macos_surface_monitor_changed (GdkMacosSurface *self)
iter = iter->next)
{
GdkMacosSurface *child = iter->data;
-
- if (!GDK_IS_POPUP (child))
- continue;
+ GdkRectangle area;
g_set_object (&child->best_monitor, best);
- _gdk_macos_surface_move (child,
- self->root_x + GDK_SURFACE (child)->x,
- self->root_y + GDK_SURFACE (child)->y);
+ area.x = self->root_x + GDK_SURFACE (child)->x + child->shadow_left;
+ area.y = self->root_y + GDK_SURFACE (child)->y + child->shadow_top;
+ area.width = GDK_SURFACE (child)->width - child->shadow_left - child->shadow_right;
+ area.height = GDK_SURFACE (child)->height - child->shadow_top - child->shadow_bottom;
+
+ _gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (best), &area);
+
+ area.x -= child->shadow_left;
+ area.y -= child->shadow_top;
+
+ _gdk_macos_surface_move (child, area.x, area.y);
gdk_surface_invalidate_rect (GDK_SURFACE (child), NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]