[gtk+] entry: Move code
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] entry: Move code
- Date: Mon, 25 Jan 2016 14:52:12 +0000 (UTC)
commit 02fab14b3bd8aa2bb34e0945c783276e85a6f098
Author: Benjamin Otte <otte redhat com>
Date: Mon Jan 25 15:04:04 2016 +0100
entry: Move code
This movement is necessary for future gadgetization of GtkSpinButton.
gtk/gtkentry.c | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index a8e12c6..f4335eb 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]