From 7a3035c299185d9af31601772c9607e8e1844027 Mon Sep 17 00:00:00 2001 From: Max Rabkin Date: Wed, 10 Mar 2010 18:01:59 +0100 Subject: Fix bugs with nested drawers in X.L.Drawer Ignore-this: 5c7665f3f3ea2c629deb0cca3715bb8d There were two bugs: 1. The layout modifier assumed the rect's x was zero. 2. The layout modifier assumed that the stackset's focus actually had focus. darcs-hash:20100310170159-a5338-19f7aa3df6ad57734d0ebc874e5d758935d19850.gz --- XMonad/Layout/Drawer.hs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'XMonad') diff --git a/XMonad/Layout/Drawer.hs b/XMonad/Layout/Drawer.hs index 04e900e..909ecfb 100644 --- a/XMonad/Layout/Drawer.hs +++ b/XMonad/Layout/Drawer.hs @@ -73,16 +73,17 @@ instance (LayoutClass l Window, Read (l Window)) => LayoutModifier (Drawer l) Wi (upD, upM) <- partitionM (hasProperty p) up_ (downD, downM) <- partitionM (hasProperty p) down_ b <- hasProperty p w + focusedWindow <- gets (fmap S.focus . stack . workspace . current . windowset) - let (rectD, stackD, stackM) = if b - then ( rectB - , Just $ stk { up=upD, down=downD } - , mkStack upM downM ) - else ( rectS - , mkStack upD downD - , Just $ stk { up=upM, down=downM } ) + let rectD = if b && Just w == focusedWindow then rectB else rectS - (winsD, _) <- runLayout (ws { layout=l , stack=stackD }) rectD + let (stackD, stackM) = if b + then ( Just $ stk { up=upD, down=downD } + , mkStack upM downM ) + else ( mkStack upD downD + , Just $ stk { up=upM, down=downM } ) + + (winsD, _) <- runLayout (ws { layout=l, stack=stackD }) rectD (winsM, u') <- runLayout (ws { stack=stackM }) rectM return (winsD ++ winsM, u') where @@ -91,7 +92,7 @@ instance (LayoutClass l Window, Read (l Window)) => LayoutModifier (Drawer l) Wi mkStack (x:xs) ys = Just (Stack { up=xs, S.focus=x, down=ys }) rectB = rect { rect_width=round $ fromIntegral (rect_width rect) * rb } - rectS = rectB { rect_x=round $ (rs - rb) * fromIntegral (rect_width rect) } + rectS = rectB { rect_x=rect_x rectB - (round $ (rb - rs) * fromIntegral (rect_width rect)) } rectM = rect { rect_x=rect_x rect + round (fromIntegral (rect_width rect) * rs) , rect_width=rect_width rect - round (fromIntegral (rect_width rect) * rs) } -- cgit v1.2.3