module Graphics.X11.Xinerama (
XineramaScreenInfo(..),
xineramaIsActive,
xineramaQueryExtension,
xineramaQueryVersion,
xineramaQueryScreens,
compiledWithXinerama,
getScreenInfo
) where
import Foreign
import Foreign.C.Types
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras (WindowAttributes(..), getWindowAttributes)
import Control.Monad
data XineramaScreenInfo = XineramaScreenInfo
{ xsi_screen_number :: !CInt,
xsi_x_org :: !CShort,
xsi_y_org :: !CShort,
xsi_width :: !CShort,
xsi_height :: !CShort }
deriving (Show)
getScreenInfo :: Display -> IO [Rectangle]
getScreenInfo dpy = do
mxs <- xineramaQueryScreens dpy
case mxs of
Just xs -> return . map xsiToRect $ xs
Nothing -> do
wa <- getWindowAttributes dpy (defaultRootWindow dpy)
return $ [Rectangle
{ rect_x = fromIntegral $ wa_x wa
, rect_y = fromIntegral $ wa_y wa
, rect_width = fromIntegral $ wa_width wa
, rect_height = fromIntegral $ wa_height wa }]
where
xsiToRect xsi = Rectangle
{ rect_x = fromIntegral $ xsi_x_org xsi
, rect_y = fromIntegral $ xsi_y_org xsi
, rect_width = fromIntegral $ xsi_width xsi
, rect_height = fromIntegral $ xsi_height xsi
}
compiledWithXinerama :: Bool
compiledWithXinerama = False
xineramaIsActive :: Display -> IO Bool
xineramaIsActive _ = return False
xineramaQueryExtension :: Display -> IO (Maybe (CInt, CInt))
xineramaQueryExtension _ = return Nothing
xineramaQueryVersion :: Display -> IO (Maybe (CInt, CInt))
xineramaQueryVersion _ = return Nothing
xineramaQueryScreens :: Display -> IO (Maybe [XineramaScreenInfo])
xineramaQueryScreens _ = return Nothing