From 395b934efb901fa5bdca4046e047b9592e9771ce Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Tue, 22 May 2007 06:02:28 +0200 Subject: Add preliminary randr support darcs-hash:20070522040228-a5988-1ae9fc6bd773b32bc4a4c43aeab556857929fef4.gz --- Operations.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Operations.hs') diff --git a/Operations.hs b/Operations.hs index 62d0d51..16a46f7 100644 --- a/Operations.hs +++ b/Operations.hs @@ -28,6 +28,7 @@ import Control.Monad.Reader import Control.Arrow import Graphics.X11.Xlib +import Graphics.X11.Xinerama (getScreenInfo) import Graphics.X11.Xlib.Extras -- --------------------------------------------------------------------- @@ -155,6 +156,25 @@ tileWindow d w r = do -- --------------------------------------------------------------------- +-- | rescreen. The screen configuration may have changed, update the state and +-- refresh the screen. +rescreen :: X () +rescreen = do + dpy <- asks display + xinesc <- io $ getScreenInfo dpy + -- TODO: This stuff is necessary because Xlib apparently caches screen + -- width/height. Find a better solution later. I hate Xlib. + let sx = maximum $ map (\r -> rect_x r + fromIntegral (rect_width r)) xinesc + sy = maximum $ map (\r -> rect_y r + fromIntegral (rect_height r)) xinesc + modify (\s -> s { xineScreens = xinesc, dimensions = (sx, sy) }) + windows $ \ws@(W.StackSet { W.current = v, W.visible = vs, W.hidden = hs }) -> + let (x:xs, ys) = splitAt (length xinesc) $ map W.workspace (v:vs) ++ hs + in ws { W.current = W.Screen x 0 + , W.visible = zipWith W.Screen xs [1 ..] + , W.hidden = ys } + +-- --------------------------------------------------------------------- + buttonsToGrab :: [Button] buttonsToGrab = [button1, button2, button3] -- cgit v1.2.3