[gtk/wip/chergert/quartz4u: 104/146] macos: update popup when parent surface moves/resizes



commit 53e3491b463e294a8a44abb5e370b40f4997f8d1
Author: Christian Hergert <chergert redhat com>
Date:   Wed May 20 17:22:18 2020 -0700

    macos: update popup when parent surface moves/resizes

 gdk/macos/gdkmacossurface-private.h |  1 +
 gdk/macos/gdkmacossurface.c         | 21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/gdk/macos/gdkmacossurface-private.h b/gdk/macos/gdkmacossurface-private.h
index 2a6e2589b4..aa0ebbffc4 100644
--- a/gdk/macos/gdkmacossurface-private.h
+++ b/gdk/macos/gdkmacossurface-private.h
@@ -121,6 +121,7 @@ gboolean           _gdk_macos_surface_is_tracking             (GdkMacosSurface
                                                                NSTrackingArea     *area);
 void               _gdk_macos_surface_monitor_changed         (GdkMacosSurface    *self);
 GdkMonitor        *_gdk_macos_surface_get_best_monitor        (GdkMacosSurface    *self);
+void               _gdk_macos_surface_reposition_children     (GdkMacosSurface    *self);
 
 G_END_DECLS
 
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 3aec88dc91..52f0e6b096 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -57,6 +57,24 @@ window_is_fullscreen (GdkMacosSurface *self)
   return ([self->window styleMask] & NSWindowStyleMaskFullScreen) != 0;
 }
 
+void
+_gdk_macos_surface_reposition_children (GdkMacosSurface *self)
+{
+  g_assert (GDK_IS_MACOS_SURFACE (self));
+
+  for (const GList *iter = GDK_SURFACE (self)->children;
+       iter != NULL;
+       iter = iter->next)
+    {
+      GdkMacosSurface *child = iter->data;
+
+      g_assert (GDK_IS_MACOS_SURFACE (child));
+
+      if (GDK_IS_MACOS_POPUP_SURFACE (child))
+        _gdk_macos_popup_surface_reposition (GDK_MACOS_POPUP_SURFACE (child));
+    }
+}
+
 static void
 gdk_macos_surface_set_input_region (GdkSurface     *surface,
                                     cairo_region_t *region)
@@ -623,8 +641,7 @@ _gdk_macos_surface_update_position (GdkMacosSurface *self)
       surface->y = self->root_y;
     }
 
-  if (GDK_IS_POPUP (self) && self->did_initial_present)
-    g_signal_emit_by_name (self, "popup-layout-changed");
+  _gdk_macos_surface_reposition_children (self);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]