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)
This commit is contained in:
Matthias Clasen 2004-05-17 18:51:24 +00:00 committed by Matthias Clasen
parent 478ea44a86
commit a455537074
5 changed files with 52 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2004-05-17 Matthias Clasen <mclasen@redhat.com>
Mreged from 2.4:
* 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)
Sun May 16 23:11:47 2004 Matthias Clasen <maclas@gmx.de> Sun May 16 23:11:47 2004 Matthias Clasen <maclas@gmx.de>
Merged from 2.4: Merged from 2.4:

View File

@ -1,3 +1,12 @@
2004-05-17 Matthias Clasen <mclasen@redhat.com>
Mreged from 2.4:
* 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)
Sun May 16 23:11:47 2004 Matthias Clasen <maclas@gmx.de> Sun May 16 23:11:47 2004 Matthias Clasen <maclas@gmx.de>
Merged from 2.4: Merged from 2.4:

View File

@ -1,3 +1,12 @@
2004-05-17 Matthias Clasen <mclasen@redhat.com>
Mreged from 2.4:
* 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)
Sun May 16 23:11:47 2004 Matthias Clasen <maclas@gmx.de> Sun May 16 23:11:47 2004 Matthias Clasen <maclas@gmx.de>
Merged from 2.4: Merged from 2.4:

View File

@ -1,3 +1,12 @@
2004-05-17 Matthias Clasen <mclasen@redhat.com>
Mreged from 2.4:
* 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)
Sun May 16 23:11:47 2004 Matthias Clasen <maclas@gmx.de> Sun May 16 23:11:47 2004 Matthias Clasen <maclas@gmx.de>
Merged from 2.4: Merged from 2.4:

View File

@ -915,9 +915,12 @@ gtk_button_size_request (GtkWidget *widget,
requisition->height += child_requisition.height; requisition->height += child_requisition.height;
} }
if (!interior_focus && GTK_WIDGET_CAN_FOCUS (widget))
{
requisition->width += 2 * (focus_width + focus_pad); requisition->width += 2 * (focus_width + focus_pad);
requisition->height += 2 * (focus_width + focus_pad); requisition->height += 2 * (focus_width + focus_pad);
} }
}
static void static void
gtk_button_size_allocate (GtkWidget *widget, gtk_button_size_allocate (GtkWidget *widget,
@ -932,8 +935,9 @@ gtk_button_size_allocate (GtkWidget *widget,
GtkBorder default_border; GtkBorder default_border;
gint focus_width; gint focus_width;
gint focus_pad; 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), gtk_widget_style_get (GTK_WIDGET (widget),
"focus-line-width", &focus_width, "focus-line-width", &focus_width,
"focus-padding", &focus_pad, "focus-padding", &focus_pad,
@ -967,10 +971,13 @@ gtk_button_size_allocate (GtkWidget *widget,
child_allocation.height = MAX (1, child_allocation.height - default_border.top - default_border.bottom); child_allocation.height = MAX (1, child_allocation.height - default_border.top - default_border.bottom);
} }
if (!interior_focus && GTK_WIDGET_CAN_FOCUS (widget))
{
child_allocation.x += focus_width + focus_pad; child_allocation.x += focus_width + focus_pad;
child_allocation.y += 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.width = MAX (1, child_allocation.width - (focus_width + focus_pad) * 2);
child_allocation.height = MAX (1, child_allocation.height - (focus_width + focus_pad) * 2); child_allocation.height = MAX (1, child_allocation.height - (focus_width + focus_pad) * 2);
}
if (button->depressed) if (button->depressed)
{ {
@ -1044,7 +1051,7 @@ _gtk_button_paint (GtkButton *button,
height -= default_outside_border.top + default_outside_border.bottom; 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; x += focus_width + focus_pad;
y += focus_width + focus_pad; y += focus_width + focus_pad;