summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-05-21 17:27:59 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-05-21 17:27:59 +0200
commit4c5cce8383eda80ffe686d93dcac57b84e4fa29f (patch)
tree95b5fc6d4a3f727cc583c6b209211db0a6ad9fe5
parent747b8666a6176082177d4a32f5fe201f133826d2 (diff)
downloadmetatile-4c5cce8383eda80ffe686d93dcac57b84e4fa29f.tar
metatile-4c5cce8383eda80ffe686d93dcac57b84e4fa29f.zip
Make screen info dynamic: first step to supporting randr
darcs-hash:20070521152759-a5988-736e7caea5252a77bb01d7631cce0db4287ff6f2
-rw-r--r--Main.hs8
-rw-r--r--Operations.hs6
-rw-r--r--XMonad.hs6
3 files changed, 10 insertions, 10 deletions
diff --git a/Main.hs b/Main.hs
index 9aef16f..a38df80 100644
--- a/Main.hs
+++ b/Main.hs
@@ -45,19 +45,19 @@ main = do
let safeLayouts = case defaultLayouts of [] -> (full, []); (x:xs) -> (x, xs)
cf = XConf
{ display = dpy
- , xineScreens = xinesc
, theRoot = rootw
, wmdelete = wmdelt
, wmprotocols = wmprot
-- fromIntegral needed for X11 versions that use Int instead of CInt.
- , dimensions = (fromIntegral (displayWidth dpy dflt),
- fromIntegral (displayHeight dpy dflt))
, normalBorder = nbc
, focusedBorder = fbc
}
st = XState
{ windowset = new (fromIntegral workspaces) (fromIntegral $ length xinesc)
- , layouts = M.fromList [(w, safeLayouts) | w <- [0 .. W workspaces - 1]] }
+ , layouts = M.fromList [(w, safeLayouts) | w <- [0 .. W workspaces - 1]]
+ , xineScreens = xinesc
+ , dimensions = (fromIntegral (displayWidth dpy dflt),
+ fromIntegral (displayHeight dpy dflt)) }
xSetErrorHandler -- in C, I'm too lazy to write the binding: dons
diff --git a/Operations.hs b/Operations.hs
index 37dbafe..c438528 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -100,7 +100,7 @@ windows f = modify (\s -> s { windowset = f (windowset s) }) >> refresh
-- | hide. Hide a window by moving it off screen.
hide :: Window -> X ()
hide w = withDisplay $ \d -> do
- (sw,sh) <- asks dimensions
+ (sw,sh) <- gets dimensions
io $ moveWindow d w (2*fromIntegral sw) (2*fromIntegral sh)
-- | refresh. Render the currently visible workspaces, as determined by
@@ -111,8 +111,8 @@ hide w = withDisplay $ \d -> do
--
refresh :: X ()
refresh = do
- XState { windowset = ws, layouts = fls } <- get
- XConf { xineScreens = xinesc, display = d } <- ask
+ XState { windowset = ws, layouts = fls, xineScreens = xinesc } <- get
+ d <- asks display
-- for each workspace, layout the currently visible workspaces
(`mapM_` (W.current ws : W.visible ws)) $ \w -> do
diff --git a/XMonad.hs b/XMonad.hs
index cb9ead5..0355e6f 100644
--- a/XMonad.hs
+++ b/XMonad.hs
@@ -39,6 +39,9 @@ import qualified Data.Map as M
-- Just the display, width, height and a window list
data XState = XState
{ windowset :: !WindowSet -- ^ workspace list
+ , xineScreens :: ![Rectangle] -- ^ dimensions of each screen
+ , dimensions :: !(Int,Int) -- ^ dimensions of the screen,
+ -- used for hiding windows
, layouts :: !(M.Map WorkspaceId (Layout, [Layout])) }
-- ^ mapping of workspaces to descriptions of their layouts
@@ -48,10 +51,7 @@ data XConf = XConf
, theRoot :: !Window -- ^ the root window
, wmdelete :: !Atom -- ^ window deletion atom
, wmprotocols :: !Atom -- ^ wm protocols atom
- , dimensions :: !(Int,Int) -- ^ dimensions of the screen,
- -- used for hiding windows
- , xineScreens :: ![Rectangle] -- ^ dimensions of each screen
, normalBorder :: !Color -- ^ border color of unfocused windows
, focusedBorder :: !Color } -- ^ border color of the focused window