From 4af6ab52d6d43e652f5b6bf2a53aabba58d690e1 Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Mon, 4 Jun 2007 06:23:43 +0200 Subject: Set WM_STATE, iconify invisible windows (+9 loc) Note that this breaks compatibility with certain programs described as "obsolete" in the ICCCM (1994). See the command above the UnmapEvent handler for details. darcs-hash:20070604042343-e3110-4766eafca2875091189159f6a1df29eac3c21387 --- Main.hs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'Main.hs') diff --git a/Main.hs b/Main.hs index 1575fa5..38ac301 100644 --- a/Main.hs +++ b/Main.hs @@ -144,12 +144,23 @@ handle (KeyEvent {ev_event_type = t, ev_state = m, ev_keycode = code}) -- manage a new window handle (MapRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do wa <- io $ getWindowAttributes dpy w -- ignore override windows - when (not (wa_override_redirect wa)) $ manage w + -- need to ignore mapping requests by managed windows not on the current workspace + managed <- isClient w + when (not (wa_override_redirect wa) && not managed) $ do manage w -- window destroyed, unmanage it -- window gone, unmanage it handle (DestroyWindowEvent {ev_window = w}) = whenX (isClient w) $ unmanage w -handle (UnmapEvent {ev_window = w}) = whenX (isClient w) $ unmanage w + +-- We only handle synthetic unmap events, because real events are confusable +-- with the events produced by 'hide'. ICCCM says that all clients should send +-- synthetic unmap events immediately after unmapping, and later describes +-- clients that do not follow the rule as "obsolete". For now, we make the +-- simplifying assumption that nobody uses clients that were already obsolete +-- in 1994. Note that many alternative methods for resolving the hide/withdraw +-- ambiguity are racy. + +handle (UnmapEvent {ev_window = w, ev_send_event = True}) = whenX (isClient w) $ unmanage w -- set keyboard mapping handle e@(MappingNotifyEvent {ev_window = w}) = do -- cgit v1.2.3