From 29e342c4985744cc2538d85cdbb248e6dd5f5ff8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 11 Sep 2013 21:48:00 +0200 Subject: Let the layout decide about the border width --- MetaTile/Core.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'MetaTile/Core.hs') diff --git a/MetaTile/Core.hs b/MetaTile/Core.hs index e116ccf..5596ec3 100644 --- a/MetaTile/Core.hs +++ b/MetaTile/Core.hs @@ -291,6 +291,14 @@ readsLayout (Layout l) s = [(Layout (asTypeOf x l), rs) | (x, rs) <- reads s] -- that any 'LayoutClass' instance chooses to define. class Show (layout a) => LayoutClass layout a where + runBorderLayout :: Workspace WorkspaceId (layout a) a + -> Rectangle + -> X ([(a, Rectangle, BorderWidth)], Maybe (layout a)) + runBorderLayout ws r = do + bw <- asks (defaultBorderWidth . config) + (as, l) <- runLayout ws r + return ([(a, ar, bw) | (a, ar) <- as], l) + -- | By default, 'runLayout' calls 'doLayout' if there are any -- windows to be laid out, and 'emptyLayout' otherwise. Most -- instances of 'LayoutClass' probably do not need to implement @@ -356,6 +364,7 @@ class Show (layout a) => LayoutClass layout a where description = show instance LayoutClass Layout Window where + runBorderLayout (Workspace i (Layout l) ms) r = fmap (fmap Layout) `fmap` runBorderLayout (Workspace i l ms) r 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 -- cgit v1.2.3