all repos — openbox @ de712f85676ca0a386c956165bb6460d65206c46

openbox fork - make it a bit more like ryudo

XDisplay's nextEvent completed
Dana Jansens danakj@orodu.net
commit

de712f85676ca0a386c956165bb6460d65206c46

parent

ae3dc273c4b42553208d230a775731df18058a4a

2 files changed, 24 insertions(+), 0 deletions(-)

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

@@ -131,3 +131,25 @@ void XDisplay::ungrab() {

if (--_grabs == 0) XUngrabServer(_display); } + + +/* + * Gets the next event on the queue from the X server. + * + * Returns: true if e contains a new event; false if there is no event to be + * returned. + */ +bool XDisplay::nextEvent(XEvent &e) { + if(!XPending(_display)) + return false; + XNextEvent(_display, &e); + if (_last_bad_window != None) { + if (e.xany.window == _last_bad_window) { + cerr << "XDisplay::nextEvent(): Removing event for bad window from " << + "event queue\n"; + return false; + } else + _last_bad_window = None; + } + return true; +}
M src/XDisplay.hsrc/XDisplay.h

@@ -77,6 +77,8 @@ // Window grab_window) const;

void grab(); void ungrab(); + + bool nextEvent(XEvent &e); }; #endif // _XDisplay_h