[gtk/popup-positioning-fix] popover: Fix repositioning logic



commit 91d8c230f3460b0943990f23cc42b65ee05f1c8f
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 28 23:26:19 2020 -0400

    popover: Fix repositioning logic
    
    When the arrow changes position, we need to queue
    an allocation to ensure that gtk_widget_allocate
    actually calls our ->size_allocate vfunc.

 gtk/gtkpopover.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 7de2713771..70a15ea3d9 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -357,6 +357,7 @@ update_popover_layout (GtkPopover     *popover,
   gboolean flipped_x;
   gboolean flipped_y;
   GdkPopup *popup = GDK_POPUP (priv->surface);
+  GtkPositionType position;
 
   g_clear_pointer (&priv->layout, gdk_popup_layout_unref);
   priv->layout = layout;
@@ -381,6 +382,8 @@ update_popover_layout (GtkPopover     *popover,
 
   priv->final_rect = final_rect;
 
+  position = priv->final_position;
+
   switch (priv->position)
     {
     case GTK_POS_LEFT:
@@ -400,6 +403,9 @@ update_popover_layout (GtkPopover     *popover,
       break;
     }
 
+  if (priv->final_position != position)
+    gtk_widget_queue_allocate (GTK_WIDGET (popover));
+
   gtk_widget_allocate (GTK_WIDGET (popover),
                        gdk_surface_get_width (priv->surface),
                        gdk_surface_get_height (priv->surface),


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