- if (e.xproperty.atom == _xatom->getAtom(XAtom::net_active_window))
- updateActiveWindow();
- if (e.xproperty.atom == _xatom->getAtom(XAtom::net_client_list))
- updateClientList();
+ if (e.xany.window == _root) {
+ // root window
+ if (e.xproperty.atom == _xatom->getAtom(XAtom::net_active_window))
+ updateActiveWindow();
+ if (e.xproperty.atom == _xatom->getAtom(XAtom::net_client_list)) {
+ // catch any window unmaps first
+ XEvent ev;
+ if (XCheckTypedWindowEvent(_display, e.xany.window,
+ DestroyNotify, &ev) ||
+ XCheckTypedWindowEvent(_display, e.xany.window,
+ UnmapNotify, &ev)) {
+ processEvent(ev);
+ }
+
+ updateClientList();
+ }
+ } else {
+ // a client window
+ if (e.xproperty.atom == _xatom->getAtom(XAtom::net_wm_state))
+ findWindow(e).updateState();
+ if (e.xproperty.atom == _xatom->getAtom(XAtom::net_wm_desktop))
+ findWindow(e).updateDesktop();
+ }
+ break;
+ case DestroyNotify:
+ case UnmapNotify:
+ cout << "unmap notify\n";
+ findWindow(e).setUnmapped(true);