[maemo-commits] [maemo-commits] r11305 - in projects/haf/trunk/gtk+: . gtk
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Apr 25 16:25:36 EEST 2007
- Previous message: [maemo-commits] r11304 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r11306 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mitch Date: 2007-04-25 16:25:34 +0300 (Wed, 25 Apr 2007) New Revision: 11305 Modified: projects/haf/trunk/gtk+/ChangeLog projects/haf/trunk/gtk+/gtk/gtkmenu.c Log: 2007-04-25 Michael Natterer <mitch at imendio.com> Merge from upstream trunk: * 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. Modified: projects/haf/trunk/gtk+/ChangeLog =================================================================== --- projects/haf/trunk/gtk+/ChangeLog 2007-04-25 13:16:23 UTC (rev 11304) +++ projects/haf/trunk/gtk+/ChangeLog 2007-04-25 13:25:34 UTC (rev 11305) @@ -1,3 +1,19 @@ +2007-04-25 Michael Natterer <mitch at imendio.com> + + Merge from upstream trunk: + + * 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-20 Michael Natterer <mitch at imendio.com> Merge from upstream trunk, replacing the old hildon popup name: Modified: projects/haf/trunk/gtk+/gtk/gtkmenu.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkmenu.c 2007-04-25 13:16:23 UTC (rev 11304) +++ projects/haf/trunk/gtk+/gtk/gtkmenu.c 2007-04-25 13:25:34 UTC (rev 11305) @@ -3401,36 +3401,39 @@ 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); + if (menu->timeout_id == 0) + { + /* 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 */ + gtk_menu_remove_scroll_timeout (menu); + menu->scroll_step = -MENU_SCROLL_STEP2; /* always fast */ - if (!motion) + if (!motion) + { + /* Only do stuff on click. */ + gtk_menu_start_scrolling (menu); + arrow_pressed = TRUE; + } + } + else { - /* Only do stuff on click. */ - gtk_menu_start_scrolling (menu); - priv->upper_arrow_state = GTK_STATE_ACTIVE; + arrow_pressed = TRUE; } - - gdk_window_invalidate_rect (GTK_WIDGET (menu)->window, - &rect, FALSE); } else if (!enter) { - gdk_window_invalidate_rect (GTK_WIDGET (menu)->window, - &rect, FALSE); - gtk_menu_stop_scrolling (menu); } } @@ -3444,8 +3447,6 @@ { 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 @@ -3463,16 +3464,23 @@ } 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 */ @@ -3495,36 +3503,39 @@ 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); + if (menu->timeout_id == 0) + { + /* 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 */ + gtk_menu_remove_scroll_timeout (menu); + menu->scroll_step = MENU_SCROLL_STEP2; /* always fast */ - if (!motion) + if (!motion) + { + /* Only do stuff on click. */ + gtk_menu_start_scrolling (menu); + arrow_pressed = TRUE; + } + } + else { - /* Only do stuff on click. */ - gtk_menu_start_scrolling (menu); - priv->lower_arrow_state = GTK_STATE_ACTIVE; + arrow_pressed = TRUE; } - - gdk_window_invalidate_rect (GTK_WIDGET (menu)->window, - &rect, FALSE); } else if (!enter) { - gdk_window_invalidate_rect (GTK_WIDGET (menu)->window, - &rect, FALSE); - gtk_menu_stop_scrolling (menu); } } @@ -3538,8 +3549,6 @@ { 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 @@ -3557,16 +3566,23 @@ } 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); + } } } @@ -4265,13 +4281,13 @@ 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;
- Previous message: [maemo-commits] r11304 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r11306 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]