[Xfce4-commits] <xfce4-panel:nick/gtk3> ArrowButton: better handling of minimum sizes.
Andrzej
noreply at xfce.org
Wed Apr 17 22:16:06 CEST 2013
Updating branch refs/heads/nick/gtk3
to ecffe289ffb0a4718589e58184af452c9792a667 (commit)
from ef2daa326f8cadb648c6827c719386eea0b54433 (commit)
commit ecffe289ffb0a4718589e58184af452c9792a667
Author: Andrzej <ndrwrdck at gmail.com>
Date: Wed Apr 17 21:10:09 2013 +0100
ArrowButton: better handling of minimum sizes.
libxfce4panel/xfce-arrow-button.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/libxfce4panel/xfce-arrow-button.c b/libxfce4panel/xfce-arrow-button.c
index bcd06b0..c571256 100644
--- a/libxfce4panel/xfce-arrow-button.c
+++ b/libxfce4panel/xfce-arrow-button.c
@@ -305,7 +305,7 @@ xfce_arrow_button_draw (GtkWidget *widget,
{
width = (gdouble) MIN (alloc.height - padding.top - padding.bottom - border.top - border.bottom,
alloc.width - padding.left - padding.right - border.left - border.right);
- width = (gdouble) CLAMP (width, 1.0, (gdouble) ARROW_WIDTH);
+ width = (gdouble) CLAMP (width, 0.0, (gdouble) ARROW_WIDTH);
x = (gdouble) (alloc.width - width) / 2.0;
y = (gdouble) (alloc.height - width) / 2.0;
@@ -323,7 +323,8 @@ xfce_arrow_button_draw (GtkWidget *widget,
}
gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget), &fg_rgba);
gdk_cairo_set_source_rgba (cr, &fg_rgba);
- gtk_render_arrow (context, cr, angle, x, y, width);
+ if (width > 0)
+ gtk_render_arrow (context, cr, angle, x, y, width);
}
return TRUE;
@@ -354,7 +355,6 @@ xfce_arrow_button_get_preferred_width (GtkWidget *widget,
{
case GTK_ARROW_UP:
case GTK_ARROW_DOWN:
- minimum_child_width += ARROW_WIDTH;
natural_child_width += ARROW_WIDTH;
break;
@@ -369,7 +369,7 @@ xfce_arrow_button_get_preferred_width (GtkWidget *widget,
gtk_style_context_get_padding (context, gtk_widget_get_state_flags (widget), &padding);
gtk_style_context_get_border (context, gtk_widget_get_state_flags (widget), &border);
natural_child_width = (ARROW_WIDTH + padding.left + padding.right + border.left + border.right);
- minimum_child_width = natural_child_width;
+ minimum_child_width = natural_child_width - ARROW_WIDTH;
}
if (minimum_width != NULL)
@@ -404,7 +404,6 @@ xfce_arrow_button_get_preferred_height (GtkWidget *widget,
{
case GTK_ARROW_LEFT:
case GTK_ARROW_RIGHT:
- minimum_child_height += ARROW_WIDTH;
natural_child_height += ARROW_WIDTH;
break;
@@ -419,7 +418,7 @@ xfce_arrow_button_get_preferred_height (GtkWidget *widget,
gtk_style_context_get_padding (context, gtk_widget_get_state_flags (widget), &padding);
gtk_style_context_get_border (context, gtk_widget_get_state_flags (widget), &border);
natural_child_height = (ARROW_WIDTH + padding.top + padding.bottom + border.top + border.bottom);
- minimum_child_height = natural_child_height;
+ minimum_child_height = natural_child_height - ARROW_WIDTH;
}
More information about the Xfce4-commits
mailing list