aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport/Control.hs
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-14 18:28:19 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-14 18:28:19 +0530
commitf48587bda4dea13920a96dda06b735be484614a9 (patch)
treecbaf079ca8f1c02800cf2984a89e48d2690b3050 /src/Chelleport/Control.hs
parentef178e85975ea2bdbd2043c92f0917e0fe19823a (diff)
downloadchelleport-f48587bda4dea13920a96dda06b735be484614a9.tar.gz
chelleport-f48587bda4dea13920a96dda06b735be484614a9.zip
Add left click on space + minor fixes
Diffstat (limited to 'src/Chelleport/Control.hs')
-rw-r--r--src/Chelleport/Control.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Chelleport/Control.hs b/src/Chelleport/Control.hs
index 04362bd..2fb4f6c 100644
--- a/src/Chelleport/Control.hs
+++ b/src/Chelleport/Control.hs
@@ -1,18 +1,20 @@
module Chelleport.Control where
import Chelleport.Context (DrawContext (ctxX11Display))
+import Control.Concurrent (threadDelay)
import Foreign.C (CInt)
import qualified Graphics.X11 as X11
import qualified Graphics.X11.XTest as X11
-import qualified Graphics.X11.Xlib.Extras as X11
import qualified SDL
triggerMouseLeftClick :: DrawContext -> IO ()
triggerMouseLeftClick ctx = do
+ threadDelay 30_000 -- Wrap with delay to prevent async window close issues. TODO: Remove maybe?
let display = ctxX11Display ctx
X11.fakeButtonPress display X11.button1
X11.sync display False
+ threadDelay 30_000
-moveMouse :: CInt -> CInt -> IO ()
-moveMouse x y = do
+moveMouse :: DrawContext -> CInt -> CInt -> IO ()
+moveMouse _ctx x y = do
SDL.warpMouse SDL.WarpGlobal (SDL.P $ SDL.V2 x y)