Turn off prelighting when gtk-touchscreen-mode is enabled (#135666)

2006-03-09  Ross Burton  <ross@openedhand.com>

	* gtk/gtkwidget.c:
	* gtk/gtkrange.c:
	* gtk/gtktogglebutton.c:
	Turn off prelighting when gtk-touchscreen-mode is enabled (#135666)
This commit is contained in:
Ross Burton 2006-03-09 18:48:38 +00:00 committed by Ross Burton
parent 0359e15d3c
commit ff8ea494f9
5 changed files with 39 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2006-03-09 Ross Burton <ross@openedhand.com>
* gtk/gtkwidget.c:
* gtk/gtkrange.c:
* gtk/gtktogglebutton.c:
Turn off prelighting when gtk-touchscreen-mode is enabled (#135666)
Thu Mar 9 14:29:43 2006 Tim Janik <timj@gtk.org>
* gtk/gtkobject.c (gtk_object_init): move the floating flag from

View File

@ -1,3 +1,10 @@
2006-03-09 Ross Burton <ross@openedhand.com>
* gtk/gtkwidget.c:
* gtk/gtkrange.c:
* gtk/gtktogglebutton.c:
Turn off prelighting when gtk-touchscreen-mode is enabled (#135666)
Thu Mar 9 14:29:43 2006 Tim Janik <timj@gtk.org>
* gtk/gtkobject.c (gtk_object_init): move the floating flag from

View File

@ -1153,6 +1153,11 @@ gtk_range_expose (GtkWidget *widget,
GdkRectangle area;
gint focus_line_width = 0;
gint focus_padding = 0;
gboolean touchscreen;
g_object_get (gtk_widget_get_settings (widget),
"gtk-touchscreen-mode", &touchscreen,
NULL);
range = GTK_RANGE (widget);
@ -1208,7 +1213,7 @@ gtk_range_expose (GtkWidget *widget,
if (!sensitive)
state = GTK_STATE_INSENSITIVE;
else if (range->layout->mouse_location == MOUSE_SLIDER)
else if (!touchscreen && range->layout->mouse_location == MOUSE_SLIDER)
state = GTK_STATE_PRELIGHT;
else
state = GTK_STATE_NORMAL;
@ -1238,28 +1243,28 @@ gtk_range_expose (GtkWidget *widget,
draw_stepper (range, &range->layout->stepper_a,
range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
range->layout->grab_location == MOUSE_STEPPER_A,
range->layout->mouse_location == MOUSE_STEPPER_A,
!touchscreen && range->layout->mouse_location == MOUSE_STEPPER_A,
&expose_area);
if (range->has_stepper_b)
draw_stepper (range, &range->layout->stepper_b,
range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
range->layout->grab_location == MOUSE_STEPPER_B,
range->layout->mouse_location == MOUSE_STEPPER_B,
!touchscreen && range->layout->mouse_location == MOUSE_STEPPER_B,
&expose_area);
if (range->has_stepper_c)
draw_stepper (range, &range->layout->stepper_c,
range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
range->layout->grab_location == MOUSE_STEPPER_C,
range->layout->mouse_location == MOUSE_STEPPER_C,
!touchscreen && range->layout->mouse_location == MOUSE_STEPPER_C,
&expose_area);
if (range->has_stepper_d)
draw_stepper (range, &range->layout->stepper_d,
range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
range->layout->grab_location == MOUSE_STEPPER_D,
range->layout->mouse_location == MOUSE_STEPPER_D,
!touchscreen && range->layout->mouse_location == MOUSE_STEPPER_D,
&expose_area);
return FALSE;

View File

@ -483,9 +483,13 @@ static void
gtk_toggle_button_update_state (GtkButton *button)
{
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
gboolean depressed;
gboolean depressed, touchscreen;
GtkStateType new_state;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (button)),
"gtk-touchscreen-mode", &touchscreen,
NULL);
if (toggle_button->inconsistent)
depressed = FALSE;
else if (button->in_button && button->button_down)
@ -493,7 +497,7 @@ gtk_toggle_button_update_state (GtkButton *button)
else
depressed = toggle_button->active;
if (button->in_button && (!button->button_down || toggle_button->draw_indicator))
if (!touchscreen && button->in_button && (!button->button_down || toggle_button->draw_indicator))
new_state = GTK_STATE_PRELIGHT;
else
new_state = depressed ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL;

View File

@ -4317,11 +4317,20 @@ void
gtk_widget_set_state (GtkWidget *widget,
GtkStateType state)
{
gboolean touchscreen;
g_return_if_fail (GTK_IS_WIDGET (widget));
if (state == GTK_WIDGET_STATE (widget))
return;
g_object_get (gtk_widget_get_settings (widget),
"gtk-touchscreen-mode", &touchscreen,
NULL);
if (touchscreen && state == GTK_STATE_PRELIGHT)
state = GTK_STATE_NORMAL;
if (state == GTK_STATE_INSENSITIVE)
gtk_widget_set_sensitive (widget, FALSE);
else