X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwayland.cpp;h=38092e3e67a9a18f2a95d665f4b3a5553f3182ec;hb=b54df759ebab6b240d3cd7271ef91e558866a92d;hp=ce209785cb9e642035795c175400523598fafbc5;hpb=c895f9ff2931f647d7309c841054487cd4fe898c;p=staging%2Fwindowmanager.git diff --git a/src/wayland.cpp b/src/wayland.cpp index ce20978..38092e3 100644 --- a/src/wayland.cpp +++ b/src/wayland.cpp @@ -32,6 +32,10 @@ void display::roundtrip() { wl_display_roundtrip(this->d.get()); } int display::dispatch() { return wl_display_dispatch(this->d.get()); } +void display::flush() { wl_display_flush(this->d.get()); } + +int display::get_fd() const { return wl_display_get_fd(this->d.get()); } + // _ _ // _ __ ___ __ _(_)___| |_ _ __ _ _ // | '__/ _ \/ _` | / __| __| '__| | | | @@ -53,8 +57,9 @@ constexpr struct wl_registry_listener registry_listener = { } registry::registry(struct wl_display *d) - : wayland_proxy(wl_display_get_registry(d)) { - wl_registry_add_listener(this->proxy, ®istry_listener, this); + : wayland_proxy(!d ? nullptr : wl_display_get_registry(d)) { + if (this->proxy) + wl_registry_add_listener(this->proxy, ®istry_listener, this); } registry::~registry() { @@ -158,24 +163,24 @@ namespace { void controller_screen(void *data, struct ivi_controller *ivi_controller, uint32_t id_screen, struct ivi_controller_screen *screen) { - static_cast(data)->screen(id_screen, screen); + static_cast(data)->controller_screen(id_screen, screen); } void controller_layer(void *data, struct ivi_controller *ivi_controller, uint32_t id_layer) { - static_cast(data)->layer(id_layer); + static_cast(data)->controller_layer(id_layer); } void controller_surface(void *data, struct ivi_controller *ivi_controller, uint32_t id_surface) { - static_cast(data)->surface(id_surface); + static_cast(data)->controller_surface(id_surface); } void controller_error(void *data, struct ivi_controller *ivi_controller, int32_t object_id, int32_t object_type, int32_t error_code, const char *error_text) { - static_cast(data)->error(object_id, object_type, - error_code, error_text); + static_cast(data)->controller_error( + object_id, object_type, error_code, error_text); } constexpr struct ivi_controller_listener listener = { @@ -190,24 +195,25 @@ controller::controller(struct wl_registry *r, uint32_t name, uint32_t version) controller::~controller() {} -void controller::screen(uint32_t id, struct ivi_controller_screen *screen) { +void controller::controller_screen(uint32_t id, + struct ivi_controller_screen *screen) { logdebug("genivi::controller @ %p screen %u (%x) @ %p", this->proxy, id, id, screen); this->screens[id] = std::make_unique(id, this, screen); } -void controller::layer(uint32_t id) { +void controller::controller_layer(uint32_t id) { logdebug("genivi::controller @ %p layer %u (%x)", this->proxy, id, id); this->layers[id] = std::make_unique(id, this); } -void controller::surface(uint32_t id) { +void controller::controller_surface(uint32_t id) { logdebug("genivi::controller @ %p surface %u (%x)", this->proxy, id, id); this->surfaces[id] = std::make_unique(id, this); } -void controller::error(int32_t object_id, int32_t object_type, - int32_t error_code, const char *error_text) { +void controller::controller_error(int32_t object_id, int32_t object_type, + int32_t error_code, const char *error_text) { logdebug("genivi::controller @ %p error o %i t %i c %i text %s", this->proxy, object_id, object_type, error_code, error_text); } @@ -501,6 +507,10 @@ void controller::surface_destroyed(uint32_t id) { void controller::surface_content(uint32_t id, int32_t content_state) { logdebug("genivi::surface %s @ %p s %i", __func__, this->proxy, content_state); + + if (content_state == IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_REMOVED) { + this->surfaces.erase(id); + } } //