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.
This commit is contained in:
Matthias Clasen 2020-04-28 23:26:19 -04:00
parent b47e721ab6
commit 91d8c230f3

View File

@ -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),