X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fclient.cc;h=80cc1a2ca7e0bcc774fa43043dd337e7b61d53f4;hb=406c79aea1b6f9c8bd1bbeb253ebc7cb97fc7e25;hp=94813a2e319c1521c0819b4e00a399ba0190e2ad;hpb=b6defb3c1a267d72e8056adf77a33458fe8877ae;p=chaz%2Fopenbox diff --git a/src/client.cc b/src/client.cc index 94813a2e..80cc1a2c 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1248,7 +1248,7 @@ void Client::fullscreen(bool fs) } -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 @@ -1257,12 +1257,21 @@ bool Client::focus() const 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,