+void layer_orientation(void *data,
+ struct ivi_controller_layer * /*ivi_controller_layer*/,
+ int32_t orientation) {
+ auto l = static_cast<struct layer *>(data);
+ l->parent->layer_orientation(l, orientation);
+}
+
+void layer_screen(void *data,
+ struct ivi_controller_layer * /*ivi_controller_layer*/,
+ struct wl_output *screen) {
+ auto l = static_cast<struct layer *>(data);
+ l->parent->layer_screen(l, screen);
+}
+
+void layer_destroyed(void *data,
+ struct ivi_controller_layer * /*ivi_controller_layer*/) {
+ auto l = static_cast<struct layer *>(data);
+ l->parent->layer_destroyed(l);
+}
+
+constexpr struct ivi_controller_layer_listener layer_listener = {
+ layer_visibility, layer_opacity,
+ layer_source_rectangle, layer_destination_rectangle,
+ layer_configuration, layer_orientation,
+ layer_screen, layer_destroyed,
+};
+} // namespace
+
+layer::layer(uint32_t i, struct controller *c) : layer(i, 0, 0, c) {}
+
+layer::layer(uint32_t i, int32_t w, int32_t h, struct controller *c)
+ : wayland_proxy(ivi_controller_layer_create(c->proxy.get(), i, w, h),
+ [c, i](ivi_controller_layer *l) {
+ logdebug("~layer layer %i @ %p", i, l);
+ c->remove_proxy_to_id_mapping(l);
+ ivi_controller_layer_destroy(l, 1);
+ }),
+ controller_child(c, i) {
+ this->parent->add_proxy_to_id_mapping(this->proxy.get(), i);
+ ivi_controller_layer_add_listener(this->proxy.get(), &layer_listener, this);
+}
+
+void layer::set_visibility(uint32_t visibility) {
+ ivi_controller_layer_set_visibility(this->proxy.get(), visibility);
+}
+
+void layer::set_opacity(wl_fixed_t opacity) {
+ ivi_controller_layer_set_opacity(this->proxy.get(), opacity);
+}
+
+void layer::set_source_rectangle(int32_t x, int32_t y, int32_t width,
+ int32_t height) {
+ ivi_controller_layer_set_source_rectangle(this->proxy.get(), x, y, width,
+ height);
+}
+
+void layer::set_destination_rectangle(int32_t x, int32_t y, int32_t width,
+ int32_t height) {
+ ivi_controller_layer_set_destination_rectangle(this->proxy.get(), x, y,
+ width, height);
+}
+
+void layer::set_configuration(int32_t width, int32_t height) {
+ ivi_controller_layer_set_configuration(this->proxy.get(), width, height);
+}
+
+void layer::set_orientation(int32_t orientation) {
+ ivi_controller_layer_set_orientation(this->proxy.get(), orientation);