From f05f53f9057508ff274f5ee51b866e68fb09824a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 11 Sep 2013 20:22:45 +0200 Subject: Set border width after running the layout --- MetaTile/Core.hs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'MetaTile/Core.hs') diff --git a/MetaTile/Core.hs b/MetaTile/Core.hs index 14c4211..e116ccf 100644 --- a/MetaTile/Core.hs +++ b/MetaTile/Core.hs @@ -75,7 +75,7 @@ data WindowState = WindowState } deriving Show instance Eq WindowState where - (==) = (==) `on` (wsMapped &&& wsWaitingUnmap &&& wsFrame) + (==) = (==) `on` (wsMapped &&& wsWaitingUnmap &&& wsFrame) -- | XState, the (mutable) window manager state. @@ -233,25 +233,20 @@ isRoot w = (w==) <$> asks theRoot getAtom :: String -> X Atom getAtom str = withDisplay $ \dpy -> io $ internAtom dpy str False -emptyWindowState :: X WindowState -emptyWindowState = asks (defaultBorderWidth . config) >>= return . WindowState False 0 none +emptyWindowState :: WindowState +emptyWindowState = WindowState False 0 none (BorderWidth 0 0 0 0) getWindowState :: Window -> X WindowState -getWindowState w = do - ws <- gets $ (M.lookup w) . windowState - case ws of - Just s -> return s - Nothing -> emptyWindowState +getWindowState w = gets $ M.findWithDefault emptyWindowState w . windowState getsWindowState :: (WindowState -> a) -> Window -> X a getsWindowState f w = f <$> getWindowState w setWindowState :: Window -> WindowState -> X () setWindowState w ws = do - emptyState <- emptyWindowState - let f | ws == emptyState = M.delete w - | otherwise = M.insert w ws - modify $ \s -> s { windowState = f (windowState s) } + let f | ws == emptyWindowState = M.delete w + | otherwise = M.insert w ws + modify $ \s -> s { windowState = f (windowState s) } modifyWindowState :: (WindowState -> WindowState) -> Window -> X () modifyWindowState f w = getWindowState w >>= return . f >>= setWindowState w -- cgit v1.2.3