[maemo-commits] [maemo-commits] r15361 - in projects/haf/trunk/gtk+: . gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Apr 8 14:05:56 EEST 2008
Author: mitch
Date: 2008-04-08 14:05:54 +0300 (Tue, 08 Apr 2008)
New Revision: 15361

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/gtk/gtkmenushell.c
Log:
2008-04-08  Michael Natterer  <mitch at imendio.com>

	Fixes NB#77057: two submenus are closed in web plugin menu when
	last submenu is empty or has no focus set.

	(same patch was applied to upstream trunk)

	* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current): fix a
	touchscreen-mode keynav corner case: when navigating to the parent
	menu, make sure we don't close two menus at the same time in case
	the deepest open menu has no selectable items.



Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2008-04-08 10:27:40 UTC (rev 15360)
+++ projects/haf/trunk/gtk+/ChangeLog	2008-04-08 11:05:54 UTC (rev 15361)
@@ -1,3 +1,15 @@
+2008-04-08  Michael Natterer  <mitch at imendio.com>
+
+	Fixes NB#77057: two submenus are closed in web plugin menu when
+	last submenu is empty or has no focus set.
+
+	(same patch was applied to upstream trunk)
+
+	* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current): fix a
+	touchscreen-mode keynav corner case: when navigating to the parent
+	menu, make sure we don't close two menus at the same time in case
+	the deepest open menu has no selectable items.
+
 2008-04-04  Michael Natterer  <mitch at imendio.com>
 
 	Change how GtkMenu's "context_menu" flag gets set.

Modified: projects/haf/trunk/gtk+/gtk/gtkmenushell.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkmenushell.c	2008-04-08 10:27:40 UTC (rev 15360)
+++ projects/haf/trunk/gtk+/gtk/gtkmenushell.c	2008-04-08 11:05:54 UTC (rev 15361)
@@ -1389,23 +1389,35 @@
 {
   GtkMenuShell *parent_menu_shell = NULL;
   gboolean had_selection;
+  gboolean touchscreen_mode;
 
   had_selection = menu_shell->active_menu_item != NULL;
 
+  g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
+                "gtk-touchscreen-mode", &touchscreen_mode,
+                NULL);
+
   if (menu_shell->parent_menu_shell)
     parent_menu_shell = GTK_MENU_SHELL (menu_shell->parent_menu_shell);
 
   switch (direction)
     {
     case GTK_MENU_DIR_PARENT:
-      if (parent_menu_shell)
+      if (touchscreen_mode &&
+          menu_shell->active_menu_item &&
+          GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu &&
+          GTK_WIDGET_VISIBLE (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu))
+        {
+          /* if we are on a menu item that has an open submenu but the
+           * focus is not in that submenu (e.g. because it's empty or
+           * has only insensitive items), close that submenu instead
+           * of running into the code below which would close *this*
+           * menu.
+           */
+          _gtk_menu_item_popdown_submenu (menu_shell->active_menu_item);
+        }
+      else if (parent_menu_shell)
 	{
-          gboolean touchscreen_mode;
-
-          g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
-                        "gtk-touchscreen-mode", &touchscreen_mode,
-                        NULL);
-
           if (touchscreen_mode)
             {
               /* close menu when returning from submenu. */


More information about the maemo-commits mailing list