diff options
author | Lukas Mai <l.mai@web.de> | 2008-03-30 01:48:59 +0100 |
---|---|---|
committer | Lukas Mai <l.mai@web.de> | 2008-03-30 01:48:59 +0100 |
commit | 3e4327c00f0fa488b945b0df72291fcfff4c8e89 (patch) | |
tree | b1796a11497125666100b091c312181ca27c2f35 /XMonad | |
parent | b7806ba7c9dde861a305c0202f3c9024120a0fa7 (diff) | |
download | XMonadContrib-3e4327c00f0fa488b945b0df72291fcfff4c8e89.tar.gz XMonadContrib-3e4327c00f0fa488b945b0df72291fcfff4c8e89.tar.xz XMonadContrib-3e4327c00f0fa488b945b0df72291fcfff4c8e89.zip |
XMonad.Layout.Grid: fix indentation
darcs-hash:20080330004859-462cf-8623e0537e9d2dd8cd77bcc609d7e16982022ee2.gz
Diffstat (limited to 'XMonad')
-rw-r--r-- | XMonad/Layout/Grid.hs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/XMonad/Layout/Grid.hs b/XMonad/Layout/Grid.hs index 825f2bb..6dcd1bb 100644 --- a/XMonad/Layout/Grid.hs +++ b/XMonad/Layout/Grid.hs @@ -17,7 +17,7 @@ module XMonad.Layout.Grid ( -- * Usage -- $usage - Grid(..), arrange + Grid(..), arrange ) where import XMonad @@ -44,23 +44,23 @@ instance LayoutClass Grid a where arrange :: Rectangle -> [a] -> [(a, Rectangle)] arrange (Rectangle rx ry rw rh) st = zip st rectangles + where + nwins = length st + ncols = ceiling . (sqrt :: Double -> Double) . fromIntegral $ nwins + mincs = nwins `div` ncols + extrs = nwins - ncols * mincs + chop :: Int -> Dimension -> [(Position, Dimension)] + chop n m = ((0, m - k * fromIntegral (pred n)) :) . map (flip (,) k) . tail . reverse . take n . tail . iterate (subtract k') $ m' where - nwins = length st - ncols = ceiling . (sqrt :: Double -> Double) . fromIntegral $ nwins - mincs = nwins `div` ncols - extrs = nwins - ncols * mincs - chop :: Int -> Dimension -> [(Position, Dimension)] - chop n m = ((0, m - k * fromIntegral (pred n)) :) . map (flip (,) k) . tail . reverse . take n . tail . iterate (subtract k') $ m' - where - k :: Dimension - k = m `div` fromIntegral n - m' = fromIntegral m - k' :: Position - k' = fromIntegral k - xcoords = chop ncols rw - ycoords = chop mincs rh - ycoords' = chop (succ mincs) rh - (xbase, xext) = splitAt (ncols - extrs) xcoords - rectangles = combine ycoords xbase ++ combine ycoords' xext - where - combine ys xs = [Rectangle (rx + x) (ry + y) w h | (x, w) <- xs, (y, h) <- ys] + k :: Dimension + k = m `div` fromIntegral n + m' = fromIntegral m + k' :: Position + k' = fromIntegral k + xcoords = chop ncols rw + ycoords = chop mincs rh + ycoords' = chop (succ mincs) rh + (xbase, xext) = splitAt (ncols - extrs) xcoords + rectangles = combine ycoords xbase ++ combine ycoords' xext + where + combine ys xs = [Rectangle (rx + x) (ry + y) w h | (x, w) <- xs, (y, h) <- ys] |