Unify key press and mouse button press timings

Both now use Ints for presses.
Still no release timer for keyboard events.
This commit is contained in:
2025-07-28 23:16:05 +01:00
parent ea35753744
commit 81f88c32e9
15 changed files with 52 additions and 58 deletions
+6 -5
View File
@@ -22,13 +22,14 @@ handleTextInput text = textInput %~ (++ map Right text)
handleKeyboardEvent :: KeyboardEventData -> Input -> Input
handleKeyboardEvent kev = case keyboardEventKeyMotion kev of
Released -> pressedKeys . at scode .~ Nothing
Pressed ->
(pressedKeys . at scode ?~ val)
Pressed | keyboardEventRepeat kev -> addTermSignal scode
Pressed | not (keyboardEventRepeat kev) ->
(pressedKeys . at scode ?~ 0)
. addTermSignal scode
where
val
| keyboardEventRepeat kev = LongPress
| otherwise = InitialPress
-- val
-- | keyboardEventRepeat kev = LongPress 0
-- | otherwise = InitialPress 0
scode = (keysymScancode . keyboardEventKeysym) kev
addTermSignal :: Scancode -> Input -> Input