implement global pointing device axis handling
This commit is contained in:
@@ -49,6 +49,7 @@ class KMKKeyboard:
|
||||
#####
|
||||
# Internal State
|
||||
keys_pressed = set()
|
||||
axes = {}
|
||||
_coordkeys_pressed = {}
|
||||
hid_type = HIDModes.USB
|
||||
secondary_hid_type = None
|
||||
@@ -88,6 +89,7 @@ class KMKKeyboard:
|
||||
f' unicode_mode={self.unicode_mode}, ',
|
||||
f'_hid_helper={self._hid_helper},\n',
|
||||
f' keys_pressed={self.keys_pressed},\n',
|
||||
f' axes={self.axes},\n',
|
||||
f' _coordkeys_pressed={self._coordkeys_pressed},\n',
|
||||
f' hid_pending={self.hid_pending}, ',
|
||||
f'active_layers={self.active_layers}, ',
|
||||
@@ -100,16 +102,24 @@ class KMKKeyboard:
|
||||
if debug.enabled:
|
||||
debug(f'coordkeys_pressed={self._coordkeys_pressed}')
|
||||
debug(f'keys_pressed={self.keys_pressed}')
|
||||
# debug(f'axis={[ax for ax in self.axis.__iter__()]}')
|
||||
|
||||
def _send_hid(self) -> None:
|
||||
if self._hid_send_enabled:
|
||||
hid_report = self._hid_helper.create_report(self.keys_pressed)
|
||||
try:
|
||||
hid_report.send()
|
||||
except KeyError as e:
|
||||
if debug.enabled:
|
||||
debug(f'HidNotFound(HIDReportType={e})')
|
||||
if not self._hid_send_enabled:
|
||||
return
|
||||
|
||||
self._hid_helper.create_report(self.keys_pressed, self.axes)
|
||||
try:
|
||||
self._hid_helper.send()
|
||||
except KeyError as e:
|
||||
if debug.enabled:
|
||||
debug(f'HidNotFound(HIDReportType={e})')
|
||||
|
||||
self.hid_pending = False
|
||||
for axis in self.axes.values():
|
||||
if axis.delta != 0:
|
||||
self.hid_pending = True
|
||||
break
|
||||
|
||||
def _handle_matrix_report(self, kevent: KeyEvent) -> None:
|
||||
if kevent is not None:
|
||||
|
Reference in New Issue
Block a user