summaryrefslogtreecommitdiff
path: root/gtk/gtkcheckbutton.c
diff options
context:
space:
mode:
authorTim Janik <timj@gimp.org>1998-02-17 06:03:40 +0000
committerTim Janik <timj@src.gnome.org>1998-02-17 06:03:40 +0000
commita3034938827c6b66ac536a19f737d64d94d60309 (patch)
tree3abb0bea2b8f18d8ddec3a6732c60e56bc2c45e4 /gtk/gtkcheckbutton.c
parent9f96d18eb10997961838bfd81462037aadbe4447 (diff)
downloadgtk+-a3034938827c6b66ac536a19f737d64d94d60309.tar.gz
applied patch to fix draw_indicator behaviour from Lars Hamann and Stefan
Tue Feb 17 05:41:31 1998 Tim Janik <timj@gimp.org> * gtk/gtkcheckbutton.c: * gtk/gtkradiobutton.c: * gtk/gtktogglebutton.c: applied patch to fix draw_indicator behaviour from Lars Hamann and Stefan Jeske. * gtk/gtkmain.h: * gtk/gtkmain.c (gtk_grab_get_current): new function that returns the current grab widget or NULL. * gdk/gdkwindow.c (gdk_window_shape_combine_mask): remove shape mask if mask==NULL (provided by Stefan Wille).
Diffstat (limited to 'gtk/gtkcheckbutton.c')
-rw-r--r--gtk/gtkcheckbutton.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 9266120179..c7244f3c41 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -157,25 +157,30 @@ static void
gtk_check_button_draw_focus (GtkWidget *widget)
{
GtkCheckButton *check_button;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
+
+ if (GTK_WIDGET_DRAWABLE (widget))
{
check_button = GTK_CHECK_BUTTON (widget);
if (check_button->toggle_button.draw_indicator)
{
+ gint border_width;
+
+ border_width = GTK_CONTAINER (widget)->border_width;
if (GTK_WIDGET_HAS_FOCUS (widget))
gdk_draw_rectangle (widget->window,
- widget->style->black_gc, FALSE, 0, 0,
- widget->allocation.width - 1,
- widget->allocation.height - 1);
+ widget->style->black_gc, FALSE,
+ border_width, border_width,
+ widget->allocation.width - 2 * border_width - 1,
+ widget->allocation.height - 2 * border_width - 1);
else
gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL], FALSE, 0, 0,
- widget->allocation.width - 1,
- widget->allocation.height - 1);
+ widget->style->bg_gc[GTK_STATE_NORMAL], FALSE,
+ border_width, border_width,
+ widget->allocation.width - 2 * border_width - 1,
+ widget->allocation.height - 2 * border_width - 1);
}
else
{
@@ -322,6 +327,8 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
GtkToggleButton *toggle_button;
GtkStateType state_type;
GtkShadowType shadow_type;
+ GdkRectangle restrict_area;
+ GdkRectangle new_area;
gint width, height;
gint x, y;
@@ -338,9 +345,18 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
(state_type != GTK_STATE_PRELIGHT))
state_type = GTK_STATE_NORMAL;
- gtk_style_set_background (widget->style, widget->window, state_type);
- gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
+ restrict_area.x = GTK_CONTAINER (widget)->border_width;
+ restrict_area.y = restrict_area.x;
+ restrict_area.width = widget->allocation.width - restrict_area.x * 2;
+ restrict_area.height = widget->allocation.height - restrict_area.x * 2;
+ if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
+ {
+ gtk_style_set_background (widget->style, widget->window, state_type);
+ gdk_window_clear_area (widget->window, new_area.x, new_area.y,
+ new_area.width, new_area.height);
+ }
+
x = CHECK_BUTTON_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width;
y = (widget->allocation.height - CHECK_BUTTON_CLASS (widget)->indicator_size) / 2;
width = CHECK_BUTTON_CLASS (widget)->indicator_size;