aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Core.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-02-22 18:58:15 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-02-22 18:58:15 +0100
commitb84cd8cf7dbe9ccb8837752b73acf132ee59d1e4 (patch)
tree6d7975a22ad3481559bfb9c61d63b1bf3a89320b /XMonad/Core.hs
parente0850802f7e84f827badf5671ec4342ad364a012 (diff)
downloadxmonad-b84cd8cf7dbe9ccb8837752b73acf132ee59d1e4.tar.gz
xmonad-b84cd8cf7dbe9ccb8837752b73acf132ee59d1e4.tar.xz
xmonad-b84cd8cf7dbe9ccb8837752b73acf132ee59d1e4.zip
runLayout is now a LayoutClass method and takes the Workspace and the screen Rectangle
darcs-hash:20080222175815-32816-e3893760e1024bcbf30a4fbb71ca7c2b4d8bb403.gz
Diffstat (limited to 'XMonad/Core.hs')
-rw-r--r--XMonad/Core.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/XMonad/Core.hs b/XMonad/Core.hs
index 89e6ab2..32fc234 100644
--- a/XMonad/Core.hs
+++ b/XMonad/Core.hs
@@ -23,7 +23,7 @@ module XMonad.Core (
ScreenId(..), ScreenDetail(..), XState(..),
XConf(..), XConfig(..), LayoutClass(..),
Layout(..), readsLayout, Typeable, Message,
- SomeMessage(..), fromMessage, runLayout, LayoutMessages(..),
+ SomeMessage(..), fromMessage, LayoutMessages(..),
runX, catchX, userCode, io, catchIO, doubleFork,
withDisplay, withWindowSet, isRoot, runOnWorkspaces, broadcastMessage,
getAtom, spawn, restart, getXMonadDir, recompile, trace, whenJust, whenX,
@@ -206,6 +206,11 @@ readsLayout (Layout l) s = [(Layout (asTypeOf x l), rs) | (x, rs) <- reads s]
--
class Show (layout a) => LayoutClass layout a where
+ -- | This calls doLayout if there are any windows to be laid out, and
+ -- emptyLayout otherwise.
+ runLayout :: Workspace WorkspaceId (layout a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a))
+ runLayout (Workspace _ l ms) r = maybe (emptyLayout l r) (doLayout l r) ms
+
-- | Given a Rectangle in which to place the windows, and a Stack
-- of windows, return a list of windows and their corresponding
-- Rectangles. If an element is not given a Rectangle by
@@ -231,7 +236,6 @@ class Show (layout a) => LayoutClass layout a where
-- 'handleMessage' returns Nothing, then the layout did not respond to
-- that message and the screen is not refreshed. Otherwise, 'handleMessage'
-- returns an updated 'Layout' and the screen is refreshed.
- --
handleMessage :: layout a -> SomeMessage -> X (Maybe (layout a))
handleMessage l = return . pureMessage l
@@ -246,6 +250,7 @@ class Show (layout a) => LayoutClass layout a where
description = show
instance LayoutClass Layout Window where
+ runLayout (Workspace i (Layout l) ms) r = fmap (fmap Layout) `fmap` runLayout (Workspace i l ms) r
doLayout (Layout l) r s = fmap (fmap Layout) `fmap` doLayout l r s
emptyLayout (Layout l) r = fmap (fmap Layout) `fmap` emptyLayout l r
handleMessage (Layout l) = fmap (fmap Layout) . handleMessage l
@@ -253,11 +258,6 @@ instance LayoutClass Layout Window where
instance Show (Layout a) where show (Layout l) = show l
--- | This calls doLayout if there are any windows to be laid out, and
--- emptyLayout otherwise.
-runLayout :: LayoutClass l a => l a -> Rectangle -> Maybe (Stack a) -> X ([(a, Rectangle)], Maybe (l a))
-runLayout l r = maybe (emptyLayout l r) (doLayout l r)
-
-- | Based on ideas in /An Extensible Dynamically-Typed Hierarchy of Exceptions/,
-- Simon Marlow, 2006. Use extensible messages to the handleMessage handler.
--