mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-04 06:01:53 -07:00
Pointfree Mirror and SomeLayout instances
This commit is contained in:
@@ -378,8 +378,8 @@ mirrorRect (Rectangle rx ry rw rh) = (Rectangle ry rx rh rw)
|
|||||||
data Mirror l a = Mirror (l a) deriving (Show, Read)
|
data Mirror l a = Mirror (l a) deriving (Show, Read)
|
||||||
|
|
||||||
instance Layout l a => Layout (Mirror l) a where
|
instance Layout l a => Layout (Mirror l) a where
|
||||||
doLayout (Mirror l) r s = do (wrs, ml') <- doLayout l (mirrorRect r) s
|
doLayout (Mirror l) r s = (map (second mirrorRect) *** fmap Mirror)
|
||||||
return (map (second mirrorRect) wrs, Mirror `fmap` ml')
|
`fmap` doLayout l (mirrorRect r) s
|
||||||
modifyLayout (Mirror l) = fmap (fmap Mirror) . modifyLayout l
|
modifyLayout (Mirror l) = fmap (fmap Mirror) . modifyLayout l
|
||||||
|
|
||||||
-- | tile. Compute the positions for windows using the default 2 pane tiling algorithm.
|
-- | tile. Compute the positions for windows using the default 2 pane tiling algorithm.
|
||||||
|
@@ -148,10 +148,8 @@ class (Show (layout a), Read (layout a)) => Layout layout a where
|
|||||||
modifyLayout :: layout a -> SomeMessage -> X (Maybe (layout a))
|
modifyLayout :: layout a -> SomeMessage -> X (Maybe (layout a))
|
||||||
|
|
||||||
instance Layout SomeLayout a where
|
instance Layout SomeLayout a where
|
||||||
doLayout (SomeLayout l) r s = do (ars, ml') <- doLayout l r s
|
doLayout (SomeLayout l) r s = fmap (fmap $ fmap SomeLayout) $ doLayout l r s
|
||||||
return (ars, SomeLayout `fmap` ml' )
|
modifyLayout (SomeLayout l) = fmap (fmap SomeLayout) . modifyLayout l
|
||||||
modifyLayout (SomeLayout l) m = do ml' <- modifyLayout l m
|
|
||||||
return (SomeLayout `fmap` ml')
|
|
||||||
|
|
||||||
runLayout :: Layout l a => l a -> Rectangle -> StackOrNot a -> X ([(a, Rectangle)], Maybe (l a))
|
runLayout :: Layout l a => l a -> Rectangle -> StackOrNot a -> X ([(a, Rectangle)], Maybe (l a))
|
||||||
runLayout l r = maybe (return ([], Nothing)) (doLayout l r)
|
runLayout l r = maybe (return ([], Nothing)) (doLayout l r)
|
||||||
|
Reference in New Issue
Block a user