Ensure global shortcuts are never sent to children
This was happening with ctrl+tab and ctrl+shift+tab because cocoa eats these and so glfw has a workaround to always send them. If they are added as global shortcuts, for exmaple for next/previous tab they were then being sent to children
This commit is contained in:
parent
3ee7e5f800
commit
b811976018
2 changed files with 4 additions and 1 deletions
|
|
@ -168,6 +168,7 @@ def __init__(
|
|||
set_boss(self)
|
||||
self.opts, self.args = opts, args
|
||||
self.keymap = self.opts.keymap.copy()
|
||||
self.global_shortcuts_map = {v: KeyAction(k) for k, v in global_shortcuts.items()}
|
||||
for sc in global_shortcuts.values():
|
||||
self.keymap.pop(sc, None)
|
||||
if is_macos:
|
||||
|
|
@ -668,6 +669,8 @@ def dispatch_possible_special_key(self, ev: KeyEvent) -> bool:
|
|||
self.pending_sequences = sequences
|
||||
set_in_sequence_mode(True)
|
||||
return True
|
||||
if self.global_shortcuts_map and get_shortcut(self.global_shortcuts_map, ev):
|
||||
return True
|
||||
elif isinstance(key_action, KeyAction):
|
||||
return self.dispatch_action(key_action)
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
class KeyAction(NamedTuple):
|
||||
func: str
|
||||
args: Sequence[str]
|
||||
args: Sequence[str] = ()
|
||||
|
||||
|
||||
func_with_args, args_funcs = key_func()
|
||||
|
|
|
|||
Loading…
Reference in a new issue