[gtk+/wip/otte/queue-resize: 1/33] entry: Always render like with is_cellrenderer



commit 79f6bb4fc2dfddf00713884679b35398700523a1
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 21 18:35:16 2015 +0200

    entry: Always render like with is_cellrenderer
    
    And remove the API to set that variable.
    If you want the entry to not fill its whole allocated area,
      gtk_widget_set_valign (entry, GTK_ALIGN_FILL);
    will give you the old behavior.

 gtk/gtkcombobox.c     |    5 -----
 gtk/gtkentry.c        |   49 ++-----------------------------------------------
 gtk/gtkentryprivate.h |    2 --
 3 files changed, 2 insertions(+), 54 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index c9962ba..39339e0 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1490,10 +1490,6 @@ gtk_combo_box_add (GtkContainer *container,
 
   if (priv->has_entry)
     {
-      /* this flag is a hack to tell the entry to fill its allocation.
-       */
-      _gtk_entry_set_is_cell_renderer (GTK_ENTRY (widget), TRUE);
-
       g_signal_connect (widget, "changed",
                         G_CALLBACK (gtk_combo_box_entry_contents_changed),
                         combo_box);
@@ -1521,7 +1517,6 @@ gtk_combo_box_remove (GtkContainer *container,
           g_signal_handlers_disconnect_by_func (widget,
                                                 gtk_combo_box_entry_contents_changed,
                                                 container);
-          _gtk_entry_set_is_cell_renderer (GTK_ENTRY (widget), FALSE);
         }
     }
 
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index ea0bd61..7ac4a83 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -218,7 +218,6 @@ struct _GtkEntryPrivate
   guint         cursor_visible          : 1;
   guint         editing_canceled        : 1; /* Only used by GtkCellRendererText */
   guint         in_click                : 1; /* Flag so we don't select all when clicking in entry to focus 
in */
-  guint         is_cell_renderer        : 1;
   guint         invisible_char_set      : 1;
   guint         mouse_cursor_obscured   : 1;
   guint         need_im_reset           : 1;
@@ -2654,7 +2653,6 @@ gtk_entry_init (GtkEntry *entry)
   priv->dnd_position = -1;
   priv->width_chars = -1;
   priv->max_width_chars = -1;
-  priv->is_cell_renderer = FALSE;
   priv->editing_canceled = FALSE;
   priv->truncate_multiline = FALSE;
   priv->shadow_type = GTK_SHADOW_IN;
@@ -3588,45 +3586,25 @@ gtk_entry_get_frame_size (GtkEntry *entry,
                           gint     *width,
                           gint     *height)
 {
-  GtkEntryPrivate *priv = entry->priv;
   GtkAllocation allocation;
   GtkWidget *widget = GTK_WIDGET (entry);
-  gint baseline;
   gint req_height, req_baseline, unused;
 
   gtk_entry_get_preferred_height_and_baseline_for_width (widget, -1, &req_height, &unused, &req_baseline, 
&unused);
 
   gtk_widget_get_allocation (widget, &allocation);
-  baseline = gtk_widget_get_allocated_baseline (widget);
 
   if (x)
     *x = allocation.x;
 
   if (y)
-    {
-      if (priv->is_cell_renderer)
-        *y = 0;
-      else
-        {
-          if (baseline == -1)
-            *y = (allocation.height - req_height) / 2;
-          else
-            *y = baseline - req_baseline;
-        }
-
-      *y += allocation.y;
-    }
+    *y = allocation.y;
 
   if (width)
     *width = allocation.width;
 
   if (height)
-    {
-      if (priv->is_cell_renderer)
-        *height = allocation.height;
-      else
-        *height = req_height;
-    }
+    *height = allocation.height;
 }
 
 static void
@@ -5260,11 +5238,6 @@ static void
 gtk_entry_start_editing (GtkCellEditable *cell_editable,
                         GdkEvent        *event)
 {
-  GtkEntry *entry = GTK_ENTRY (cell_editable);
-  GtkEntryPrivate *priv = entry->priv;
-
-  priv->is_cell_renderer = TRUE;
-
   g_signal_connect (cell_editable, "activate",
                    G_CALLBACK (gtk_cell_editable_entry_activated), NULL);
   g_signal_connect (cell_editable, "key-press-event",
@@ -10938,24 +10911,6 @@ keymap_state_changed (GdkKeymap *keymap,
     remove_capslock_feedback (entry);
 }
 
-/*
- * _gtk_entry_set_is_cell_renderer:
- * @entry: a #GtkEntry
- * @is_cell_renderer: new value
- *
- * This is a helper function for GtkComboBox. A GtkEntry in a GtkComboBox
- * is supposed to behave like a GtkCellEditable when placed in a combo box.
- *
- * I.e take up its allocation and get GtkEntry->is_cell_renderer = TRUE.
- *
- */
-void
-_gtk_entry_set_is_cell_renderer (GtkEntry *entry,
-                                 gboolean  is_cell_renderer)
-{
-  entry->priv->is_cell_renderer = is_cell_renderer;
-}
-
 /**
  * gtk_entry_set_input_purpose:
  * @entry: a #GtkEntry
diff --git a/gtk/gtkentryprivate.h b/gtk/gtkentryprivate.h
index 6d85d87..fbc0efc 100644
--- a/gtk/gtkentryprivate.h
+++ b/gtk/gtkentryprivate.h
@@ -86,8 +86,6 @@ gchar*   _gtk_entry_get_display_text       (GtkEntry *entry,
 void     _gtk_entry_get_borders            (GtkEntry  *entry,
                                             GtkBorder *borders);
 GtkIMContext* _gtk_entry_get_im_context    (GtkEntry  *entry);
-void     _gtk_entry_set_is_cell_renderer   (GtkEntry  *entry,
-                                            gboolean   is_cell_renderer);
 void     _gtk_entry_grab_focus             (GtkEntry  *entry,
                                             gboolean   select_all);
 


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