ignore num lock state when recognising keys

This commit is contained in:
Daniel Barlow 2024-09-10 14:17:55 +01:00
parent a5a65006ca
commit 3dd0d3f11c

View File

@ -19,6 +19,7 @@
:Super_R ; menu key? not on my keyboard
:Alt_L
:Alt_R
:Num_Lock
:ISO_Level3_Shift ; AltGr
]]
(collect [_ n (ipairs names)]
@ -27,6 +28,10 @@
(fn modifier? [keyval]
(. modifier-keyvals keyval))
(fn ignored-modifier? [mod]
(= mod :MOD2_MASK) ; numlock
)
(fn keychord->spec [keychord]
(let [Mod Gdk.ModifierType
symbol (keychord:match "(%w+)$")
@ -49,7 +54,9 @@
(let [modmask
(accumulate [m 0
k _ (pairs event.state)]
(bor m (. Gdk.ModifierType k)))]
(if (ignored-modifier? k)
m
(bor m (. Gdk.ModifierType (trace k)))))]
(spec->index {:keyval event.keyval : modmask})))
(fn compact [xs]