LayoutModifier: add emptyLayoutMod for dealing with empty workspaces

This commit is contained in:
Andrea Rossato 2008-01-24 01:56:05 +00:00
parent efc4ad95b8
commit e9f0f05217

View File

@ -49,6 +49,9 @@ class (Show (m a), Read (m a)) => LayoutModifier m a where
pureModifier :: m a -> Rectangle -> Stack a -> [(a, Rectangle)]
-> ([(a, Rectangle)], Maybe (m a))
pureModifier _ _ _ wrs = (wrs, Nothing)
emptyLayoutMod :: m a -> Rectangle -> [(a, Rectangle)]
-> X ([(a, Rectangle)], Maybe (m a))
emptyLayoutMod _ _ _ = return ([], Nothing)
hook :: m a -> X ()
hook _ = return ()
unhook :: m a -> X ()
@ -64,6 +67,13 @@ instance (LayoutModifier m a, LayoutClass l a) => LayoutClass (ModifiedLayout m
Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml'
Nothing -> ModifiedLayout m `fmap` ml'
return (ws', ml'')
emptyLayout (ModifiedLayout m l) r =
do (ws, ml') <- emptyLayout l r
(ws',mm') <- emptyLayoutMod m r ws
let ml'' = case mm' of
Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml'
Nothing -> ModifiedLayout m `fmap` ml'
return (ws', ml'')
handleMessage (ModifiedLayout m l) mess =
do mm' <- handleMessOrMaybeModifyIt m mess
ml' <- case mm' of