[patch] gtkbutton.c insensitive prelight bug
- From: raph acm org
- To: gtk-list redhat com
- Subject: [patch] gtkbutton.c insensitive prelight bug
- Date: Tue, 10 Jun 1997 20:39:46 -0700
This patch should fix it. I basically applied the same trick that was
used in gtklabel.c - if the widget is set insensitive, then the widget
is drawn as if the state were actually GTK_STATE_INSENSITIVE. I can't
think of anything else it would break.
Raph
--- gtkbutton.c.orig Fri Jun 6 00:02:01 1997
+++ gtkbutton.c Tue Jun 10 20:31:42 1997
@@ -442,6 +442,7 @@
{
GdkRectangle restrict;
GdkRectangle new_area;
+ gint state;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_BUTTON (widget));
@@ -463,7 +464,10 @@
if (gdk_rectangle_intersect (area, &restrict, &new_area))
{
- gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (widget));
+ state = widget->state;
+ if (!GTK_WIDGET_IS_SENSITIVE (widget))
+ state = GTK_STATE_INSENSITIVE;
+ gtk_style_set_background (widget->style, widget->window, state);
gdk_window_clear_area (widget->window,
new_area.x, new_area.y,
new_area.width, new_area.height);
@@ -503,6 +507,7 @@
GtkShadowType shadow_type;
gint width, height;
gint x, y;
+ gint state;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_BUTTON (widget));
@@ -526,6 +531,10 @@
y += DEFAULT_TOP_POS;
}
+ state = widget->state;
+ if (!GTK_WIDGET_IS_SENSITIVE (widget))
+ state = GTK_STATE_INSENSITIVE;
+
if (GTK_WIDGET_HAS_FOCUS (widget))
{
x += 1;
@@ -535,23 +544,23 @@
}
else
{
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
+ if (state == GTK_STATE_ACTIVE)
gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE,
+ widget->style->bg_gc[state], FALSE,
x + 1, y + 1, width - 4, height - 4);
else
gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE,
+ widget->style->bg_gc[state], FALSE,
x + 2, y + 2, width - 5, height - 5);
}
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
+ if (state == GTK_STATE_ACTIVE)
shadow_type = GTK_SHADOW_IN;
else
shadow_type = GTK_SHADOW_OUT;
gtk_draw_shadow (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), shadow_type,
+ state, shadow_type,
x, y, width, height);
if (GTK_WIDGET_HAS_FOCUS (widget))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]