Fix oneshot as combo result getting stuck

This commit is contained in:
xs5871 2023-03-15 23:00:49 +00:00 committed by xs5871
parent 76e6feda6f
commit 20ba48b623

View File

@ -8,6 +8,9 @@ import kmk.handlers.stock as handlers
from kmk.keys import Key, make_key from kmk.keys import Key, make_key
from kmk.kmk_keyboard import KMKKeyboard from kmk.kmk_keyboard import KMKKeyboard
from kmk.modules import Module from kmk.modules import Module
from kmk.utils import Debug
debug = Debug(__name__)
class _ComboState: class _ComboState:
@ -214,7 +217,7 @@ class Combos(Module):
combo.insert(key, int_coord) combo.insert(key, int_coord)
combo._state = _ComboState.MATCHING combo._state = _ComboState.MATCHING
key = combo.result key = None
break break
else: else:
@ -301,10 +304,14 @@ class Combos(Module):
keyboard.resume_process_key(self, key, is_pressed, int_coord) keyboard.resume_process_key(self, key, is_pressed, int_coord)
def activate(self, keyboard, combo): def activate(self, keyboard, combo):
if debug.enabled:
debug('activate', combo)
combo.result.on_press(keyboard) combo.result.on_press(keyboard)
combo._state = _ComboState.ACTIVE combo._state = _ComboState.ACTIVE
def deactivate(self, keyboard, combo): def deactivate(self, keyboard, combo):
if debug.enabled:
debug('deactivate', combo)
combo.result.on_release(keyboard) combo.result.on_release(keyboard)
combo._state = _ComboState.IDLE combo._state = _ComboState.IDLE