Skip to content

Commit c52cffe

Browse files
committed
Update comments
1 parent ae70a21 commit c52cffe

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

plover/oslayer/linux/keyboardcontrol_uinput.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,10 @@ def _run(self):
543543
keys_pressed_with_modifier: set[int] = set()
544544
down_modifier_keys: set[int] = set()
545545

546-
def _parse_key_event(event: InputEvent) -> tuple[str | None, bool]:
546+
def _process_key_event(event: InputEvent) -> tuple[str | None, bool]:
547547
"""
548+
Processes an InputEvent to determine which key Plover should receive.
549+
Considers pressed modifiers and Plover's suppressed keys.
548550
Returns a tuple of (key_to_send_to_plover, suppress)
549551
"""
550552
if not self._suppressed_keys:
@@ -587,11 +589,13 @@ def _parse_key_event(event: InputEvent) -> tuple[str | None, bool]:
587589
device: InputDevice = key.fileobj
588590
for event in device.read():
589591
if event.type == e.EV_KEY:
590-
key_to_send_to_plover, suppress = _parse_key_event(event)
592+
key_to_send_to_plover, suppress = _process_key_event(event)
591593
if key_to_send_to_plover is not None:
592-
# Always send keys to Plover when no keys suppressed
594+
# Always send keys to Plover when no keys suppressed.
593595
# This is required for global shortcuts like
594-
# Plover enable/disable (PHRO*L)
596+
# Plover toggle (PHROLG) when Plover is disabled.
597+
# Also, must explicitly check key_up or key_down
598+
# because there is a third case: key_hold
595599
if event.value == KeyEvent.key_down:
596600
self.key_down(key_to_send_to_plover)
597601
elif event.value == KeyEvent.key_up:

0 commit comments

Comments
 (0)