implement hold-tap interrupt for Layers

This commit is contained in:
xs5871
2022-02-03 21:09:39 +00:00
committed by Kyle Brown
parent a685618480
commit 1c6b25517a
6 changed files with 61 additions and 36 deletions

View File

@@ -158,24 +158,29 @@ class KMKKeyboard:
if self.current_key is None:
self.current_key = self._find_key_in_map(int_coord, row, col)
if is_pressed:
self._coordkeys_pressed[int_coord] = self.current_key
else:
self._coordkeys_pressed[int_coord] = None
if self.current_key is None:
print('MatrixUndefinedCoordinate(col={} row={})'.format(col, row))
return self
if self.current_key is None:
print('MatrixUndefinedCoordinate(col={} row={})'.format(col, row))
return self
for module in self.modules:
try:
if module.process_key(self, self.current_key, is_pressed) is None:
self.current_key = module.process_key(
self, self.current_key, is_pressed, int_coord
)
if self.current_key is None:
break
except Exception as err:
if self.debug_enabled:
print('Failed to run process_key function in module: ', err, module)
if is_pressed:
self._coordkeys_pressed[int_coord] = self.current_key
else:
del self._coordkeys_pressed[int_coord]
if self.current_key:
self.process_key(self.current_key, is_pressed, int_coord, (row, col))
return self
def process_key(self, key, is_pressed, coord_int=None, coord_raw=None):