aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport.hs
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-22 12:54:22 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-22 13:10:25 +0530
commitac056ba43192bd3c2cbe90d8c8c3d903985a52dd (patch)
tree382dbe23f84f5d37f5c082105649c84343704119 /src/Chelleport.hs
parent6d6cd036106e5daa2aef12bfcb2968657f9841b0 (diff)
downloadchelleport-ac056ba43192bd3c2cbe90d8c8c3d903985a52dd.tar.gz
chelleport-ac056ba43192bd3c2cbe90d8c8c3d903985a52dd.zip
Updates docs
Diffstat (limited to 'src/Chelleport.hs')
-rw-r--r--src/Chelleport.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Chelleport.hs b/src/Chelleport.hs
index 9b96bbc..fe58259 100644
--- a/src/Chelleport.hs
+++ b/src/Chelleport.hs
@@ -59,26 +59,35 @@ eventHandler event =
case SDL.eventPayload event of
SDL.QuitEvent -> Just ShutdownApp
SDL.KeyboardEvent ev
+ -- Escape
| isKeyPressWith ev SDL.KeycodeEscape ->
Just ShutdownApp
+ -- minus / underscore
| isKeyPressWith ev SDL.KeycodeMinus || isKeyPressWith ev SDL.KeycodeUnderscore ->
if withShift ev
then Just $ ChainMouseClick RightClick
else Just $ TriggerMouseClick RightClick
+ -- 0-9
| isKeycodeDigit (eventToKeycode ev) ->
Just $ UpdateRepetition (fromMaybe 0 $ keycodeToInt $ eventToKeycode ev)
+ -- Space / Shift+Space
| isKeyPressWith ev SDL.KeycodeSpace ->
if withShift ev
then Just $ ChainMouseClick LeftClick
else Just $ TriggerMouseClick LeftClick
+ -- Tab / Backspace
| isKeyPressWith ev SDL.KeycodeTab || isKeyPressWith ev SDL.KeycodeBackspace ->
Just ResetKeys
+ -- Ctrl + V
| withCtrl ev && isKeyPressWith ev SDL.KeycodeV ->
Just MouseDragToggle
+ -- A-Z
| isKeyPressed ev && isValidKey (eventToKeycode ev) ->
Just $ HandleKeyInput $ eventToKeycode ev
+ -- Shift press
| isKeyPressWith ev SDL.KeycodeLShift || isKeyPressWith ev SDL.KeycodeRShift ->
Just $ UpdateShiftState True
+ -- Shift release
| isKeyReleaseWith ev SDL.KeycodeLShift || isKeyReleaseWith ev SDL.KeycodeRShift ->
Just $ UpdateShiftState False
_ -> Nothing
@@ -171,7 +180,7 @@ update state MouseDragEnd = do
showWindow
pure (state {stateRepetition = 1}, Nothing)
--- Set/unset whether shift is pressed
+-- Set repetition count
update state (UpdateRepetition count) = do
pure (state {stateRepetition = count}, Nothing)