all repos — openbox @ f4b87e04a2a1d285f7b6f93b3db08f040ba5c32c

openbox fork - make it a bit more like ryudo

be smart about skipping focusing a window from unmap events, watch the unmap_ignore
Dana Jansens danakj@orodu.net
commit

f4b87e04a2a1d285f7b6f93b3db08f040ba5c32c

parent

38396b8a8dd3f67bc893e26dde980d5338469521

2 files changed, 14 insertions(+), 5 deletions(-)

jump to
M src/client.ccsrc/client.cc

@@ -1248,7 +1248,7 @@ if (fs) focus();

} -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,11 +1257,20 @@

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) { + --ignore_unmaps; + } else { + XPutBackEvent(**otk::display, &ev); + return false; + } } if (_can_focus)

@@ -1397,7 +1406,7 @@ void Client::unmapHandler(const XUnmapEvent &e)

{ if (ignore_unmaps) { #ifdef DEBUG - printf("Ignored UnmapNotify for 0x%lx (event 0x%lx)\n", e.window, e.event); +// printf("Ignored UnmapNotify for 0x%lx (event 0x%lx)\n", e.window, e.event); #endif // DEBUG ignore_unmaps--; return;
M src/client.hhsrc/client.hh

@@ -580,7 +580,7 @@ */

void resize(Corner anchor, int w, int h); //! Attempt to focus the client window - bool focus() const; + bool focus(); //! Remove focus from the client window void unfocus() const;