Improve key detection in registerGestureByString
This commit is contained in:
		@@ -60,19 +60,16 @@ class APIHelper:
 | 
			
		||||
            from . import keybindings
 | 
			
		||||
            key_parts = key.lower().split("+")
 | 
			
		||||
 | 
			
		||||
            # Determine appropriate modifier mask
 | 
			
		||||
            # Start with the base Cthulhu modifier
 | 
			
		||||
            modifiers = keybindings.CTHULHU_MODIFIER_MASK
 | 
			
		||||
 | 
			
		||||
            # Extract the final key (without modifiers)
 | 
			
		||||
            final_key = key_parts[-1]
 | 
			
		||||
 | 
			
		||||
            # Check for additional modifiers
 | 
			
		||||
            # Check for additional modifiers and combine them properly
 | 
			
		||||
            if "shift" in key_parts:
 | 
			
		||||
                # Use the pre-defined combined mask rather than trying to OR them
 | 
			
		||||
                modifiers = keybindings.CTHULHU_SHIFT_MODIFIER_MASK
 | 
			
		||||
            elif "ctrl" in key_parts or "control" in key_parts:
 | 
			
		||||
                modifiers = keybindings.CTHULHU_CTRL_MODIFIER_MASK
 | 
			
		||||
            elif "alt" in key_parts:
 | 
			
		||||
                modifiers = keybindings.CTHULHU_ALT_MODIFIER_MASK
 | 
			
		||||
 | 
			
		||||
            # Create a keybinding handler
 | 
			
		||||
            class GestureHandler:
 | 
			
		||||
@@ -104,8 +101,8 @@ class APIHelper:
 | 
			
		||||
                bindings.add(binding)
 | 
			
		||||
 | 
			
		||||
                # Store binding for later reference
 | 
			
		||||
                if contextName not in self._gestureBindings:
 | 
			
		||||
                    self._gestureBindings[contextName] = []
 | 
			
		||||
            if contextName not in self._gestureBindings:
 | 
			
		||||
                self._gestureBindings[contextName] = []
 | 
			
		||||
                self._gestureBindings[contextName].append(binding)
 | 
			
		||||
 | 
			
		||||
                # Register key grab at the system level
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user