From ef178e85975ea2bdbd2043c92f0917e0fe19823a Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 14 Dec 2024 15:13:40 +0530 Subject: Draw grid + open x11 display to trigger click event --- src/Chelleport/Control.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Chelleport/Control.hs (limited to 'src/Chelleport/Control.hs') 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) -- cgit v1.3.1