diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index c0b9d4343f..a8f54c19f1 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3584,13 +3584,11 @@ gtk_entry_get_text_area_size (GtkEntry *entry, { GtkWidget *widget = GTK_WIDGET (entry); GtkAllocation allocation; - GtkRequisition requisition; - gint req_height; + gint req_height, unused; gint frame_height; GtkBorder borders; - gtk_widget_get_preferred_size (widget, &requisition, NULL); - req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget); + gtk_entry_get_preferred_height_and_baseline_for_width (widget, -1, &req_height, &unused, NULL, NULL); gtk_widget_get_allocation (widget, &allocation); _gtk_entry_get_borders (entry, &borders); @@ -3640,16 +3638,11 @@ gtk_entry_get_frame_size (GtkEntry *entry, { GtkEntryPrivate *priv = entry->priv; GtkAllocation allocation; - GtkRequisition requisition; GtkWidget *widget = GTK_WIDGET (entry); - gint area_height, y_pos; gint baseline; - gint req_height; - GtkBorder borders; + gint req_height, req_baseline, unused; - gtk_widget_get_preferred_size (widget, &requisition, NULL); - - req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget); + 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); @@ -3666,12 +3659,7 @@ gtk_entry_get_frame_size (GtkEntry *entry, if (baseline == -1) *y = (allocation.height - req_height) / 2; else - { - _gtk_entry_get_borders (entry, &borders); - area_height = req_height - borders.top - borders.bottom; - y_pos = ((area_height * PANGO_SCALE - priv->ascent - priv->descent) / 2 + priv->ascent) / PANGO_SCALE; - *y = baseline - y_pos - borders.top; - } + *y = baseline - req_baseline; } *y += allocation.y; diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 6408abff72..2d8f98d76a 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -263,11 +263,6 @@ static void gtk_spin_button_get_text_area_size (GtkEntry *entry, gint *y, gint *width, gint *height); -static void gtk_spin_button_get_frame_size (GtkEntry *entry, - gint *x, - gint *y, - gint *width, - gint *height); static void gtk_spin_button_unset_adjustment (GtkSpinButton *spin_button); static void gtk_spin_button_set_orientation (GtkSpinButton *spin_button, GtkOrientation orientation); @@ -335,7 +330,6 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) entry_class->activate = gtk_spin_button_activate; entry_class->get_text_area_size = gtk_spin_button_get_text_area_size; - entry_class->get_frame_size = gtk_spin_button_get_frame_size; class->input = NULL; class->output = NULL; @@ -1858,32 +1852,6 @@ gtk_spin_button_activate (GtkEntry *entry) GTK_ENTRY_CLASS (gtk_spin_button_parent_class)->activate (entry); } -static void -gtk_spin_button_get_frame_size (GtkEntry *entry, - gint *x, - gint *y, - gint *width, - gint *height) -{ - GtkSpinButtonPrivate *priv = GTK_SPIN_BUTTON (entry)->priv; - gint up_panel_width, up_panel_height; - gint down_panel_width, down_panel_height; - - gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->up_panel, &up_panel_width, &up_panel_height); - gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->down_panel, &down_panel_width, &down_panel_height); - - GTK_ENTRY_CLASS (gtk_spin_button_parent_class)->get_frame_size (entry, x, y, width, height); - - if (priv->orientation == GTK_ORIENTATION_VERTICAL) - { - if (y) - *y += up_panel_height; - - if (height) - *height -= up_panel_height + down_panel_height; - } -} - static void gtk_spin_button_get_text_area_size (GtkEntry *entry, gint *x,