From 02fab14b3bd8aa2bb34e0945c783276e85a6f098 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 25 Jan 2016 15:04:04 +0100 Subject: [PATCH] entry: Move code This movement is necessary for future gadgetization of GtkSpinButton. --- gtk/gtkentry.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index a8e12c657f..f4335eb262 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3698,29 +3698,16 @@ static void gtk_entry_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkEntry *entry = GTK_ENTRY (widget); GdkRectangle clip; gtk_widget_set_allocation (widget, allocation); - gtk_css_gadget_allocate (entry->priv->gadget, + gtk_css_gadget_allocate (GTK_ENTRY (widget)->priv->gadget, allocation, gtk_widget_get_allocated_baseline (widget), &clip); gtk_widget_set_clip (widget, &clip); - - if (gtk_widget_get_realized (widget)) - { - GtkEntryCompletion *completion; - - place_windows (entry); - gtk_entry_recompute (entry); - - completion = gtk_entry_get_completion (entry); - if (completion) - _gtk_entry_completion_resize_popup (completion); - } } static void @@ -3730,12 +3717,14 @@ gtk_entry_allocate (GtkCssGadget *gadget, GtkAllocation *out_clip, gpointer data) { + GtkEntry *entry; GtkWidget *widget; GtkEntryPrivate *priv; gint i; widget = gtk_css_gadget_get_owner (gadget); - priv = GTK_ENTRY (widget)->priv; + entry = GTK_ENTRY (widget); + priv = entry->priv; priv->text_allocation = *allocation; @@ -3787,6 +3776,21 @@ gtk_entry_allocate (GtkCssGadget *gadget, gdk_rectangle_union (out_clip, &clip, out_clip); } + + /* Do this here instead of gtk_entry_size_allocate() so it works + * inside spinbuttons, which don't chain up. + */ + if (gtk_widget_get_realized (widget)) + { + GtkEntryCompletion *completion; + + place_windows (entry); + gtk_entry_recompute (entry); + + completion = gtk_entry_get_completion (entry); + if (completion) + _gtk_entry_completion_resize_popup (completion); + } } static gboolean