From 6302384106e28b27c4c01e3dcf977a1e86476eea Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 13 Jun 2008 04:56:25 +0000 Subject: [PATCH] Fix frame size allocation svn path=/trunk/; revision=20368 --- ChangeLog | 5 +++++ gtk/gtkentry.c | 25 ++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index eb1ef4cb5e..1a50541dce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-13 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_draw_frame): Fix frame size allocation. + Patch by Jan Arne Peterson + 2008-06-12 Matthias Clasen Bug 537985 – gtk_init_with_args() doesn't open a display after diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 6011293b30..26c41466bc 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -47,6 +47,7 @@ #include "gtkseparatormenuitem.h" #include "gtkselection.h" #include "gtksettings.h" +#include "gtkspinbutton.h" #include "gtkstock.h" #include "gtktextutil.h" #include "gtkwindow.h" @@ -1558,16 +1559,22 @@ gtk_entry_draw_frame (GtkWidget *widget, GdkRectangle *area) { GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (widget); - gint x, y, width, height; - gint xborder, yborder; - - get_text_area_size (GTK_ENTRY (widget), &x, &y, &width, &height); - _gtk_entry_get_borders (GTK_ENTRY (widget), &xborder, &yborder); + gint x = 0, y = 0, width, height; - x -= xborder; - y -= yborder; - width += xborder * 2; - height += yborder * 2; + gdk_drawable_get_size (widget->window, &width, &height); + + /* Fix a problem with some themes which assume that entry->text_area's + * width equals widget->window's width */ + if (GTK_IS_SPIN_BUTTON (widget)) + { + gint xborder, yborder; + + get_text_area_size (GTK_ENTRY (widget), &x, NULL, &width, NULL); + _gtk_entry_get_borders (GTK_ENTRY (widget), &xborder, &yborder); + + x -= xborder; + width += xborder * 2; + } if (GTK_WIDGET_HAS_FOCUS (widget) && !priv->interior_focus) {