module Graphics.X11.Xlib.Display(
allPlanes_aux,
blackPixel,
whitePixel,
connectionNumber,
defaultColormap,
defaultGC,
defaultDepth,
defaultScreen,
defaultScreenOfDisplay,
displayHeight,
displayHeightMM,
displayWidth,
displayWidthMM,
maxRequestSize,
displayMotionBufferSize,
resourceManagerString,
screenResourceString,
displayString,
imageByteOrder,
protocolRevision,
protocolVersion,
serverVendor,
screenCount,
defaultVisual,
displayCells,
displayPlanes,
screenOfDisplay,
defaultRootWindow,
rootWindow,
qLength,
noOp,
openDisplay,
closeDisplay,
) where
import Graphics.X11.Types
import Graphics.X11.Xlib.Types
import Foreign (throwIfNull, Ptr)
import Foreign.C
import System.IO.Unsafe
foreign import ccall unsafe "HsXlib.h XAllPlanes"
allPlanes_aux :: Pixel
foreign import ccall unsafe "HsXlib.h XBlackPixel"
blackPixel :: Display -> ScreenNumber -> Pixel
foreign import ccall unsafe "HsXlib.h XWhitePixel"
whitePixel :: Display -> ScreenNumber -> Pixel
foreign import ccall unsafe "HsXlib.h XConnectionNumber"
connectionNumber :: Display -> CInt
foreign import ccall unsafe "HsXlib.h XDefaultColormap"
defaultColormap :: Display -> ScreenNumber -> Colormap
foreign import ccall unsafe "HsXlib.h XDefaultGC"
defaultGC :: Display -> ScreenNumber -> GC
foreign import ccall unsafe "HsXlib.h XDefaultDepth"
defaultDepth :: Display -> ScreenNumber -> CInt
foreign import ccall unsafe "HsXlib.h XDefaultScreen"
defaultScreen :: Display -> ScreenNumber
foreign import ccall unsafe "HsXlib.h XDefaultScreenOfDisplay"
defaultScreenOfDisplay :: Display -> Screen
foreign import ccall unsafe "HsXlib.h XDisplayHeight"
displayHeight :: Display -> ScreenNumber -> CInt
foreign import ccall unsafe "HsXlib.h XDisplayHeightMM"
displayHeightMM :: Display -> ScreenNumber -> CInt
foreign import ccall unsafe "HsXlib.h XDisplayWidth"
displayWidth :: Display -> ScreenNumber -> CInt
foreign import ccall unsafe "HsXlib.h XDisplayWidthMM"
displayWidthMM :: Display -> ScreenNumber -> CInt
foreign import ccall unsafe "HsXlib.h XMaxRequestSize"
maxRequestSize :: Display -> CInt
foreign import ccall unsafe "HsXlib.h XDisplayMotionBufferSize"
displayMotionBufferSize :: Display -> CInt
resourceManagerString :: Display -> String
resourceManagerString :: Display -> String
resourceManagerString Display
display = IO CString -> String
xlibCString (Display -> IO CString
xResourceManagerString Display
display)
foreign import ccall unsafe "HsXlib.h XResourceManagerString"
xResourceManagerString :: Display -> IO CString
screenResourceString :: Screen -> String
screenResourceString :: Screen -> String
screenResourceString Screen
screen = IO CString -> String
xlibCString (Screen -> IO CString
xScreenResourceString Screen
screen)
foreign import ccall unsafe "HsXlib.h XScreenResourceString"
xScreenResourceString :: Screen -> IO CString
displayString :: Display -> String
displayString :: Display -> String
displayString Display
display = IO CString -> String
xlibCString (Display -> IO CString
xDisplayString Display
display)
foreign import ccall unsafe "HsXlib.h XDisplayString"
xDisplayString :: Display -> IO CString
foreign import ccall unsafe "HsXlib.h XImageByteOrder"
imageByteOrder :: Display -> CInt
foreign import ccall unsafe "HsXlib.h XProtocolRevision"
protocolRevision :: Display -> CInt
foreign import ccall unsafe "HsXlib.h XProtocolVersion"
protocolVersion :: Display -> CInt
serverVendor :: Display -> String
serverVendor :: Display -> String
serverVendor Display
display = IO CString -> String
xlibCString (Display -> IO CString
xServerVendor Display
display)
foreign import ccall unsafe "HsXlib.h XServerVendor"
xServerVendor :: Display -> IO CString
foreign import ccall unsafe "HsXlib.h XScreenCount"
screenCount :: Display -> CInt
foreign import ccall unsafe "HsXlib.h XDefaultVisual"
defaultVisual :: Display -> ScreenNumber -> Visual
foreign import ccall unsafe "HsXlib.h XDisplayCells"
displayCells :: Display -> ScreenNumber -> CInt
foreign import ccall unsafe "HsXlib.h XDisplayPlanes"
displayPlanes :: Display -> ScreenNumber -> CInt
foreign import ccall unsafe "HsXlib.h XScreenOfDisplay"
screenOfDisplay :: Display -> ScreenNumber -> Screen
foreign import ccall unsafe "HsXlib.h XDefaultRootWindow"
defaultRootWindow :: Display -> Window
foreign import ccall unsafe "HsXlib.h XRootWindow"
rootWindow :: Display -> ScreenNumber -> IO Window
foreign import ccall unsafe "HsXlib.h XQLength"
qLength :: Display -> IO CInt
foreign import ccall unsafe "HsXlib.h XNoOp"
noOp :: Display -> IO ()
openDisplay :: String -> IO Display
openDisplay :: String -> IO Display
openDisplay String
name =
forall a. String -> (CString -> IO a) -> IO a
withCString String
name forall a b. (a -> b) -> a -> b
$ \ CString
c_name -> do
Ptr Display
display <- forall a. String -> IO (Ptr a) -> IO (Ptr a)
throwIfNull String
"openDisplay" (CString -> IO (Ptr Display)
xOpenDisplay CString
c_name)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Display -> Display
Display Ptr Display
display)
foreign import ccall unsafe "HsXlib.h XOpenDisplay"
xOpenDisplay :: CString -> IO (Ptr Display)
foreign import ccall unsafe "HsXlib.h XCloseDisplay"
closeDisplay :: Display -> IO ()
xlibCString :: IO CString -> String
xlibCString :: IO CString -> String
xlibCString IO CString
act = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ do
CString
cs <- IO CString
act
CString -> IO String
peekCString CString
cs