parent
96c9cc2aa4
commit
b19c886426
|
@ -407,13 +407,13 @@ class ReprogrammableKeyV4(ReprogrammableKey):
|
||||||
msg=f'Tried to set mapping flag "{f}" on control "{self.key}" '
|
msg=f'Tried to set mapping flag "{f}" on control "{self.key}" '
|
||||||
+ f'which does not support "{key_flag}" on device {self._device}.'
|
+ f'which does not support "{key_flag}" on device {self._device}.'
|
||||||
)
|
)
|
||||||
bfield |= int(f) if v else 0
|
bfield |= int(f.value) if v else 0
|
||||||
bfield |= int(f) << 1 # The 'Xvalid' bit
|
bfield |= int(f.value) << 1 # The 'Xvalid' bit
|
||||||
if self._mapping_flags: # update flags if already read
|
if self._mapping_flags: # update flags if already read
|
||||||
if v:
|
if v:
|
||||||
self._mapping_flags |= int(f)
|
self._mapping_flags |= int(f.value)
|
||||||
else:
|
else:
|
||||||
self._mapping_flags &= ~int(f)
|
self._mapping_flags &= ~int(f.value)
|
||||||
|
|
||||||
if remap != 0 and remap not in self.remappable_to:
|
if remap != 0 and remap not in self.remappable_to:
|
||||||
raise exceptions.FeatureNotSupported(
|
raise exceptions.FeatureNotSupported(
|
||||||
|
@ -633,7 +633,10 @@ class KeysArrayPersistent(KeysArray):
|
||||||
elif actionId == special_keys.ACTIONID.Mouse:
|
elif actionId == special_keys.ACTIONID.Mouse:
|
||||||
remapped = special_keys.MOUSE_BUTTONS[remapped]
|
remapped = special_keys.MOUSE_BUTTONS[remapped]
|
||||||
elif actionId == special_keys.ACTIONID.Hscroll:
|
elif actionId == special_keys.ACTIONID.Hscroll:
|
||||||
remapped = special_keys.HORIZONTAL_SCROLL[remapped]
|
try:
|
||||||
|
remapped = special_keys.HorizontalScroll(remapped)
|
||||||
|
except ValueError:
|
||||||
|
remapped = f"unknown horizontal scroll:{remapped:04X}"
|
||||||
elif actionId == special_keys.ACTIONID.Consumer:
|
elif actionId == special_keys.ACTIONID.Consumer:
|
||||||
remapped = special_keys.HID_CONSUMERCODES[remapped]
|
remapped = special_keys.HID_CONSUMERCODES[remapped]
|
||||||
elif actionId == special_keys.ACTIONID.Empty: # purge data from empty value
|
elif actionId == special_keys.ACTIONID.Empty: # purge data from empty value
|
||||||
|
|
|
@ -1207,11 +1207,11 @@ MOUSE_BUTTONS = NamedInts(
|
||||||
)
|
)
|
||||||
MOUSE_BUTTONS._fallback = lambda x: f"unknown mouse button:{x:04X}"
|
MOUSE_BUTTONS._fallback = lambda x: f"unknown mouse button:{x:04X}"
|
||||||
|
|
||||||
HORIZONTAL_SCROLL = NamedInts(
|
|
||||||
Horizontal_Scroll_Left=0x4000,
|
class HorizontalScroll(IntEnum):
|
||||||
Horizontal_Scroll_Right=0x8000,
|
Left = 0x4000
|
||||||
)
|
Right = 0x8000
|
||||||
HORIZONTAL_SCROLL._fallback = lambda x: f"unknown horizontal scroll:{x:04X}"
|
|
||||||
|
|
||||||
# Construct universe for Persistent Remappable Keys setting (only for supported values)
|
# Construct universe for Persistent Remappable Keys setting (only for supported values)
|
||||||
KEYS = UnsortedNamedInts()
|
KEYS = UnsortedNamedInts()
|
||||||
|
@ -1246,7 +1246,7 @@ for code in MOUSE_BUTTONS:
|
||||||
KEYS[(ACTIONID.Mouse << 24) + (int(code) << 8)] = str(code)
|
KEYS[(ACTIONID.Mouse << 24) + (int(code) << 8)] = str(code)
|
||||||
|
|
||||||
# Add Horizontal Scroll
|
# Add Horizontal Scroll
|
||||||
for code in HORIZONTAL_SCROLL:
|
for code in HorizontalScroll:
|
||||||
KEYS[(ACTIONID.Hscroll << 24) + (int(code) << 8)] = str(code)
|
KEYS[(ACTIONID.Hscroll << 24) + (int(code) << 8)] = str(code)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue