}
-bool Client::focus() const
+bool Client::focus()
{
// won't try focus if the client doesn't want it, or if the window isn't
// visible on the screen
if (_focused) return true;
// do a check to see if the window has already been unmapped or destroyed
+ // do this intelligently while watching out for unmaps we've generated
+ // (ignore_unmaps > 0)
XEvent ev;
- if (XCheckTypedWindowEvent(**otk::display, _window, UnmapNotify, &ev) ||
- XCheckTypedWindowEvent(**otk::display, _window, DestroyNotify, &ev)) {
+ if (XCheckTypedWindowEvent(**otk::display, _window, DestroyNotify, &ev)) {
XPutBackEvent(**otk::display, &ev);
return false;
}
+ while (XCheckTypedWindowEvent(**otk::display, _window, UnmapNotify, &ev)) {
+ if (ignore_unmaps) {
+ unmapHandler(ev.xunmap);
+ } else {
+ XPutBackEvent(**otk::display, &ev);
+ return false;
+ }
+ }
if (_can_focus)
XSetInputFocus(**otk::display, _window,