aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout/Mosaic.hs
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2009-02-10 03:27:27 +0100
committerAdam Vogt <vogt.adam@gmail.com>2009-02-10 03:27:27 +0100
commit059278bcd17a6598583d4c8ad2a34822fd061779 (patch)
treed9ef99c0871d05ae289cd54ef4b0c40b13888f0e /XMonad/Layout/Mosaic.hs
parentaa7e7be7a4007b21d4ef8b5a2c1b2e200ee3712a (diff)
downloadXMonadContrib-059278bcd17a6598583d4c8ad2a34822fd061779.tar.gz
XMonadContrib-059278bcd17a6598583d4c8ad2a34822fd061779.tar.xz
XMonadContrib-059278bcd17a6598583d4c8ad2a34822fd061779.zip
X.L.Mosaic: prevent users from causing non-termination with negative elements
Ignore-this: 370a7d6249906f1743c6692758ce5aeb darcs-hash:20090210022727-1499c-f2fdcd99704982a75cedc877b81689453a4303fc.gz
Diffstat (limited to 'XMonad/Layout/Mosaic.hs')
-rw-r--r--XMonad/Layout/Mosaic.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/XMonad/Layout/Mosaic.hs b/XMonad/Layout/Mosaic.hs
index 9f726f7..eca1978 100644
--- a/XMonad/Layout/Mosaic.hs
+++ b/XMonad/Layout/Mosaic.hs
@@ -71,10 +71,11 @@ data Aspect
instance Message Aspect
data Mosaic a
- {- | The relative magnitudes of the positive rational numbers provided
- determine the relative areas that the windows receive. The first
- number represents the size of the master window, the second is for the
- next window in the stack, and so on.
+ {- | The relative magnitudes (the sign is ignored) of the rational numbers
+ - provided determine the relative areas that the windows receive. The
+ - first number represents the size of the master window, the second is for
+ - the next window in the stack, and so on. Windows without a list element
+ - are hidden.
-}
= Mosaic [Rational]
-- override the aspect? current index, maximum index
@@ -141,7 +142,8 @@ shrinkMaster [] = []
shrinkMaster (x:xs) = x/2:xs
splits :: Int -> Rectangle -> [Rational] -> [[Rectangle]]
-splits num rect sz = splitsL rect $ makeTree $ normalize $ reverse $ take num sz
+splits num rect sz = splitsL rect $ makeTree $ normalize
+ $ map abs $ reverse $ take num sz
-- recursively enumerate splits
splitsL :: Rectangle -> Tree Rational -> [[Rectangle]]