]> Dogcows Code - chaz/openbox/commitdiff
XDisplay's nextEvent completed
authorDana Jansens <danakj@orodu.net>
Thu, 16 May 2002 22:48:44 +0000 (22:48 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 16 May 2002 22:48:44 +0000 (22:48 +0000)
src/XDisplay.cc
src/XDisplay.h

index 1dfd55d04341d4aae3249ba3f7dbb99af7bf2cce..822f244a62899b920bba1ec670a5dd2f29f43c05 100644 (file)
@@ -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;
+}
index a506eee9d0aa94f6beb80966a338577029815dbf..b736fd423dd10dc95f88de702c165378979b1ad7 100644 (file)
@@ -77,6 +77,8 @@ public:
   
   void grab();
   void ungrab();
+
+  bool nextEvent(XEvent &e);
 };
 
 #endif // _XDisplay_h
This page took 0.025751 seconds and 4 git commands to generate.