diff options
author | hughes <hughes@rpi.edu> | 2007-04-01 04:36:39 +0200 |
---|---|---|
committer | hughes <hughes@rpi.edu> | 2007-04-01 04:36:39 +0200 |
commit | 848630be73be585c990be09bb31321603b150dfd (patch) | |
tree | 58ba3c808fc5c29fd3ab2d5803fab985a8b5c486 | |
parent | f1b2946edb226e619b635a921e70416bcb4347c6 (diff) | |
download | xmonad-848630be73be585c990be09bb31321603b150dfd.tar.gz xmonad-848630be73be585c990be09bb31321603b150dfd.tar.xz xmonad-848630be73be585c990be09bb31321603b150dfd.zip |
Cleaned up layout a little bit
darcs-hash:20070401023639-3a569-2b7b3e7e7b2f26ebb77590053d8360ee736cfbc3.gz
-rw-r--r-- | Operations.hs | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/Operations.hs b/Operations.hs index decb42f..4e2ae49 100644 --- a/Operations.hs +++ b/Operations.hs @@ -41,8 +41,10 @@ refresh = do -- runRects draws the windows, figuring out their rectangles. -- The code here is for a horizontal split, and tr is possibly - -- used to convert to the vertical case. - runRects :: Rectangle -> (Rectangle -> Rectangle) -> (Rational -> Disposition -> Disposition) + -- used to convert to the vertical case. The comments + -- speak in terms of the horizontal case. + runRects :: Rectangle -> (Rectangle -> Rectangle) + -> (Rational -> Disposition -> Disposition) -> (Disposition -> Rational) -> Rational -> [Window] -> X () runRects _ _ _ _ _ [] = return () -- impossible runRects (Rectangle sx sy sw sh) tr dfix fracFn tf (w:s) = do @@ -83,12 +85,25 @@ refresh = do [] -> return () [w] -> fullWindow w s -> case l of - Horz -> runRects sc id (\r dp -> dp {horzFrac = r}) horzFrac (horzTileFrac fl) s - Vert -> runRects (flipRect sc) flipRect (\r dp -> dp {vertFrac = r}) vertFrac (vertTileFrac fl) s - _ -> error "Operations.refresh: the absurdly impossible happened. Please complain about this." + Horz -> (runRects sc + id + (\r dp -> dp {horzFrac = r}) + horzFrac + (horzTileFrac fl) + s) + Vert -> (runRects (flipRect sc) + flipRect + (\r dp -> dp {vertFrac = r}) + vertFrac + (vertTileFrac fl) + s) + _ -> error "Operations.refresh: the absurdly \ + \impossible happened. Please \ + \complain about this." whenJust (W.peek ws) setFocus --- | switchLayout. Switch to another layout scheme. Switches the current workspace. +-- | switchLayout. Switch to another layout scheme. Switches the +-- current workspace. switchLayout :: X () switchLayout = layout $ \fl -> fl { layoutType = rot (layoutType fl) } @@ -97,7 +112,9 @@ changeVert :: Rational -> X () changeVert delta = do l <- gets (layoutType . currentDesc) case l of - Vert -> layout $ \d -> d {vertTileFrac = min 1 $ max 0 $ vertTileFrac d + delta} + Vert -> layout $ \d -> d {vertTileFrac = min 1 $ + max 0 $ + vertTileFrac d + delta} _ -> return () -- | changeHorz. Changes the horizontal split, if it's visible. @@ -105,7 +122,9 @@ changeHorz :: Rational -> X () changeHorz delta = do l <- gets (layoutType . currentDesc) case l of - Horz -> layout $ \d -> d {horzTileFrac = min 1 $ max 0 $ horzTileFrac d + delta} + Horz -> layout $ \d -> d {horzTileFrac = min 1 $ + max 0 $ + horzTileFrac d + delta} _ -> return () -- | changeSize. Changes the size of the window, except in Full mode, with the @@ -114,14 +133,17 @@ changeSize :: Rational -> Rational -> X () changeSize delta mini = do l <- gets (layoutType . currentDesc) mw <- gets (W.peek . workspace) - whenJust mw $ \w -> do - case l of -- This is always Just. + whenJust mw $ \w -> do -- This is always Just. + case l of Full -> return () - Horz -> disposeW w $ \d -> d {horzFrac = max mini $ horzFrac d + delta} - Vert -> disposeW w $ \d -> d {vertFrac = max mini $ vertFrac d + delta} -- hrm... + Horz -> disposeW w $ \d -> d {horzFrac = max mini $ + horzFrac d + delta} + Vert -> disposeW w $ \d -> d {vertFrac = max mini $ + vertFrac d + delta} -- hrm... refresh --- | layout. Modify the current workspace's layout with a pure function and refresh. +-- | layout. Modify the current workspace's layout with a pure +-- function and refresh. layout :: (LayoutDesc -> LayoutDesc) -> X () layout f = do modify $ \s -> |