From 9cc557feb47faa304ad638828ba78e701262978d Mon Sep 17 00:00:00 2001 From: hashirama Date: Sun, 9 Nov 2025 05:42:39 +0000 Subject: [PATCH] Add floatDialogX11.hs --- floatDialogX11.hs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 floatDialogX11.hs diff --git a/floatDialogX11.hs b/floatDialogX11.hs new file mode 100644 index 0000000..deefa50 --- /dev/null +++ b/floatDialogX11.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE OverloadedStrings #-} + +import Graphics.X11.Xlib +import Graphics.X11.Xlib.Extras +import Foreign.Marshal.Array (withArray) +import Foreign.Ptr (castPtr) +import Control.Monad (void) + +main :: IO () +main = do + dpy <- openDisplay "" + + let screen = defaultScreen dpy -- pure value + rootWin <- rootWindow dpy screen -- IO Window + + win <- createSimpleWindow dpy rootWin 100 100 400 100 1 0 0 + + mapWindow dpy win + + atomNetWm <- internAtom dpy "_NET_WM_WINDOW_TYPE" False + atomDialog <- internAtom dpy "_NET_WM_WINDOW_TYPE_DIALOG" False + atomAtom <- internAtom dpy "ATOM" False + + withArray [atomDialog] $ \ptr -> + void $ xChangeProperty dpy win atomNetWm atomAtom 32 propModeReplace (castPtr ptr) 1 + + flush dpy + + putStrLn "Window created. Press Enter to exit." + _ <- getLine + + destroyWindow dpy win + closeDisplay dpy