#include <utility>
+#include "util.hpp"
#include "wayland.hpp"
// _
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()); }
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);
}),
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);
}