summaryrefslogtreecommitdiff
path: root/gtk/gtkbutton.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2004-05-17 18:51:24 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-05-17 18:51:24 +0000
commita45553707461cf3381c74270b898e045071652ee (patch)
tree62f8f115bfab4af5fe6dd2bfcec4e43f0245605d /gtk/gtkbutton.c
parent478ea44a8680be050b47d2b0673d71cb11c4836a (diff)
downloadgdk-pixbuf-a45553707461cf3381c74270b898e045071652ee.tar.gz
Allocate space for the focus rectangle only if necessary. (#142668,
2004-05-17 Matthias Clasen <mclasen@redhat.com> * gtk/gtkbutton.c (gtk_button_size_request) (gtk_button_size_allocate, _gtk_button_paint): Allocate space for the focus rectangle only if necessary. (#142668, Michael Natterer)
Diffstat (limited to 'gtk/gtkbutton.c')
-rw-r--r--gtk/gtkbutton.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index f60fb6820..e049b8c6e 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -915,8 +915,11 @@ gtk_button_size_request (GtkWidget *widget,
requisition->height += child_requisition.height;
}
- requisition->width += 2 * (focus_width + focus_pad);
- requisition->height += 2 * (focus_width + focus_pad);
+ if (!interior_focus && GTK_WIDGET_CAN_FOCUS (widget))
+ {
+ requisition->width += 2 * (focus_width + focus_pad);
+ requisition->height += 2 * (focus_width + focus_pad);
+ }
}
static void
@@ -932,8 +935,9 @@ gtk_button_size_allocate (GtkWidget *widget,
GtkBorder default_border;
gint focus_width;
gint focus_pad;
+ gboolean interior_focus;
- gtk_button_get_props (button, &default_border, NULL, NULL);
+ gtk_button_get_props (button, &default_border, NULL, &interior_focus);
gtk_widget_style_get (GTK_WIDGET (widget),
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
@@ -966,11 +970,14 @@ gtk_button_size_allocate (GtkWidget *widget,
child_allocation.width = MAX (1, child_allocation.width - default_border.left - default_border.right);
child_allocation.height = MAX (1, child_allocation.height - default_border.top - default_border.bottom);
}
-
- child_allocation.x += focus_width + focus_pad;
- child_allocation.y += focus_width + focus_pad;
- child_allocation.width = MAX (1, child_allocation.width - (focus_width + focus_pad) * 2);
- child_allocation.height = MAX (1, child_allocation.height - (focus_width + focus_pad) * 2);
+
+ if (!interior_focus && GTK_WIDGET_CAN_FOCUS (widget))
+ {
+ child_allocation.x += focus_width + focus_pad;
+ child_allocation.y += focus_width + focus_pad;
+ child_allocation.width = MAX (1, child_allocation.width - (focus_width + focus_pad) * 2);
+ child_allocation.height = MAX (1, child_allocation.height - (focus_width + focus_pad) * 2);
+ }
if (button->depressed)
{
@@ -1044,7 +1051,7 @@ _gtk_button_paint (GtkButton *button,
height -= default_outside_border.top + default_outside_border.bottom;
}
- if (!interior_focus && GTK_WIDGET_HAS_FOCUS (widget))
+ if (!interior_focus && GTK_WIDGET_CAN_FOCUS (widget))
{
x += focus_width + focus_pad;
y += focus_width + focus_pad;