[gtk/wip/chergert/for-main] 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] macos: move popup surfaces when toplevel changes monitors
- Date: Tue, 1 Mar 2022 08:07:10 +0000 (UTC)
commit f7be598c840fab92c3e8a533d40c72e093a7a10a
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 27e9cd9cba..f05abb91a0 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -1175,15 +1175,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]