Center in the frame. (#304482, Rob Staudinger, patch by Richard

2007-01-02  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkentry.c (get_text_area_size): Center in the frame.
        (#304482, Rob Staudinger, patch by  Richard Stellingwerff)



svn path=/trunk/; revision=17015
This commit is contained in:
Matthias Clasen 2007-01-02 14:23:33 +00:00 committed by Matthias Clasen
parent 52297a75b8
commit 6f73a63532
2 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2007-01-02 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentry.c (get_text_area_size): Center in the frame.
(#304482, Rob Staudinger, patch by Richard Stellingwerff)
2007-01-02 Michael Emmel <mike.emmel@gmail.com>
* gdkwindow-directfb.c: fixed leak of dfb resource on destroy

View File

@ -1377,10 +1377,23 @@ get_text_area_size (GtkEntry *entry,
gint *width,
gint *height)
{
gint frame_height;
gint xborder, yborder;
GtkRequisition requisition;
GtkWidget *widget = GTK_WIDGET (entry);
gboolean interior_focus;
gint focus_width;
gtk_widget_style_get (widget,
"interior-focus", &interior_focus,
"focus-line-width", &focus_width,
NULL);
gdk_drawable_get_size (widget->window, NULL, &frame_height);
if (GTK_WIDGET_HAS_FOCUS (widget) && !interior_focus)
height -= 2 * focus_width;
gtk_widget_get_child_requisition (widget, &requisition);
_gtk_entry_get_borders (entry, &xborder, &yborder);
@ -1389,8 +1402,8 @@ get_text_area_size (GtkEntry *entry,
*x = xborder;
if (y)
*y = yborder;
*y = frame_height / 2 - (requisition.height - yborder * 2) / 2;
if (width)
*width = GTK_WIDGET (entry)->allocation.width - xborder * 2;