Improve key detection in registerGestureByString
This commit is contained in:
parent
8b1f501fe7
commit
39dca0574a
@ -60,19 +60,16 @@ class APIHelper:
|
|||||||
from . import keybindings
|
from . import keybindings
|
||||||
key_parts = key.lower().split("+")
|
key_parts = key.lower().split("+")
|
||||||
|
|
||||||
# Determine appropriate modifier mask
|
# Start with the base Cthulhu modifier
|
||||||
modifiers = keybindings.CTHULHU_MODIFIER_MASK
|
modifiers = keybindings.CTHULHU_MODIFIER_MASK
|
||||||
|
|
||||||
# Extract the final key (without modifiers)
|
# Extract the final key (without modifiers)
|
||||||
final_key = key_parts[-1]
|
final_key = key_parts[-1]
|
||||||
|
|
||||||
# Check for additional modifiers
|
# Check for additional modifiers and combine them properly
|
||||||
if "shift" in key_parts:
|
if "shift" in key_parts:
|
||||||
|
# Use the pre-defined combined mask rather than trying to OR them
|
||||||
modifiers = keybindings.CTHULHU_SHIFT_MODIFIER_MASK
|
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
|
# Create a keybinding handler
|
||||||
class GestureHandler:
|
class GestureHandler:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user