App: make a couple of methods private to signal internal use
[staging/windowmanager.git] / src / wayland.cpp
index 92e152d..49e01aa 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <utility>
 
+#include "util.hpp"
 #include "wayland.hpp"
 
 //                                                                  _
@@ -43,6 +44,29 @@ 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() {
+   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;
+}
+
 void display::flush() { wl_display_flush(this->d.get()); }
 
 int display::get_fd() const { return wl_display_get_fd(this->d.get()); }
@@ -546,7 +570,7 @@ constexpr struct ivi_controller_surface_listener surface_listener = {
 surface::surface(uint32_t i, struct controller *c)
    : wayland_proxy(ivi_controller_surface_create(c->proxy.get(), i),
                    [c, i](ivi_controller_surface *s) {
-                      logdebug("~surface surface %i @ %d", i, s);
+                      logdebug("~surface surface %i @ %p", i, s);
                       c->remove_proxy_to_id_mapping(s);
                       ivi_controller_surface_destroy(s, 1);
                    }),
@@ -653,7 +677,7 @@ void controller::surface_stats(struct surface *s, uint32_t redraw_count,
                                uint32_t frame_count, uint32_t update_count,
                                uint32_t pid, const char *process_name) {
    logdebug("genivi::surface %s @ %d r %u f %u u %u pid %u p %s", __func__,
-            this->proxy.get(), redraw_count, frame_count, update_count, pid,
+            s->id, redraw_count, frame_count, update_count, pid,
             process_name);
 }