aboutsummaryrefslogtreecommitdiffstats
path: root/Circle.hs
diff options
context:
space:
mode:
authorPeter De Wachter <pdewacht@gmail.com>2007-06-21 21:11:25 +0200
committerPeter De Wachter <pdewacht@gmail.com>2007-06-21 21:11:25 +0200
commite015cdafd06f7d9bfe7d10a8a1d50c641bff1165 (patch)
tree665770a212ae8a5a23dec3fbb05daed08b81f58e /Circle.hs
parentb6100a85d26151aa7363344400909535e168c206 (diff)
downloadXMonadContrib-e015cdafd06f7d9bfe7d10a8a1d50c641bff1165.tar.gz
XMonadContrib-e015cdafd06f7d9bfe7d10a8a1d50c641bff1165.tar.xz
XMonadContrib-e015cdafd06f7d9bfe7d10a8a1d50c641bff1165.zip
Circle cleanups
darcs-hash:20070621191125-06a25-f2ca78bb2b6ecc561ee0de5d478a27f882c14caa.gz
Diffstat (limited to 'Circle.hs')
-rw-r--r--Circle.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/Circle.hs b/Circle.hs
index 3934847..fa09e87 100644
--- a/Circle.hs
+++ b/Circle.hs
@@ -28,19 +28,20 @@ import StackSet (integrate)
-- > import XMonadContrib.Circle
circle :: Layout a
-circle = Layout { doLayout = \r -> circleLayout r . integrate,
+circle = Layout { doLayout = \r -> return . circleLayout r . integrate,
modifyLayout = return . const Nothing }
-circleLayout :: Rectangle -> [a] -> X [(a, Rectangle)]
-circleLayout _ [] = return []
-circleLayout r (w:ws) = return $ (w, center r) : (zip ws sats)
- where sats = map (satellite r) $ take (length ws) [0, pi * 2 / fromIntegral (length ws) ..]
+circleLayout :: Rectangle -> [a] -> [(a, Rectangle)]
+circleLayout _ [] = []
+circleLayout r (w:ws) = master : rest
+ where master = (w, center r)
+ rest = zip ws $ map (satellite r) [0, pi * 2 / fromIntegral (length ws) ..]
center :: Rectangle -> Rectangle
center (Rectangle sx sy sw sh) = Rectangle x y w h
- where s = sqrt 2
- w = round ((fromIntegral sw / s) :: Double)
- h = round ((fromIntegral sh / s) :: Double)
+ where s = sqrt 2 :: Double
+ w = round (fromIntegral sw / s)
+ h = round (fromIntegral sh / s)
x = sx + fromIntegral (sw - w) `div` 2
y = sy + fromIntegral (sh - h) `div` 2