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/Main.hsc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'XMonad/Main.hsc') diff --git a/XMonad/Main.hsc b/XMonad/Main.hsc index 653ec9d..19f988f 100644 --- a/XMonad/Main.hsc +++ b/XMonad/Main.hsc @@ -20,7 +20,6 @@ import Data.Bits import Data.List ((\\)) import Data.Function import qualified Data.Map as M -import qualified Data.Set as S import Control.Monad.Reader import Control.Monad.State import Data.Maybe (fromMaybe) @@ -124,9 +123,8 @@ xmonad initxmc = do st = XState { windowset = initialWinset - , numberlockMask = 0 - , mapped = S.empty - , waitingUnmap = M.empty + , numberlockMask = 0 + , windowState = M.empty , dragging = Nothing , extensibleState = extState } @@ -205,18 +203,15 @@ handle (MapRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do -- window gone, unmanage it handle (DestroyWindowEvent {ev_window = w}) = whenX (isClient w) $ do unmanage w - modify (\s -> s { mapped = S.delete w (mapped s) - , waitingUnmap = M.delete w (waitingUnmap s)}) + modify (\s -> s { windowState = M.delete w (windowState s)}) -- We track expected unmap events in waitingUnmap. We ignore this event unless -- it is synthetic or we are not expecting an unmap notification from a window. handle (UnmapEvent {ev_window = w, ev_send_event = synthetic}) = whenX (isClient w) $ do - e <- gets (fromMaybe 0 . M.lookup w . waitingUnmap) + e <- getsWindowState wsWaitingUnmap w if (synthetic || e == 0) then unmanage w - else modify (\s -> s { waitingUnmap = M.update mpred w (waitingUnmap s) }) - where mpred 1 = Nothing - mpred n = Just $ pred n + else modifyWindowState (\ws -> ws { wsWaitingUnmap = (wsWaitingUnmap ws) - 1 }) w -- set keyboard mapping handle e@(MappingNotifyEvent {}) = do -- cgit v1.2.3