aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport
diff options
context:
space:
mode:
Diffstat (limited to 'src/Chelleport')
-rw-r--r--src/Chelleport/Control.hs11
-rw-r--r--src/Chelleport/KeySequence.hs1
-rw-r--r--src/Chelleport/Types.hs1
3 files changed, 10 insertions, 3 deletions
diff --git a/src/Chelleport/Control.hs b/src/Chelleport/Control.hs
index 2ad2a34..38b6c53 100644
--- a/src/Chelleport/Control.hs
+++ b/src/Chelleport/Control.hs
@@ -36,8 +36,8 @@ instance (MonadIO m) => MonadControl (AppM m) where
(SDL.P (SDL.V2 x y)) <- SDL.getAbsoluteMouseLocation
pure (x, y)
-isKeyPress :: SDL.KeyboardEventData -> Bool
-isKeyPress = (== SDL.Pressed) . SDL.keyboardEventKeyMotion
+isKeyPressed :: SDL.KeyboardEventData -> Bool
+isKeyPressed = (== SDL.Pressed) . SDL.keyboardEventKeyMotion
isKeyRelease :: SDL.KeyboardEventData -> Bool
isKeyRelease = (== SDL.Released) . SDL.keyboardEventKeyMotion
@@ -47,12 +47,17 @@ eventToKeycode = SDL.keysymKeycode . SDL.keyboardEventKeysym
isKeyPressWith :: SDL.KeyboardEventData -> SDL.Keycode -> Bool
isKeyPressWith keyboardEvent keyCode =
- isKeyPress keyboardEvent && eventToKeycode keyboardEvent == keyCode
+ isKeyPressed keyboardEvent && eventToKeycode keyboardEvent == keyCode
isKeyReleaseWith :: SDL.KeyboardEventData -> SDL.Keycode -> Bool
isKeyReleaseWith keyboardEvent keyCode =
isKeyRelease keyboardEvent && eventToKeycode keyboardEvent == keyCode
+withShift :: SDL.KeyboardEventData -> Bool
+withShift event = SDL.keyModifierLeftShift modifier || SDL.keyModifierRightShift modifier
+ where
+ modifier = SDL.keysymModifier . SDL.keyboardEventKeysym $ event
+
directionalIncrement :: (CInt, CInt) -> Char -> (Int, Int)
directionalIncrement (incX, incY) = \case
'H' -> (-cIntToInt incX, 0)
diff --git a/src/Chelleport/KeySequence.hs b/src/Chelleport/KeySequence.hs
index d92fe0e..dc5f603 100644
--- a/src/Chelleport/KeySequence.hs
+++ b/src/Chelleport/KeySequence.hs
@@ -72,6 +72,7 @@ keycodeMapping =
(SDL.KeycodeN, 'N'),
(SDL.KeycodeO, 'O'),
(SDL.KeycodeP, 'P'),
+ (SDL.KeycodeQ, 'Q'),
(SDL.KeycodeR, 'R'),
(SDL.KeycodeS, 'S'),
(SDL.KeycodeT, 'T'),
diff --git a/src/Chelleport/Types.hs b/src/Chelleport/Types.hs
index a6aa7cc..ca17c23 100644
--- a/src/Chelleport/Types.hs
+++ b/src/Chelleport/Types.hs
@@ -27,6 +27,7 @@ data AppAction
| MoveMousePosition (Int, Int)
| ResetKeys
| TriggerLeftClick
+ | ChainLeftClick
| IncrementMouseCursor (Int, Int)
| ShutdownApp
| UpdateShiftState Bool