From e5f1ff6a4d32f213c3bc5a767f8ee6f8ec5144e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 25 Oct 2019 10:36:29 +0200 Subject: [PATCH] popover: Use a bin layout for the contents gizmo --- gtk/gtkpopover.c | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 8b04947712..91e23d4b3d 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -113,6 +113,7 @@ #include "gtkeventcontrollerkey.h" #include "gtkcssnodeprivate.h" #include "gtkbindings.h" +#include "gtkbinlayout.h" #include "gtkenums.h" #include "gtktypebuiltins.h" #include "gtkmnemonichash.h" @@ -504,39 +505,6 @@ surface_moved_to_rect (GdkSurface *surface, } } -static void -measure_contents (GtkGizmo *gizmo, - GtkOrientation orientation, - int for_size, - int *minimum, - int *natural, - int *minimum_baseline, - int *natural_baseline) -{ - GtkPopover *popover = GTK_POPOVER (gtk_widget_get_parent (GTK_WIDGET (gizmo))); - GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover)); - - if (child) - gtk_widget_measure (child, orientation, for_size, - minimum, natural, - minimum_baseline, natural_baseline); -} - -static void -allocate_contents (GtkGizmo *gizmo, - int width, - int height, - int baseline) -{ - GtkPopover *popover = GTK_POPOVER (gtk_widget_get_parent (GTK_WIDGET (gizmo))); - GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover)); - - if (child) - gtk_widget_size_allocate (child, - &(GtkAllocation) { 0, 0, width, height - }, -1); -} - static void gtk_popover_activate_default (GtkPopover *popover) { @@ -622,11 +590,8 @@ gtk_popover_init (GtkPopover *popover) G_CALLBACK (node_style_changed_cb), popover, 0); g_object_unref (priv->arrow_node); - priv->contents_widget = gtk_gizmo_new ("contents", - measure_contents, - allocate_contents, - NULL, - NULL); + priv->contents_widget = gtk_gizmo_new ("contents", NULL, NULL, NULL, NULL); + gtk_widget_set_layout_manager (priv->contents_widget, gtk_bin_layout_new ()); gtk_widget_set_parent (priv->contents_widget, GTK_WIDGET (popover)); context = gtk_widget_get_style_context (GTK_WIDGET (popover));