[gtk/wip/chergert/quartz4u] macos: emit popup layout change signal



commit 5d76c60aec5f7ef8d4c024ca48461242cf20baf5
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 18 15:19:20 2020 -0700

    macos: emit popup layout change signal

 gdk/macos/gdkmacospopupsurface.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gdk/macos/gdkmacospopupsurface.c b/gdk/macos/gdkmacospopupsurface.c
index 3ad930ba1d..bae0fe9bff 100644
--- a/gdk/macos/gdkmacospopupsurface.c
+++ b/gdk/macos/gdkmacospopupsurface.c
@@ -31,6 +31,7 @@
 struct _GdkMacosPopupSurface
 {
   GdkMacosSurface parent_instance;
+  guint did_initial_present : 1;
 };
 
 struct _GdkMacosPopupSurfaceClass
@@ -69,8 +70,16 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
                                     y,
                                     final_rect.width,
                                     final_rect.height);
-  else
+  else if (x != GDK_SURFACE (self)->x ||
+           y != GDK_SURFACE (self)->y)
     _gdk_macos_surface_move (GDK_MACOS_SURFACE (self), x, y);
+  else
+    return;
+
+  if (self->did_initial_present)
+    g_signal_emit_by_name (self, "popup-layout-changed");
+
+  gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
 }
 
 static void
@@ -103,6 +112,8 @@ gdk_macos_popup_surface_present (GdkPopup       *popup,
 
   gdk_macos_popup_surface_layout (self, width, height, layout);
 
+  self->did_initial_present = TRUE;
+
   if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self)))
     return TRUE;
 


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