gtk+ r21648 - in trunk: . gtk



Author: matthiasc
Date: Tue Oct 14 02:00:11 2008
New Revision: 21648
URL: http://svn.gnome.org/viewvc/gtk+?rev=21648&view=rev

Log:
2008-10-13  Matthias Clasen  <mclasen redhat com>

        Bug 552318 â menubar mnemonics consumed even when
        gtk-enable-mnemonics=false

        * gtk/gtkwindow.c (gtk_window_activate_key): Don't let mnemonic
        entries block accelerator activation when gtk-enable-mnemonics is
        FALSE. Problem reported by Andreas Moog.



Modified:
   trunk/ChangeLog
   trunk/gtk/gtkwindow.c

Modified: trunk/gtk/gtkwindow.c
==============================================================================
--- trunk/gtk/gtkwindow.c	(original)
+++ trunk/gtk/gtkwindow.c	Tue Oct 14 02:00:11 2008
@@ -8028,6 +8028,8 @@
 {
   GtkKeyHash *key_hash;
   GtkWindowKeyEntry *found_entry = NULL;
+  gboolean enable_mnemonics;
+  gboolean enable_accels;
 
   g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
@@ -8036,39 +8038,43 @@
 
   if (key_hash)
     {
+      GSList *tmp_list;
       GSList *entries = _gtk_key_hash_lookup (key_hash,
 					      event->hardware_keycode,
 					      event->state,
 					      gtk_accelerator_get_default_mod_mask (),
 					      event->group);
-      GSList *tmp_list;
+
+      g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)),
+                    "gtk-enable-mnemonics", &enable_mnemonics,
+                    "gtk-enable-accels", &enable_accels,
+                    NULL);
 
       for (tmp_list = entries; tmp_list; tmp_list = tmp_list->next)
 	{
 	  GtkWindowKeyEntry *entry = tmp_list->data;
 	  if (entry->is_mnemonic)
-	    {
-	      found_entry = entry;
-	      break;
-	    }
+            {
+              if (enable_mnemonics)
+	        {
+	          found_entry = entry;
+	          break;
+	        }
+            }
+          else 
+            {
+              if (enable_accels && !found_entry)
+                {
+	          found_entry = entry;
+                }
+            }
 	}
-      
-      if (!found_entry && entries)
-	found_entry = entries->data;
 
       g_slist_free (entries);
     }
 
   if (found_entry)
     {
-      gboolean enable_mnemonics;
-      gboolean enable_accels;
-
-      g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)),
-                    "gtk-enable-mnemonics", &enable_mnemonics,
-                    "gtk-enable-accels", &enable_accels,
-                    NULL);
-
       if (found_entry->is_mnemonic)
         {
           if (enable_mnemonics)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]