summaryrefslogtreecommitdiffstats
path: root/MetaTile/Core.hs
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-09-11 20:22:45 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-09-11 20:22:45 +0200
commitf05f53f9057508ff274f5ee51b866e68fb09824a (patch)
tree3e612f42c7e79684660e4846153057bffbd44a92 /MetaTile/Core.hs
parent78b64d1d34f4764fd6ddb9a9d59a25cd72793b94 (diff)
downloadmetatile-f05f53f9057508ff274f5ee51b866e68fb09824a.tar
metatile-f05f53f9057508ff274f5ee51b866e68fb09824a.zip
Set border width after running the layout
Diffstat (limited to 'MetaTile/Core.hs')
-rw-r--r--MetaTile/Core.hs19
1 files changed, 7 insertions, 12 deletions
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