From abc827b6ff90cc4f4fc4b4831383203e6c7acee2 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Sun, 27 Jan 2008 15:02:19 +0100 Subject: LayoutModifier add a modifyLayout Many layouts are written as layout modifiers because they need to change the stack of the rectangle before executing doLayout. This is a major source of bugs. all layout modifiers should be using the LayoutModifier class. This method (modifyLayout) can be used to manipulate the rectangle and the stack before running doLayout by the layout modifier. darcs-hash:20080127140219-32816-bc3dbfc0be08587b94acead49f384e72c89e2df0.gz --- XMonad/Layout/LayoutModifier.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'XMonad/Layout/LayoutModifier.hs') diff --git a/XMonad/Layout/LayoutModifier.hs b/XMonad/Layout/LayoutModifier.hs index 933b4e7..46cabd6 100644 --- a/XMonad/Layout/LayoutModifier.hs +++ b/XMonad/Layout/LayoutModifier.hs @@ -33,6 +33,9 @@ import XMonad.StackSet ( Stack ) -- "XMonad.Layout.Magnifier", "XMonad.Layout.NoBorder", class (Show (m a), Read (m a)) => LayoutModifier m a where + modifyLayout :: (LayoutClass l a) => m a -> l a -> Rectangle + -> Stack a -> X ([(a, Rectangle)], Maybe (l a)) + modifyLayout _ l r s = doLayout l r s handleMess :: m a -> SomeMessage -> X (Maybe (m a)) handleMess m mess | Just Hide <- fromMessage mess = doUnhook | Just ReleaseResources <- fromMessage mess = doUnhook @@ -61,7 +64,7 @@ class (Show (m a), Read (m a)) => LayoutModifier m a where instance (LayoutModifier m a, LayoutClass l a) => LayoutClass (ModifiedLayout m l) a where doLayout (ModifiedLayout m l) r s = - do (ws, ml') <- doLayout l r s + do (ws, ml') <- modifyLayout m l r s (ws', mm') <- redoLayout m r s ws let ml'' = case mm' of Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml' -- cgit v1.2.3