diff options
author | Andrea Rossato <andrea.rossato@unibz.it> | 2008-01-22 12:13:19 +0100 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@unibz.it> | 2008-01-22 12:13:19 +0100 |
commit | 37656f4c9dd648d2801ab9a3dbcce9bce2239b29 (patch) | |
tree | 29d8303ea9c4c9a8144b4186a3cbc5bf54cdc77d | |
parent | 83e01e9718177e4dce65771268346ee6946e7d99 (diff) | |
download | XMonadContrib-37656f4c9dd648d2801ab9a3dbcce9bce2239b29.tar.gz XMonadContrib-37656f4c9dd648d2801ab9a3dbcce9bce2239b29.tar.xz XMonadContrib-37656f4c9dd648d2801ab9a3dbcce9bce2239b29.zip |
LayoutModifier: add pureMess and pureModifier to the LayoutModifier class
darcs-hash:20080122111319-32816-c35527f71b561f828a4c11cf215e5f2b24d2f539.gz
-rw-r--r-- | XMonad/Layout/LayoutModifier.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/XMonad/Layout/LayoutModifier.hs b/XMonad/Layout/LayoutModifier.hs index da0fad2..96772e4 100644 --- a/XMonad/Layout/LayoutModifier.hs +++ b/XMonad/Layout/LayoutModifier.hs @@ -36,14 +36,19 @@ class (Show (m a), Read (m a)) => LayoutModifier m a where handleMess :: m a -> SomeMessage -> X (Maybe (m a)) handleMess m mess | Just Hide <- fromMessage mess = doUnhook | Just ReleaseResources <- fromMessage mess = doUnhook - | otherwise = return Nothing + | otherwise = return $ pureMess m mess where doUnhook = do unhook m; return Nothing handleMessOrMaybeModifyIt :: m a -> SomeMessage -> X (Maybe (Either (m a) SomeMessage)) handleMessOrMaybeModifyIt m mess = do mm' <- handleMess m mess return (Left `fmap` mm') + pureMess :: m a -> SomeMessage -> Maybe (m a) + pureMess _ _ = Nothing redoLayout :: m a -> Rectangle -> Stack a -> [(a, Rectangle)] -> X ([(a, Rectangle)], Maybe (m a)) - redoLayout m _ _ wrs = do hook m; return (wrs, Nothing) + redoLayout m r s wrs = do hook m; return $ pureModifier m r s wrs + pureModifier :: m a -> Rectangle -> Stack a -> [(a, Rectangle)] + -> ([(a, Rectangle)], Maybe (m a)) + pureModifier _ _ _ wrs = (wrs, Nothing) hook :: m a -> X () hook _ = return () unhook :: m a -> X () |