summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-09-21 18:35:16 +0200
committerBenjamin Otte <otte@redhat.com>2015-10-28 19:44:26 +0100
commit624fb8b3603455e3b65263374bc8515bbded481a (patch)
tree5b4e792880fe9954e42ab04c2667874a5c9e87a7
parent8ec2362d81db40e5587cd269eb932d15d381b6d1 (diff)
downloadgtk+-624fb8b3603455e3b65263374bc8515bbded481a.tar.gz
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.
-rw-r--r--gtk/gtkcombobox.c5
-rw-r--r--gtk/gtkentry.c49
-rw-r--r--gtk/gtkentryprivate.h2
3 files changed, 2 insertions, 54 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index c9962badce..39339e0948 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 7709036fbc..8e058961f5 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -233,7 +233,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;
@@ -2670,7 +2669,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;
@@ -3611,45 +3609,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
@@ -5284,11 +5262,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",
@@ -10996,24 +10969,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 6d85d87739..fbc0efccdb 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);