aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport/Control.hs
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-14 15:13:40 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-14 15:17:46 +0530
commitef178e85975ea2bdbd2043c92f0917e0fe19823a (patch)
tree8d5c6c991fd28cadbdeb905f3d3633ebb30bca83 /src/Chelleport/Control.hs
parentfa02e5c7404dfe6aa47a1f5b5052e915e6d413d6 (diff)
downloadchelleport-ef178e85975ea2bdbd2043c92f0917e0fe19823a.tar.gz
chelleport-ef178e85975ea2bdbd2043c92f0917e0fe19823a.zip
Draw grid + open x11 display to trigger click event
Diffstat (limited to 'src/Chelleport/Control.hs')
-rw-r--r--src/Chelleport/Control.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Chelleport/Control.hs b/src/Chelleport/Control.hs
new file mode 100644
index 0000000..04362bd
--- /dev/null
+++ b/src/Chelleport/Control.hs
@@ -0,0 +1,18 @@
+module Chelleport.Control where
+
+import Chelleport.Context (DrawContext (ctxX11Display))
+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
+ let display = ctxX11Display ctx
+ X11.fakeButtonPress display X11.button1
+ X11.sync display False
+
+moveMouse :: CInt -> CInt -> IO ()
+moveMouse x y = do
+ SDL.warpMouse SDL.WarpGlobal (SDL.P $ SDL.V2 x y)