binding: ping() dispatches only pending events
[staging/windowmanager.git] / src / app.cpp
index e42d05f..7b2b69c 100644 (file)
@@ -147,9 +147,8 @@ int App::init() {
 }
 
 int App::dispatch_events() {
-   if (this->pending_events.load(std::memory_order_consume)) {
-      this->pending_events.store(false, std::memory_order_release);
-      return this->display->dispatch_pending();
+   if (this->dispatch_events() == 0) {
+      return 0;
    }
 
    int ret = this->display->dispatch();
@@ -166,6 +165,15 @@ int App::dispatch_events() {
    return 0;
 }
 
+int App::dispatch_pending_events() {
+   if (this->pending_events.load(std::memory_order_consume)) {
+      this->pending_events.store(false, std::memory_order_release);
+      this->display->dispatch_pending();
+      return 0;
+   }
+   return -1;
+}
+
 //  _       _ _       _                         _    ____
 // (_)_ __ (_) |_    | | __ _ _   _  ___  _   _| |_ / /\ \
 // | | '_ \| | __|   | |/ _` | | | |/ _ \| | | | __| |  | |