/usr/lib/hugs/packages/X11/Graphics/X11/Xlib/Window.hs is in libhugs-x11-bundled 98.200609.21-5.4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | -----------------------------------------------------------------------------
-- |
-- Module : Graphics.X11.Xlib.Window
-- Copyright : (c) Alastair Reid, 1999-2003
-- License : BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer : libraries@haskell.org
-- Stability : provisional
-- Portability : portable
--
-- A collection of FFI declarations for interfacing with Xlib Windows.
--
-----------------------------------------------------------------------------
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
----------------------------------------------------------------
-- Windows
----------------------------------------------------------------
-- | interface to the X11 library function @XStoreName()@.
storeName :: Display -> Window -> String -> IO ()
storeName display window name =
withCString name $ \ c_name ->
xStoreName display window c_name
foreign import ccall unsafe "HsXlib.h XStoreName"
xStoreName :: Display -> Window -> CString -> IO ()
-- | interface to the X11 library function @XCreateSimpleWindow()@.
foreign import ccall unsafe "HsXlib.h XCreateSimpleWindow"
createSimpleWindow :: Display -> Window -> Position -> Position ->
Dimension -> Dimension -> Int -> Pixel -> Pixel -> IO Window
-- | interface to the X11 library function @XCreateWindow()@.
foreign import ccall unsafe "HsXlib.h XCreateWindow"
createWindow :: Display -> Window -> Position -> Position ->
Dimension -> Dimension -> Int -> Int -> WindowClass ->
Visual -> AttributeMask -> Ptr SetWindowAttributes -> IO Window
----------------------------------------------------------------
--ToDo: find an effective way to use Maybes
-- | interface to the X11 library function @XTranslateCoordinates()@.
translateCoordinates :: Display -> Window -> Window -> Position -> Position ->
IO (Bool,Position,Position,Window)
translateCoordinates display src_w dest_w src_x src_y =
alloca $ \ dest_x_return ->
alloca $ \ dest_y_return ->
alloca $ \ child_return -> do
res <- xTranslateCoordinates display src_w dest_w src_x src_y
dest_x_return dest_y_return child_return
dest_x <- peek dest_x_return
dest_y <- peek dest_y_return
child <- peek child_return
return (res, dest_x, dest_y, child)
foreign import ccall unsafe "HsXlib.h XTranslateCoordinates"
xTranslateCoordinates :: Display -> Window -> Window ->
Position -> Position ->
Ptr Position -> Ptr Position -> Ptr Window -> IO Bool
-- | interface to the X11 library function @XMoveResizeWindow()@.
foreign import ccall unsafe "HsXlib.h XMoveResizeWindow"
moveResizeWindow :: Display -> Window -> Position -> Position -> Dimension -> Dimension -> IO ()
-- | interface to the X11 library function @XResizeWindow()@.
foreign import ccall unsafe "HsXlib.h XResizeWindow"
resizeWindow :: Display -> Window -> Dimension -> Dimension -> IO ()
-- | interface to the X11 library function @XMoveWindow()@.
foreign import ccall unsafe "HsXlib.h XMoveWindow"
moveWindow :: Display -> Window -> Position -> Position -> IO ()
-- | interface to the X11 library function @XReparentWindow()@.
foreign import ccall unsafe "HsXlib.h XReparentWindow"
reparentWindow :: Display -> Window -> Window -> Position -> Position -> IO ()
-- | interface to the X11 library function @XMapSubwindows()@.
foreign import ccall unsafe "HsXlib.h XMapSubwindows"
mapSubwindows :: Display -> Window -> IO ()
-- | interface to the X11 library function @XUnmapSubwindows()@.
foreign import ccall unsafe "HsXlib.h XUnmapSubwindows"
unmapSubwindows :: Display -> Window -> IO ()
-- | interface to the X11 library function @XMapWindow()@.
foreign import ccall unsafe "HsXlib.h XMapWindow"
mapWindow :: Display -> Window -> IO ()
-- Disnae exist: %fun XUnmapWindows :: Display -> Window -> IO ()
-- Disnae exist: %fun XMapRaisedWindow :: Display -> Window -> IO ()
-- | interface to the X11 library function @XLowerWindow()@.
foreign import ccall unsafe "HsXlib.h XLowerWindow"
lowerWindow :: Display -> Window -> IO ()
-- | interface to the X11 library function @XRaiseWindow()@.
foreign import ccall unsafe "HsXlib.h XRaiseWindow"
raiseWindow :: Display -> Window -> IO ()
-- | interface to the X11 library function @XCirculateSubwindowsDown()@.
foreign import ccall unsafe "HsXlib.h XCirculateSubwindowsDown"
circulateSubwindowsDown :: Display -> Window -> IO ()
-- | interface to the X11 library function @XCirculateSubwindowsUp()@.
foreign import ccall unsafe "HsXlib.h XCirculateSubwindowsUp"
circulateSubwindowsUp :: Display -> Window -> IO ()
-- | interface to the X11 library function @XCirculateSubwindows()@.
foreign import ccall unsafe "HsXlib.h XCirculateSubwindows"
circulateSubwindows :: Display -> Window -> CirculationDirection -> IO ()
-- | interface to the X11 library function @XIconifyWindow()@.
iconifyWindow :: Display -> Window -> ScreenNumber -> IO ()
iconifyWindow display window screenno =
throwIfZero "iconifyWindow"
(xIconifyWindow display window screenno)
foreign import ccall unsafe "HsXlib.h XIconifyWindow"
xIconifyWindow :: Display -> Window -> ScreenNumber -> IO Status
-- | interface to the X11 library function @XWithdrawWindow()@.
withdrawWindow :: Display -> Window -> ScreenNumber -> IO ()
withdrawWindow display window screenno =
throwIfZero "withdrawWindow"
(xWithdrawWindow display window screenno)
foreign import ccall unsafe "HsXlib.h XWithdrawWindow"
xWithdrawWindow :: Display -> Window -> ScreenNumber -> IO Status
-- | interface to the X11 library function @XDestroyWindow()@.
foreign import ccall unsafe "HsXlib.h XDestroyWindow"
destroyWindow :: Display -> Window -> IO ()
-- | interface to the X11 library function @XDestroySubwindows()@.
foreign import ccall unsafe "HsXlib.h XDestroySubwindows"
destroySubwindows :: Display -> Window -> IO ()
-- | interface to the X11 library function @XSetWindowBorder()@.
foreign import ccall unsafe "HsXlib.h XSetWindowBorder"
setWindowBorder :: Display -> Window -> Pixel -> IO ()
-- | interface to the X11 library function @XSetWindowBorderPixmap()@.
foreign import ccall unsafe "HsXlib.h XSetWindowBorderPixmap"
setWindowBorderPixmap :: Display -> Window -> Pixmap -> IO ()
-- | interface to the X11 library function @XSetWindowBorderWidth()@.
foreign import ccall unsafe "HsXlib.h XSetWindowBorderWidth"
setWindowBorderWidth :: Display -> Window -> Dimension -> IO ()
-- | interface to the X11 library function @XSetWindowBackground()@.
foreign import ccall unsafe "HsXlib.h XSetWindowBackground"
setWindowBackground :: Display -> Window -> Pixel -> IO ()
-- | interface to the X11 library function @XSetWindowBackgroundPixmap()@.
foreign import ccall unsafe "HsXlib.h XSetWindowBackgroundPixmap"
setWindowBackgroundPixmap :: Display -> Window -> Pixmap -> IO ()
-- | interface to the X11 library function @XSetWindowColormap()@.
foreign import ccall unsafe "HsXlib.h XSetWindowColormap"
setWindowColormap :: Display -> Window -> Colormap -> IO ()
-- | interface to the X11 library function @XAddToSaveSet()@.
foreign import ccall unsafe "HsXlib.h XAddToSaveSet"
addToSaveSet :: Display -> Window -> IO ()
-- | interface to the X11 library function @XRemoveFromSaveSet()@.
foreign import ccall unsafe "HsXlib.h XRemoveFromSaveSet"
removeFromSaveSet :: Display -> Window -> IO ()
-- | interface to the X11 library function @XChangeSaveSet()@.
foreign import ccall unsafe "HsXlib.h XChangeSaveSet"
changeSaveSet :: Display -> Window -> ChangeSaveSetMode -> IO ()
-- | interface to the X11 library function @XClearWindow()@.
foreign import ccall unsafe "HsXlib.h XClearWindow"
clearWindow :: Display -> Window -> IO ()
-- | interface to the X11 library function @XClearArea()@.
foreign import ccall unsafe "HsXlib.h XClearArea"
clearArea :: Display -> Window ->
Position -> Position -> Dimension -> Dimension -> Bool -> IO ()
-- This is almost good enough - but doesn't call XFree
-- -- %errfun BadStatus XQueryTree :: Display -> Window -> IO (Window, Window, ListWindow) using err = XQueryTree(arg1,arg2,&res1,&res2,&res3,&res3_size)
-- %prim XQueryTree :: Display -> Window -> IO (Window, Window, ListWindow)
-- Window root_w, parent;
-- Int children_size;
-- Window *children;
-- Status r = XQueryTree(arg1,arg2,&root_w, &parent, &children, &children_size);
-- if (Success != r) { %failWith(BadStatus,r); }
-- %update(root_w,parent,children);
-- XFree(children);
-- return;
-- | interface to the X11 library function @XRestackWindows()@.
restackWindows :: Display -> [Window] -> IO ()
restackWindows display windows =
withArray windows $ \ window_array ->
xRestackWindows display window_array (length windows)
foreign import ccall unsafe "HsXlib.h XRestackWindows"
xRestackWindows :: Display -> Ptr Window -> Int -> IO ()
-- ToDo: I want to be able to write this
-- -- %fun XListInstalledColormaps :: Display -> Window -> IO ListColormap using res1 = XListInstalledColormaps(arg1,arg2,&res1_size)
-- -- But I have to write this instead - need to add a notion of cleanup code!
-- %prim XListInstalledColormaps :: Display -> Window -> IO ListColormap
-- Int r_size;
-- Colormap* r = XListInstalledColormaps(arg1,arg2,&r_size);
-- %update(r);
-- XFree(r);
-- return;
--
-- -- Again, this is almost good enough
-- -- %errfun BadStatus XGetCommand :: Display -> Window -> IO ListString using err = XGetCommand(arg1,arg2,&res1,&res1_size)
-- -- but not quite
-- -- %prim XGetCommand :: Display -> Window -> IO ListString
-- --Int argv_size;
-- --String *argv;
-- --Status r = XGetCommand(arg1,arg2,&argv,&argv_size);
-- --if (Success != r) { %failWith(BadStatus, r); }
-- -- %update(argv);
-- --XFreeStringList(argv);
-- --return;
--
-- -- %fun XSetCommand :: Display -> Window -> ListString -> IO () using XSetCommand(arg1,arg2,arg3,res3_size)
--
-- %errfun BadStatus XGetTransientForHint :: Display -> Window -> IO Window using err = XGetTransientForHint(arg1,arg2,&res1)
--
-- %fun XSetTransientForHint :: Display -> Window -> Window -> IO ()
--
-- -- XRotateWindowProperties omitted
-- -- XGetWindowProperty omitted
--
-- -- XGetWindowAttributes omitted
-- -- XChangeWindowAttributes omitted
----------------------------------------------------------------
-- End
----------------------------------------------------------------
|