From 373fae3f1d7a521eca06930acdbd35cbc6fba7f4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 9 Sep 2013 18:24:31 +0200 Subject: Add WindowState record --- XMonad/Operations.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'XMonad/Operations.hs') diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs index 4a3e3fc..79feba1 100644 --- a/XMonad/Operations.hs +++ b/XMonad/Operations.hs @@ -27,7 +27,6 @@ import Data.List (nub, (\\), find) import Data.Bits ((.|.), (.&.), complement, testBit) import Data.Ratio import qualified Data.Map as M -import qualified Data.Set as S import Control.Applicative import Control.Monad.Reader @@ -158,7 +157,7 @@ setWMState w v = withDisplay $ \dpy -> do -- | hide. Hide a window by unmapping it, and setting Iconified. hide :: Window -> X () -hide w = whenX (gets (S.member w . mapped)) $ withDisplay $ \d -> do +hide w = whenX (getsWindowState wsMapped w) $ withDisplay $ \d -> do cMask <- asks $ clientMask . config io $ do selectInput d w (cMask .&. complement structureNotifyMask) unmapWindow d w @@ -166,8 +165,8 @@ hide w = whenX (gets (S.member w . mapped)) $ withDisplay $ \d -> do setWMState w iconicState -- this part is key: we increment the waitingUnmap counter to distinguish -- between client and xmonad initiated unmaps. - modify (\s -> s { waitingUnmap = M.insertWith (+) w 1 (waitingUnmap s) - , mapped = S.delete w (mapped s) }) + modifyWindowState (\ws -> ws { wsMapped = False + , wsWaitingUnmap = (wsWaitingUnmap ws) + 1 }) w -- | reveal. Show a window by mapping it and setting Normal -- this is harmless if the window was already visible @@ -175,7 +174,7 @@ reveal :: Window -> X () reveal w = withDisplay $ \d -> do setWMState w normalState io $ mapWindow d w - whenX (isClient w) $ modify (\s -> s { mapped = S.insert w (mapped s) }) + whenX (isClient w) $ modifyWindowState (\ws -> ws { wsMapped = True }) w -- | Set some properties when we initially gain control of a window setInitialProperties :: Window -> X () -- cgit v1.2.3