summaryrefslogtreecommitdiff
path: root/gtk/gtkbutton.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-12-20 13:15:13 +0100
committerCosimo Cecchi <cosimoc@gnome.org>2011-12-20 19:01:38 +0100
commit0021ef19fad074ef11ceedaaf6a028c294d0b435 (patch)
tree68252a9907de74c729d34bc5d66db1b03e41796f /gtk/gtkbutton.c
parentfe59c5f954caf07dba480c87b041d6a731ad0709 (diff)
downloadgtk+-0021ef19fad074ef11ceedaaf6a028c294d0b435.tar.gz
button: add CSS borders to the size request
And allocate the button children according to it as well. https://bugzilla.gnome.org/show_bug.cgi?id=666600
Diffstat (limited to 'gtk/gtkbutton.c')
-rw-r--r--gtk/gtkbutton.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 1e1ee17c11..849fb9994e 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1483,12 +1483,14 @@ gtk_button_size_allocate (GtkWidget *widget,
GtkBorder default_border;
GtkBorder inner_border;
GtkBorder padding;
+ GtkBorder border;
gint focus_width;
gint focus_pad;
context = gtk_widget_get_style_context (widget);
- gtk_button_get_props (button, &default_border, NULL, &inner_border, &padding, NULL, NULL);
+ gtk_button_get_props (button, &default_border, NULL, &inner_border,
+ &padding, &border, NULL);
gtk_style_context_get_style (context,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
@@ -1506,20 +1508,20 @@ gtk_button_size_allocate (GtkWidget *widget,
child = gtk_bin_get_child (GTK_BIN (button));
if (child && gtk_widget_get_visible (child))
{
- child_allocation.x = allocation->x + inner_border.left + padding.left;
- child_allocation.y = allocation->y + inner_border.top + padding.top;
+ child_allocation.x = allocation->x + inner_border.left + padding.left + border.left;
+ child_allocation.y = allocation->y + inner_border.top + padding.top + border.top;
child_allocation.width =
allocation->width -
(padding.left + padding.right) -
- inner_border.left -
- inner_border.right;
+ (border.left + border.right) -
+ (inner_border.left + inner_border.right);
child_allocation.height =
allocation->height -
(padding.top + padding.bottom) -
- inner_border.top -
- inner_border.bottom;
+ (border.top + border.bottom) -
+ (inner_border.top + inner_border.bottom);
if (gtk_widget_get_can_default (GTK_WIDGET (button)))
{
@@ -1930,13 +1932,15 @@ gtk_button_get_size (GtkWidget *widget,
GtkBorder default_border;
GtkBorder inner_border;
GtkBorder padding;
+ GtkBorder border;
gint focus_width;
gint focus_pad;
gint minimum, natural;
context = gtk_widget_get_style_context (widget);
- gtk_button_get_props (button, &default_border, NULL, &inner_border, &padding, NULL, NULL);
+ gtk_button_get_props (button, &default_border, NULL, &inner_border,
+ &padding, &border, NULL);
gtk_style_context_get_style (context,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
@@ -1944,14 +1948,18 @@ gtk_button_get_size (GtkWidget *widget,
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- minimum = inner_border.left + inner_border.right + padding.left + padding.right;
+ minimum = inner_border.left + inner_border.right +
+ padding.left + padding.right +
+ border.left + border.right;
if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
minimum += default_border.left + default_border.right;
}
else
{
- minimum = inner_border.top + inner_border.bottom + padding.top + padding.bottom;
+ minimum = inner_border.top + inner_border.bottom +
+ padding.top + padding.bottom +
+ border.top + border.bottom;
if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
minimum += default_border.top + default_border.bottom;