mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-01 18:09:15 +08:00
Merge pull request #917 from asur4s/master
fix(pynput): Add dead key detection condition to support German keyboard
This commit is contained in:
commit
124c0b97a7
@ -33,6 +33,7 @@ DEAD_KEYS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def my_keyboard_mapping(display):
|
def my_keyboard_mapping(display):
|
||||||
"""Generates a mapping from *keysyms* to *key codes* and required
|
"""Generates a mapping from *keysyms* to *key codes* and required
|
||||||
modifier shift states.
|
modifier shift states.
|
||||||
@ -138,8 +139,10 @@ class MyController(Controller):
|
|||||||
else:
|
else:
|
||||||
keycode, shift_state = self._display.keysym_to_keycode(keysym), 0
|
keycode, shift_state = self._display.keysym_to_keycode(keysym), 0
|
||||||
|
|
||||||
# The keycode of the dead key is inconsistent
|
keycode_set = set(map(lambda x: x[0], self.keyboard_mapping[keysym]))
|
||||||
if keycode != self._display.keysym_to_keycode(keysym):
|
# The keycode of the dead key is inconsistent, The keysym has multiple combinations of a keycode.
|
||||||
|
if keycode != self._display.keysym_to_keycode(keysym) \
|
||||||
|
or (keycode_flag == False and keycode == list(keycode_set)[0] and len(keycode_set) == 1):
|
||||||
deakkey_chr = str(key).replace("'", '')
|
deakkey_chr = str(key).replace("'", '')
|
||||||
keysym = DEAD_KEYS[deakkey_chr]
|
keysym = DEAD_KEYS[deakkey_chr]
|
||||||
keycode, shift_state = self.keyboard_mapping[keysym][0]
|
keycode, shift_state = self.keyboard_mapping[keysym][0]
|
||||||
@ -151,8 +154,8 @@ class MyController(Controller):
|
|||||||
try:
|
try:
|
||||||
with self.modifiers as modifiers:
|
with self.modifiers as modifiers:
|
||||||
alt_gr = Key.alt_gr in modifiers
|
alt_gr = Key.alt_gr in modifiers
|
||||||
|
# !!!: Send_event can't support lock screen, this condition cann't be modified
|
||||||
if alt_gr or keycode_flag:
|
if alt_gr:
|
||||||
self.send_event(
|
self.send_event(
|
||||||
event, keycode, shift_state)
|
event, keycode, shift_state)
|
||||||
else:
|
else:
|
||||||
@ -225,7 +228,7 @@ def loop():
|
|||||||
else:
|
else:
|
||||||
keyboard.release(name)
|
keyboard.release(name)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print('[x] error key',e)
|
||||||
|
|
||||||
|
|
||||||
loop()
|
loop()
|
||||||
|
Loading…
Reference in New Issue
Block a user