From 22c01432b0e0a633ae0ad91fd88958f9e06ba22b Mon Sep 17 00:00:00 2001 From: "regicidal.plutophage" <36969337+regicidalplutophage@users.noreply.github.com> Date: Thu, 12 Dec 2024 02:03:29 +0300 Subject: [PATCH] remove for loops --- kmk/modules/sticky_keys.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/kmk/modules/sticky_keys.py b/kmk/modules/sticky_keys.py index eaeae3a63..fd2a01c7e 100644 --- a/kmk/modules/sticky_keys.py +++ b/kmk/modules/sticky_keys.py @@ -124,20 +124,17 @@ def on_release(self, key, keyboard, *args, **kwargs): key.state = _SK_RELEASED # Key in HOLD state is handled like a regular release. elif key.state == _SK_HOLD: - for sk in self.active_keys.copy(): - keyboard.cancel_timeout(sk.timeout) - self.deactivate(keyboard, sk) + keyboard.cancel_timeout(key.timeout) + self.deactivate(keyboard, key) def on_release_after(self, keyboard, key): # Key is still pressed but nothing else happend: set to HOLD. if key.state == _SK_PRESSED: - for sk in self.active_keys: - key.state = _SK_HOLD - keyboard.cancel_timeout(sk.timeout) + key.state = _SK_HOLD + keyboard.cancel_timeout(key.timeout) # Key got released but nothing else happend: deactivate. elif key.state == _SK_RELEASED: - for sk in self.active_keys.copy(): - self.deactivate(keyboard, sk) + self.deactivate(keyboard, key) def activate(self, keyboard, key): if debug.enabled: