ignore irrelevant modifiers and events pending
authorJosh Blum <josh@joshknows.com>
Thu, 10 Sep 2009 21:47:53 +0000 (14:47 -0700)
committerJosh Blum <josh@joshknows.com>
Thu, 10 Sep 2009 21:47:53 +0000 (14:47 -0700)
grc/gui/ActionHandler.py
grc/gui/Actions.py

index 656f99c3776e0d39012e132420b4f4db49f455ac..970b731c810f0f7d1e30de191aa920bbd6677dff 100644 (file)
@@ -79,8 +79,6 @@ class ActionHandler:
                When not in focus, gtk and the accelerators handle the the key press.
                @return false to let gtk handle the key action
                """
-               #dont allow key presses to queue up
-               if gtk.events_pending(): return True
                #extract action name from this key press
                key_name = gtk.gdk.keyval_name(event.keyval)
                mod_mask = event.state
index c3ef2711acb053433c9ea0ea6a23dbfac469fcdd..1d6a2afba6b38b1bb908ae6c80e4815f4bdc4e61 100644 (file)
@@ -97,6 +97,7 @@ _actions_key_list = (
 )
 
 _actions_key_dict = dict(((key_name, mod_mask), action_name) for action_name, key_name, mod_mask in _actions_key_list)
+_all_mods_mask = reduce(lambda x, y: x | y, [mod_mask for action_name, key_name, mod_mask in _actions_key_list], 0)
 def get_action_name_from_key_name(key_name, mod_mask=0):
        """
        Get the action name associated with the key name and mask.
@@ -105,6 +106,7 @@ def get_action_name_from_key_name(key_name, mod_mask=0):
        @param mod_mask the key press mask (shift, ctrl) 0 for none
        @return the action name or blank string
        """
+       mod_mask &= _all_mods_mask #ignore irrelevant modifiers
        key_name_mod_mask = (key_name, mod_mask)
        if key_name_mod_mask in _actions_key_dict: return _actions_key_dict[key_name_mod_mask]
        return ''