rules: don't check modifiers for KeyPress actions that are not clicks
This commit is contained in:
parent
500ae07363
commit
7663e204bb
|
@ -187,9 +187,11 @@ then Solaar will add keypresses to produce that keysymbol,
|
||||||
e.g., simulating a left shift keypress to get "A" instead of "a".
|
e.g., simulating a left shift keypress to get "A" instead of "a".
|
||||||
If a key symbol is not available in the current keymap or needs other shift-like keys,
|
If a key symbol is not available in the current keymap or needs other shift-like keys,
|
||||||
then Solaar cannot simulate it.
|
then Solaar cannot simulate it.
|
||||||
If Solaar can determine the current key modifiers (shift, control, etc.)
|
Under X11 Solaar can determine the current key modifiers (shift, control, etc.).
|
||||||
any key symbols that correspond to these modifier keys are not pressed,
|
Any key symbols that correspond to these modifier keys are not depressed and released when clicking.
|
||||||
so if the shift key is currently down on a keyboard Solaar will not bother to simulate a shift key.
|
So if the shift key is currently down on a keyboard Solaar will not bother to simulate a shift key.
|
||||||
|
Under Wayland this check cannot be done so the net result of a `KeyPress` action that is not a `depress` or a `release`
|
||||||
|
and that contains modifier keys might be to release the modifier keys.
|
||||||
|
|
||||||
Simulating input in Linux is complex.
|
Simulating input in Linux is complex.
|
||||||
Solaar has to try to determine which keyboard key corresponds to which input character as it cannot directly
|
Solaar has to try to determine which keyboard key corresponds to which input character as it cannot directly
|
||||||
|
|
|
@ -925,14 +925,14 @@ class KeyPress(Action):
|
||||||
(keycode, level) = self.keysym_to_keycode(k, modifiers)
|
(keycode, level) = self.keysym_to_keycode(k, modifiers)
|
||||||
if keycode is None:
|
if keycode is None:
|
||||||
_log.warn('rule KeyPress key symbol not currently available %s', self)
|
_log.warn('rule KeyPress key symbol not currently available %s', self)
|
||||||
elif self.needed(keycode, modifiers):
|
elif self.action != self.CLICK or self.needed(keycode, modifiers): # only check needed when clicking
|
||||||
self.mods(level, modifiers, _KEY_PRESS)
|
self.mods(level, modifiers, _KEY_PRESS)
|
||||||
simulate_key(keycode, _KEY_PRESS)
|
simulate_key(keycode, _KEY_PRESS)
|
||||||
|
|
||||||
def keyUp(self, keysyms, modifiers):
|
def keyUp(self, keysyms, modifiers):
|
||||||
for k in keysyms:
|
for k in keysyms:
|
||||||
(keycode, level) = self.keysym_to_keycode(k, modifiers)
|
(keycode, level) = self.keysym_to_keycode(k, modifiers)
|
||||||
if keycode and self.needed(keycode, modifiers):
|
if keycode and (self.action != self.CLICK or self.needed(keycode, modifiers)): # only check needed when clicking
|
||||||
simulate_key(keycode, _KEY_RELEASE)
|
simulate_key(keycode, _KEY_RELEASE)
|
||||||
self.mods(level, modifiers, _KEY_RELEASE)
|
self.mods(level, modifiers, _KEY_RELEASE)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue