summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-12 11:29:26 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-12 11:29:26 +0200
commit30c368c0f6e15890a5a6bd27d4ae4175116b02b6 (patch)
tree1a24f93b364e41881e11d677dd64848e7eba4d58 /src
parent2089b5b1ba2f04f037be1ef897bf79790bf501e2 (diff)
wayland: extend wl::display for finer grained dispatch control
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src')
-rw-r--r--src/wayland.cpp21
-rw-r--r--src/wayland.hpp2
2 files changed, 23 insertions, 0 deletions
diff --git a/src/wayland.cpp b/src/wayland.cpp
index 92e152d..25c2359 100644
--- a/src/wayland.cpp
+++ b/src/wayland.cpp
@@ -43,6 +43,27 @@ void display::roundtrip() { wl_display_roundtrip(this->d.get()); }
int display::dispatch() { return wl_display_dispatch(this->d.get()); }
+int display::dispatch_pending() { return wl_display_dispatch_pending(this->d.get()); }
+
+int display::read_events() {
+ // XXX: uhm, how?!
+ while (wl_display_prepare_read(this->d.get()) == -1) {
+ if (wl_display_dispatch_pending(this->d.get()) == -1) {
+ return -1;
+ }
+ }
+
+ if (wl_display_flush(this->d.get()) == -1) {
+ return -1;
+ }
+
+ if (wl_display_read_events(this->d.get()) == -1) {
+ wl_display_cancel_read(this->d.get());
+ }
+
+ return 0;
+}
+
void display::flush() { wl_display_flush(this->d.get()); }
int display::get_fd() const { return wl_display_get_fd(this->d.get()); }
diff --git a/src/wayland.hpp b/src/wayland.hpp
index 256553d..61a840d 100644
--- a/src/wayland.hpp
+++ b/src/wayland.hpp
@@ -89,6 +89,8 @@ struct display {
bool ok() const;
void roundtrip();
int dispatch();
+ int dispatch_pending();
+ int read_events();
void flush();
int get_fd() const;
int get_error();