binding: make the pending_events functionality nicer[tm]
[staging/windowmanager.git] / src / app.hpp
index e295797..c4c0a81 100644 (file)
@@ -148,7 +148,16 @@ struct App {
 
    struct LayoutState state;
 
+   // Set by AFB API when wayland events need to be dispatched
    std::atomic<bool> pending_events;
+   void set_pending_events() {
+      this->pending_events.store(true, std::memory_order_release);
+   }
+   bool pop_pending_events() {
+      bool x{true};
+      return this->pending_events.compare_exchange_strong(
+         x, false, std::memory_order_consume);
+   }
 
    explicit App(wl::display *d);
    ~App();