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:
committed by
Matthias Clasen
parent
52297a75b8
commit
6f73a63532
@ -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>
|
2007-01-02 Michael Emmel <mike.emmel@gmail.com>
|
||||||
|
|
||||||
* gdkwindow-directfb.c: fixed leak of dfb resource on destroy
|
* gdkwindow-directfb.c: fixed leak of dfb resource on destroy
|
||||||
|
|||||||
@ -1377,10 +1377,23 @@ get_text_area_size (GtkEntry *entry,
|
|||||||
gint *width,
|
gint *width,
|
||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
|
gint frame_height;
|
||||||
gint xborder, yborder;
|
gint xborder, yborder;
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
GtkWidget *widget = GTK_WIDGET (entry);
|
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_widget_get_child_requisition (widget, &requisition);
|
||||||
|
|
||||||
_gtk_entry_get_borders (entry, &xborder, &yborder);
|
_gtk_entry_get_borders (entry, &xborder, &yborder);
|
||||||
@ -1389,8 +1402,8 @@ get_text_area_size (GtkEntry *entry,
|
|||||||
*x = xborder;
|
*x = xborder;
|
||||||
|
|
||||||
if (y)
|
if (y)
|
||||||
*y = yborder;
|
*y = frame_height / 2 - (requisition.height - yborder * 2) / 2;
|
||||||
|
|
||||||
if (width)
|
if (width)
|
||||||
*width = GTK_WIDGET (entry)->allocation.width - xborder * 2;
|
*width = GTK_WIDGET (entry)->allocation.width - xborder * 2;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user