aboutsummaryrefslogtreecommitdiffstats
path: root/ResizableTile.hs
diff options
context:
space:
mode:
authorJamie Webb <gentoo-haskell@vcs.intern>2007-10-02 02:12:54 +0200
committerJamie Webb <gentoo-haskell@vcs.intern>2007-10-02 02:12:54 +0200
commit891963a5f8893d45dca50b95779710a3455cd358 (patch)
tree2e320f3d74fe62d99601d0fa1ca77f95b1b3de99 /ResizableTile.hs
parent6060531fd561afa1f6f03c0c6d223a73eece7886 (diff)
downloadXMonadContrib-891963a5f8893d45dca50b95779710a3455cd358.tar.gz
XMonadContrib-891963a5f8893d45dca50b95779710a3455cd358.tar.xz
XMonadContrib-891963a5f8893d45dca50b95779710a3455cd358.zip
Fix infinite loop in ResizableTile serialization
darcs-hash:20071002001254-74a73-8e30b0bdd3f3fe8a3c7754e564a8bbf1532149c2.gz
Diffstat (limited to 'ResizableTile.hs')
-rw-r--r--ResizableTile.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/ResizableTile.hs b/ResizableTile.hs
index 7f0fa60..77ec8fd 100644
--- a/ResizableTile.hs
+++ b/ResizableTile.hs
@@ -34,7 +34,7 @@ import Control.Monad
--
-- and redefine "tiled" as:
--
--- > tiled = T.Tall nmaster delta ratio (repeat 1)
+-- > tiled = T.Tall nmaster delta ratio []
data MirrorResize = MirrorShrink | MirrorExpand deriving Typeable
instance Message MirrorResize
@@ -43,7 +43,7 @@ data Tall a = Tall Int Rational Rational [Rational] deriving (Show, Read)
instance Layout Tall a where
doLayout (Tall nmaster _ frac mfrac) r =
return . (\x->(x,Nothing)) .
- ap zip (tile frac mfrac r nmaster . length) . W.integrate
+ ap zip (tile frac (mfrac ++ repeat 1) r nmaster . length) . W.integrate
handleMessage (Tall nmaster delta frac mfrac) m =
do ms <- (W.stack . W.workspace . W.current) `fmap` gets windowset
case ms of
@@ -57,10 +57,9 @@ instance Layout Tall a where
mresize MirrorExpand s = mresize' s (0-delta)
mresize' s d = let n = length $ W.up s
total = n + (length $ W.down s) + 1
- in Tall nmaster delta frac
- (modifymfrac mfrac d (if n == (nmaster-1) || n == (total-1)
- then n-1
- else n))
+ pos = if n == (nmaster-1) || n == (total-1) then n-1 else n
+ mfrac' = modifymfrac (mfrac ++ repeat 1) d pos
+ in Tall nmaster delta frac $ take total mfrac'
modifymfrac [] _ _ = []
modifymfrac (f:fx) d n | n == 0 = f+d : fx
| otherwise = f : modifymfrac fx d (n-1)