patch from maemo-gtk that changes GtkRange to render its arrows

Wed Nov  9 16:29:42 2005  Tim Janik  <timj@imendio.com>

        * gtk/gtkrange.c: patch from maemo-gtk that changes GtkRange
        to render its arrows insensitive when the adjustment is in
        its min or max position. this makes range arrow behaviour
        consistent with spin button behaviour. (#321056)
This commit is contained in:
Tim Janik 2005-11-09 15:32:51 +00:00 committed by Tim Janik
parent 3b9a63ec6e
commit 401468a9f8
3 changed files with 39 additions and 5 deletions

View File

@ -1,3 +1,10 @@
Wed Nov 9 16:29:42 2005 Tim Janik <timj@imendio.com>
* gtk/gtkrange.c: patch from maemo-gtk that changes GtkRange
to render its arrows insensitive when the adjustment is in
its min or max position. this makes range arrow behaviour
consistent with spin button behaviour. (#321056)
2005-11-09 Tor Lillqvist <tml@novell.com>
* gdk/gdkinternals.h

View File

@ -1,3 +1,10 @@
Wed Nov 9 16:29:42 2005 Tim Janik <timj@imendio.com>
* gtk/gtkrange.c: patch from maemo-gtk that changes GtkRange
to render its arrows insensitive when the adjustment is in
its min or max position. this makes range arrow behaviour
consistent with spin button behaviour. (#321056)
2005-11-09 Tor Lillqvist <tml@novell.com>
* gdk/gdkinternals.h

View File

@ -919,14 +919,34 @@ draw_stepper (GtkRange *range,
gint arrow_width;
gint arrow_height;
gboolean arrow_insensitive = FALSE;
/* More to get the right clip region than for efficiency */
if (!gdk_rectangle_intersect (area, rect, &intersection))
return;
intersection.x += widget->allocation.x;
intersection.y += widget->allocation.y;
if (!GTK_WIDGET_IS_SENSITIVE (range))
if (((!range->inverted && (arrow_type == GTK_ARROW_DOWN ||
arrow_type == GTK_ARROW_RIGHT)) ||
(range->inverted && (arrow_type == GTK_ARROW_UP ||
arrow_type == GTK_ARROW_LEFT))) &&
range->adjustment->value >=
(range->adjustment->upper - range->adjustment->page_size))
{
arrow_insensitive = TRUE;
}
else if (((!range->inverted && (arrow_type == GTK_ARROW_UP ||
arrow_type == GTK_ARROW_LEFT)) ||
(range->inverted && (arrow_type == GTK_ARROW_DOWN ||
arrow_type == GTK_ARROW_RIGHT))) &&
range->adjustment->value <= range->adjustment->lower)
{
arrow_insensitive = TRUE;
}
if (!GTK_WIDGET_IS_SENSITIVE (range) || arrow_insensitive)
state_type = GTK_STATE_INSENSITIVE;
else if (clicked)
state_type = GTK_STATE_ACTIVE;
@ -934,8 +954,8 @@ draw_stepper (GtkRange *range,
state_type = GTK_STATE_PRELIGHT;
else
state_type = GTK_STATE_NORMAL;
if (clicked)
if (clicked && ! arrow_insensitive)
shadow_type = GTK_SHADOW_IN;
else
shadow_type = GTK_SHADOW_OUT;
@ -955,7 +975,7 @@ draw_stepper (GtkRange *range,
arrow_x = widget->allocation.x + rect->x + (rect->width - arrow_width) / 2;
arrow_y = widget->allocation.y + rect->y + (rect->height - arrow_height) / 2;
if (clicked)
if (clicked && ! arrow_insensitive)
{
gint arrow_displacement_x;
gint arrow_displacement_y;