module Graphics.X11.Xlib.Window(
storeName,
createSimpleWindow,
createWindow,
translateCoordinates,
moveResizeWindow,
resizeWindow,
moveWindow,
reparentWindow,
mapSubwindows,
unmapSubwindows,
mapWindow,
lowerWindow,
raiseWindow,
circulateSubwindowsDown,
circulateSubwindowsUp,
circulateSubwindows,
iconifyWindow,
withdrawWindow,
destroyWindow,
destroySubwindows,
setWindowBorder,
setWindowBorderPixmap,
setWindowBorderWidth,
setWindowBackground,
setWindowBackgroundPixmap,
setWindowColormap,
addToSaveSet,
removeFromSaveSet,
changeSaveSet,
clearWindow,
clearArea,
restackWindows,
) where
import Graphics.X11.Types
import Graphics.X11.Xlib.Types
import Foreign
import Foreign.C
storeName :: Display -> Window -> String -> IO ()
storeName :: Display -> Window -> String -> IO ()
storeName Display
display Window
window String
name =
String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
name ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ CString
c_name ->
Display -> Window -> CString -> IO ()
xStoreName Display
display Window
window CString
c_name
foreign import ccall unsafe "HsXlib.h XStoreName"
xStoreName :: Display -> Window -> CString -> IO ()
foreign import ccall unsafe "HsXlib.h XCreateSimpleWindow"
createSimpleWindow :: Display -> Window -> Position -> Position ->
Dimension -> Dimension -> CInt -> Pixel -> Pixel -> IO Window
foreign import ccall unsafe "HsXlib.h XCreateWindow"
createWindow :: Display -> Window -> Position -> Position ->
Dimension -> Dimension -> CInt -> CInt -> WindowClass ->
Visual -> AttributeMask -> Ptr SetWindowAttributes -> IO Window
translateCoordinates :: Display -> Window -> Window -> Position -> Position ->
IO (Bool,Position,Position,Window)
translateCoordinates :: Display
-> Window
-> Window
-> Position
-> Position
-> IO (Bool, Position, Position, Window)
translateCoordinates Display
display Window
src_w Window
dest_w Position
src_x Position
src_y =
(Ptr Position -> IO (Bool, Position, Position, Window))
-> IO (Bool, Position, Position, Window)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Position -> IO (Bool, Position, Position, Window))
-> IO (Bool, Position, Position, Window))
-> (Ptr Position -> IO (Bool, Position, Position, Window))
-> IO (Bool, Position, Position, Window)
forall a b. (a -> b) -> a -> b
$ \ Ptr Position
dest_x_return ->
(Ptr Position -> IO (Bool, Position, Position, Window))
-> IO (Bool, Position, Position, Window)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Position -> IO (Bool, Position, Position, Window))
-> IO (Bool, Position, Position, Window))
-> (Ptr Position -> IO (Bool, Position, Position, Window))
-> IO (Bool, Position, Position, Window)
forall a b. (a -> b) -> a -> b
$ \ Ptr Position
dest_y_return ->
(Ptr Window -> IO (Bool, Position, Position, Window))
-> IO (Bool, Position, Position, Window)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Window -> IO (Bool, Position, Position, Window))
-> IO (Bool, Position, Position, Window))
-> (Ptr Window -> IO (Bool, Position, Position, Window))
-> IO (Bool, Position, Position, Window)
forall a b. (a -> b) -> a -> b
$ \ Ptr Window
child_return -> do
Bool
res <- Display
-> Window
-> Window
-> Position
-> Position
-> Ptr Position
-> Ptr Position
-> Ptr Window
-> IO Bool
xTranslateCoordinates Display
display Window
src_w Window
dest_w Position
src_x Position
src_y
Ptr Position
dest_x_return Ptr Position
dest_y_return Ptr Window
child_return
Position
dest_x <- Ptr Position -> IO Position
forall a. Storable a => Ptr a -> IO a
peek Ptr Position
dest_x_return
Position
dest_y <- Ptr Position -> IO Position
forall a. Storable a => Ptr a -> IO a
peek Ptr Position
dest_y_return
Window
child <- Ptr Window -> IO Window
forall a. Storable a => Ptr a -> IO a
peek Ptr Window
child_return
(Bool, Position, Position, Window)
-> IO (Bool, Position, Position, Window)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
res, Position
dest_x, Position
dest_y, Window
child)
foreign import ccall unsafe "HsXlib.h XTranslateCoordinates"
xTranslateCoordinates :: Display -> Window -> Window ->
Position -> Position ->
Ptr Position -> Ptr Position -> Ptr Window -> IO Bool
foreign import ccall unsafe "HsXlib.h XMoveResizeWindow"
moveResizeWindow :: Display -> Window -> Position -> Position -> Dimension -> Dimension -> IO ()
foreign import ccall unsafe "HsXlib.h XResizeWindow"
resizeWindow :: Display -> Window -> Dimension -> Dimension -> IO ()
foreign import ccall unsafe "HsXlib.h XMoveWindow"
moveWindow :: Display -> Window -> Position -> Position -> IO ()
foreign import ccall unsafe "HsXlib.h XReparentWindow"
reparentWindow :: Display -> Window -> Window -> Position -> Position -> IO ()
foreign import ccall unsafe "HsXlib.h XMapSubwindows"
mapSubwindows :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XUnmapSubwindows"
unmapSubwindows :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XMapWindow"
mapWindow :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XLowerWindow"
lowerWindow :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XRaiseWindow"
raiseWindow :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XCirculateSubwindowsDown"
circulateSubwindowsDown :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XCirculateSubwindowsUp"
circulateSubwindowsUp :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XCirculateSubwindows"
circulateSubwindows :: Display -> Window -> CirculationDirection -> IO ()
iconifyWindow :: Display -> Window -> ScreenNumber -> IO ()
iconifyWindow :: Display -> Window -> ScreenNumber -> IO ()
iconifyWindow Display
display Window
window ScreenNumber
screenno =
String -> IO CInt -> IO ()
throwIfZero String
"iconifyWindow"
(Display -> Window -> ScreenNumber -> IO CInt
xIconifyWindow Display
display Window
window ScreenNumber
screenno)
foreign import ccall unsafe "HsXlib.h XIconifyWindow"
xIconifyWindow :: Display -> Window -> ScreenNumber -> IO Status
withdrawWindow :: Display -> Window -> ScreenNumber -> IO ()
withdrawWindow :: Display -> Window -> ScreenNumber -> IO ()
withdrawWindow Display
display Window
window ScreenNumber
screenno =
String -> IO CInt -> IO ()
throwIfZero String
"withdrawWindow"
(Display -> Window -> ScreenNumber -> IO CInt
xWithdrawWindow Display
display Window
window ScreenNumber
screenno)
foreign import ccall unsafe "HsXlib.h XWithdrawWindow"
xWithdrawWindow :: Display -> Window -> ScreenNumber -> IO Status
foreign import ccall unsafe "HsXlib.h XDestroyWindow"
destroyWindow :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XDestroySubwindows"
destroySubwindows :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XSetWindowBorder"
setWindowBorder :: Display -> Window -> Pixel -> IO ()
foreign import ccall unsafe "HsXlib.h XSetWindowBorderPixmap"
setWindowBorderPixmap :: Display -> Window -> Pixmap -> IO ()
foreign import ccall unsafe "HsXlib.h XSetWindowBorderWidth"
setWindowBorderWidth :: Display -> Window -> Dimension -> IO ()
foreign import ccall unsafe "HsXlib.h XSetWindowBackground"
setWindowBackground :: Display -> Window -> Pixel -> IO ()
foreign import ccall unsafe "HsXlib.h XSetWindowBackgroundPixmap"
setWindowBackgroundPixmap :: Display -> Window -> Pixmap -> IO ()
foreign import ccall unsafe "HsXlib.h XSetWindowColormap"
setWindowColormap :: Display -> Window -> Colormap -> IO ()
foreign import ccall unsafe "HsXlib.h XAddToSaveSet"
addToSaveSet :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XRemoveFromSaveSet"
removeFromSaveSet :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XChangeSaveSet"
changeSaveSet :: Display -> Window -> ChangeSaveSetMode -> IO ()
foreign import ccall unsafe "HsXlib.h XClearWindow"
clearWindow :: Display -> Window -> IO ()
foreign import ccall unsafe "HsXlib.h XClearArea"
clearArea :: Display -> Window ->
Position -> Position -> Dimension -> Dimension -> Bool -> IO ()
restackWindows :: Display -> [Window] -> IO ()
restackWindows :: Display -> [Window] -> IO ()
restackWindows Display
display [Window]
windows =
[Window] -> (Ptr Window -> IO ()) -> IO ()
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [Window]
windows ((Ptr Window -> IO ()) -> IO ()) -> (Ptr Window -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ Ptr Window
window_array ->
Display -> Ptr Window -> CInt -> IO ()
xRestackWindows Display
display Ptr Window
window_array (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Window] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Window]
windows))
foreign import ccall unsafe "HsXlib.h XRestackWindows"
xRestackWindows :: Display -> Ptr Window -> CInt -> IO ()