+int display::dispatch_pending() { return wl_display_dispatch_pending(this->d.get()); }
+
+int display::read_events() {
+ ST();
+ // XXX: uhm, how?!
+ while (wl_display_prepare_read(this->d.get()) == -1) {
+ STN(pending_events_dispatch);
+ 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;
+}
+