forked from AuroraMiddleware/gtk
fix ACTIVE state of scroll buttons (we were setting the state to ACTIVE
2007-04-25 Michael Natterer <mitch@imendio.com> * gtk/gtkmenu.c (gtk_menu_handle_scrolling): fix ACTIVE state of scroll buttons (we were setting the state to ACTIVE but immediately overwriting it with NORMAL or PRELIGHT). Also got rid of many separate calls to gdk_window_invalidate_rect() by remembering the old button state and only invalidating the area if the state has changed (addresses parts of bug #433242, Tommi Komulainen). (gtk_menu_scroll_to): change the arrow states only if changing from or to INSENSITIVE state, so we don't overwrite the ACTIVE state set by above function. svn path=/trunk/; revision=17630
This commit is contained in:
parent
653a03c218
commit
4a74188834
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
2007-04-25 Michael Natterer <mitch@imendio.com>
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_handle_scrolling): fix ACTIVE state of
|
||||
scroll buttons (we were setting the state to ACTIVE but
|
||||
immediately overwriting it with NORMAL or PRELIGHT). Also got rid
|
||||
of many separate calls to gdk_window_invalidate_rect() by
|
||||
remembering the old button state and only invalidating the area if
|
||||
the state has changed (addresses parts of bug #433242, Tommi
|
||||
Komulainen).
|
||||
|
||||
(gtk_menu_scroll_to): change the arrow states only if changing
|
||||
from or to INSENSITIVE state, so we don't overwrite the ACTIVE
|
||||
state set by above function.
|
||||
|
||||
2007-04-25 Michael Natterer <mitch@imendio.com>
|
||||
|
||||
* gtk/gtkprintoperation.c (preview_iface_is_selected): fix the
|
||||
|
134
gtk/gtkmenu.c
134
gtk/gtkmenu.c
@ -2466,7 +2466,7 @@ gtk_menu_paint (GtkWidget *widget,
|
||||
gtk_paint_box (widget->style,
|
||||
widget->window,
|
||||
priv->upper_arrow_state,
|
||||
GTK_SHADOW_OUT,
|
||||
GTK_SHADOW_OUT,
|
||||
&event->area, widget, "menu",
|
||||
border_x,
|
||||
border_y,
|
||||
@ -2490,7 +2490,7 @@ gtk_menu_paint (GtkWidget *widget,
|
||||
gtk_paint_box (widget->style,
|
||||
widget->window,
|
||||
priv->lower_arrow_state,
|
||||
GTK_SHADOW_OUT,
|
||||
GTK_SHADOW_OUT,
|
||||
&event->area, widget, "menu",
|
||||
border_x,
|
||||
height - border_y - scroll_arrow_height,
|
||||
@ -2905,7 +2905,7 @@ gtk_menu_motion_notify (GtkWidget *widget,
|
||||
|
||||
if (definitely_within_item (menu_item, event->x, event->y))
|
||||
menu_shell->activate_time = 0;
|
||||
|
||||
|
||||
need_enter = (menu->navigation_region != NULL || menu_shell->ignore_enter);
|
||||
|
||||
/* Check to see if we are within an active submenu's navigation region
|
||||
@ -3203,36 +3203,39 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
|
||||
|
||||
if (priv->upper_arrow_state != GTK_STATE_INSENSITIVE)
|
||||
{
|
||||
gboolean arrow_pressed = FALSE;
|
||||
GtkStateType arrow_state = GTK_STATE_NORMAL;
|
||||
|
||||
if (menu->upper_arrow_visible && !menu->tearoff_active)
|
||||
{
|
||||
if (touchscreen_mode)
|
||||
{
|
||||
if (enter && menu->upper_arrow_prelight &&
|
||||
menu->timeout_id == 0)
|
||||
if (enter && menu->upper_arrow_prelight)
|
||||
{
|
||||
/* Deselect the active item so that
|
||||
* any submenus are popped down
|
||||
*/
|
||||
gtk_menu_shell_deselect (menu_shell);
|
||||
|
||||
gtk_menu_remove_scroll_timeout (menu);
|
||||
menu->scroll_step = -MENU_SCROLL_STEP2; /* always fast */
|
||||
|
||||
if (!motion)
|
||||
if (menu->timeout_id == 0)
|
||||
{
|
||||
/* Only do stuff on click. */
|
||||
gtk_menu_start_scrolling (menu);
|
||||
priv->upper_arrow_state = GTK_STATE_ACTIVE;
|
||||
}
|
||||
/* Deselect the active item so that
|
||||
* any submenus are popped down
|
||||
*/
|
||||
gtk_menu_shell_deselect (menu_shell);
|
||||
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
gtk_menu_remove_scroll_timeout (menu);
|
||||
menu->scroll_step = -MENU_SCROLL_STEP2; /* always fast */
|
||||
|
||||
if (!motion)
|
||||
{
|
||||
/* Only do stuff on click. */
|
||||
gtk_menu_start_scrolling (menu);
|
||||
arrow_pressed = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
arrow_pressed = TRUE;
|
||||
}
|
||||
}
|
||||
else if (!enter)
|
||||
{
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
|
||||
gtk_menu_stop_scrolling (menu);
|
||||
}
|
||||
}
|
||||
@ -3246,8 +3249,6 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
|
||||
{
|
||||
menu->upper_arrow_prelight = TRUE;
|
||||
menu->scroll_fast = scroll_fast;
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
|
||||
/* Deselect the active item so that
|
||||
* any submenus are popped down
|
||||
@ -3266,16 +3267,23 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
|
||||
}
|
||||
else if (!enter && !in_arrow && menu->upper_arrow_prelight)
|
||||
{
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
|
||||
gtk_menu_stop_scrolling (menu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
priv->upper_arrow_state = menu->upper_arrow_prelight ?
|
||||
GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
|
||||
if (arrow_pressed)
|
||||
arrow_state = GTK_STATE_ACTIVE;
|
||||
else if (menu->upper_arrow_prelight)
|
||||
arrow_state = GTK_STATE_PRELIGHT;
|
||||
|
||||
if (arrow_state != priv->upper_arrow_state)
|
||||
{
|
||||
priv->upper_arrow_state = arrow_state;
|
||||
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* lower arrow handling */
|
||||
@ -3298,36 +3306,39 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
|
||||
|
||||
if (priv->lower_arrow_state != GTK_STATE_INSENSITIVE)
|
||||
{
|
||||
gboolean arrow_pressed = FALSE;
|
||||
GtkStateType arrow_state = GTK_STATE_NORMAL;
|
||||
|
||||
if (menu->lower_arrow_visible && !menu->tearoff_active)
|
||||
{
|
||||
if (touchscreen_mode)
|
||||
{
|
||||
if (enter && menu->lower_arrow_prelight &&
|
||||
menu->timeout_id == 0)
|
||||
if (enter && menu->lower_arrow_prelight)
|
||||
{
|
||||
/* Deselect the active item so that
|
||||
* any submenus are popped down
|
||||
*/
|
||||
gtk_menu_shell_deselect (menu_shell);
|
||||
|
||||
gtk_menu_remove_scroll_timeout (menu);
|
||||
menu->scroll_step = MENU_SCROLL_STEP2; /* always fast */
|
||||
|
||||
if (!motion)
|
||||
if (menu->timeout_id == 0)
|
||||
{
|
||||
/* Only do stuff on click. */
|
||||
gtk_menu_start_scrolling (menu);
|
||||
priv->lower_arrow_state = GTK_STATE_ACTIVE;
|
||||
}
|
||||
/* Deselect the active item so that
|
||||
* any submenus are popped down
|
||||
*/
|
||||
gtk_menu_shell_deselect (menu_shell);
|
||||
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
gtk_menu_remove_scroll_timeout (menu);
|
||||
menu->scroll_step = MENU_SCROLL_STEP2; /* always fast */
|
||||
|
||||
if (!motion)
|
||||
{
|
||||
/* Only do stuff on click. */
|
||||
gtk_menu_start_scrolling (menu);
|
||||
arrow_pressed = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
arrow_pressed = TRUE;
|
||||
}
|
||||
}
|
||||
else if (!enter)
|
||||
{
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
|
||||
gtk_menu_stop_scrolling (menu);
|
||||
}
|
||||
}
|
||||
@ -3341,8 +3352,6 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
|
||||
{
|
||||
menu->lower_arrow_prelight = TRUE;
|
||||
menu->scroll_fast = scroll_fast;
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
|
||||
/* Deselect the active item so that
|
||||
* any submenus are popped down
|
||||
@ -3361,16 +3370,23 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
|
||||
}
|
||||
else if (!enter && !in_arrow && menu->lower_arrow_prelight)
|
||||
{
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
|
||||
gtk_menu_stop_scrolling (menu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
priv->lower_arrow_state = menu->lower_arrow_prelight ?
|
||||
GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
|
||||
if (arrow_pressed)
|
||||
arrow_state = GTK_STATE_ACTIVE;
|
||||
else if (menu->lower_arrow_prelight)
|
||||
arrow_state = GTK_STATE_PRELIGHT;
|
||||
|
||||
if (arrow_state != priv->lower_arrow_state)
|
||||
{
|
||||
priv->lower_arrow_state = arrow_state;
|
||||
|
||||
gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
|
||||
&rect, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4066,13 +4082,13 @@ gtk_menu_scroll_to (GtkMenu *menu,
|
||||
|
||||
if (offset <= 0)
|
||||
priv->upper_arrow_state = GTK_STATE_INSENSITIVE;
|
||||
else
|
||||
else if (priv->upper_arrow_state == GTK_STATE_INSENSITIVE)
|
||||
priv->upper_arrow_state = menu->upper_arrow_prelight ?
|
||||
GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
|
||||
|
||||
if (offset >= menu_height - view_height)
|
||||
priv->lower_arrow_state = GTK_STATE_INSENSITIVE;
|
||||
else
|
||||
else if (priv->lower_arrow_state == GTK_STATE_INSENSITIVE)
|
||||
priv->lower_arrow_state = menu->lower_arrow_prelight ?
|
||||
GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user