diff options
| author | Dana Jansens <danakj@orodu.net> | 2002-07-12 02:48:43 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2002-07-12 02:48:43 +0000 |
| commit | 5112b6270431cf1fe288d63e15bfbe689c0624bf (patch) | |
| tree | 94305ea6b3f192ef595c1c26f2e5b177203bd415 /util/epist/process.cc | |
| parent | e8b6f65186587ac8e79fcc81d8006ea1270a02d4 (diff) | |
gets a whole lotta window information now, and updtes when it changes!
Diffstat (limited to 'util/epist/process.cc')
| -rw-r--r-- | util/epist/process.cc | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/util/epist/process.cc b/util/epist/process.cc index 893670c4..7ff86963 100644 --- a/util/epist/process.cc +++ b/util/epist/process.cc @@ -41,18 +41,24 @@ WindowList _clients; WindowList::iterator _active = _clients.end(); -XWindow &findWindow(const XEvent &e) { +XWindow *findWindow(const XEvent &e) { WindowList::iterator it, end = _clients.end(); for (it = _clients.begin(); it != end; ++it) if (**it == e.xany.window) break; - assert(it != end); // this means a client somehow got removed from the - // list! - return **it; + if(it == end) + return 0; + return *it; } void processEvent(const XEvent &e) { + XWindow *window = 0; + if (e.xany.window != _root) { + window = findWindow(e); // find the window + assert(window); // we caught an event for a window we don't know about!? + } + switch (e.type) { case PropertyNotify: if (e.xany.window == _root) { @@ -74,15 +80,19 @@ void processEvent(const XEvent &e) { } 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(); + window->updateState(); + else if (e.xproperty.atom == _xatom->getAtom(XAtom::net_wm_desktop)) + window->updateDesktop(); + else if (e.xproperty.atom == _xatom->getAtom(XAtom::net_wm_name) || + e.xproperty.atom == _xatom->getAtom(XAtom::wm_name)) + window->updateTitle(); + else if (e.xproperty.atom == _xatom->getAtom(XAtom::wm_class)) + window->updateClass(); } break; case DestroyNotify: case UnmapNotify: - cout << "unmap notify\n"; - findWindow(e).setUnmapped(true); + window->setUnmapped(true); break; } } |
