summaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2007-06-04 06:23:43 +0200
committerStefan O'Rear <stefanor@cox.net>2007-06-04 06:23:43 +0200
commit4af6ab52d6d43e652f5b6bf2a53aabba58d690e1 (patch)
tree60d0be0b967c763064b3e2ec831c126d851e9836 /Main.hs
parent73333df333f0c858ac445d518f93bffe4e8d64c6 (diff)
downloadmetatile-4af6ab52d6d43e652f5b6bf2a53aabba58d690e1.tar
metatile-4af6ab52d6d43e652f5b6bf2a53aabba58d690e1.zip
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
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs15
1 files changed, 13 insertions, 2 deletions
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