2 * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "wayland.hpp"
21 #include "hmi-debug.h"
32 : d(std::unique_ptr<struct wl_display, void (*)(struct wl_display *)>(
33 wl_display_connect(nullptr), &wl_display_disconnect)),
36 bool display::ok() const { return d && wl_display_get_error(d.get()) == 0; }
38 void display::roundtrip() { wl_display_roundtrip(this->d.get()); }
40 int display::dispatch() { return wl_display_dispatch(this->d.get()); }
42 int display::dispatch_pending() { return wl_display_dispatch_pending(this->d.get()); }
44 int display::read_events() {
46 while (wl_display_prepare_read(this->d.get()) == -1) {
47 STN(pending_events_dispatch);
48 if (wl_display_dispatch_pending(this->d.get()) == -1) {
53 if (wl_display_flush(this->d.get()) == -1) {
57 if (wl_display_read_events(this->d.get()) == -1) {
58 wl_display_cancel_read(this->d.get());
64 void display::flush() { wl_display_flush(this->d.get()); }
66 int display::get_fd() const { return wl_display_get_fd(this->d.get()); }
68 int display::get_error() { return wl_display_get_error(this->d.get()); }
74 void registry_global(void *data, struct wl_registry * /*r*/, uint32_t name,
75 char const *iface, uint32_t v) {
76 static_cast<struct registry *>(data)->global(name, iface, v);
79 void registry_global_remove(void *data, struct wl_registry * /*r*/,
81 static_cast<struct registry *>(data)->global_remove(name);
84 constexpr struct wl_registry_listener registry_listener = {
85 registry_global, registry_global_remove};
88 registry::registry(struct wl_display *d)
89 : wayland_proxy(d == nullptr ? nullptr : wl_display_get_registry(d)) {
90 if (this->proxy != nullptr) {
91 wl_registry_add_listener(this->proxy.get(), ®istry_listener, this);
95 void registry::add_global_handler(char const *iface, binder bind) {
96 this->bindings[iface] = std::move(bind);
99 void registry::global(uint32_t name, char const *iface, uint32_t v) {
100 auto b = this->bindings.find(iface);
101 if (b != this->bindings.end()) {
102 b->second(this->proxy.get(), name, v);
104 HMI_DEBUG("wm", "wl::registry @ %p global n %u i %s v %u", this->proxy.get(), name,
108 void registry::global_remove(uint32_t /*name*/) {}
114 void output_geometry(void *data, struct wl_output * /*wl_output*/, int32_t x,
115 int32_t y, int32_t physical_width, int32_t physical_height,
116 int32_t subpixel, const char *make, const char *model,
118 static_cast<struct output *>(data)->geometry(
119 x, y, physical_width, physical_height, subpixel, make, model, transform);
122 void output_mode(void *data, struct wl_output * /*wl_output*/, uint32_t flags,
123 int32_t width, int32_t height, int32_t refresh) {
124 static_cast<struct output *>(data)->mode(flags, width, height, refresh);
127 void output_done(void *data, struct wl_output * /*wl_output*/) {
128 static_cast<struct output *>(data)->done();
131 void output_scale(void *data, struct wl_output * /*wl_output*/,
133 static_cast<struct output *>(data)->scale(factor);
136 constexpr struct wl_output_listener output_listener = {
137 output_geometry, output_mode, output_done, output_scale};
140 output::output(struct wl_registry *r, uint32_t name, uint32_t v)
141 : wayland_proxy(wl_registry_bind(r, name, &wl_output_interface, v)) {
142 wl_output_add_listener(this->proxy.get(), &output_listener, this);
145 void output::geometry(int32_t x, int32_t y, int32_t pw, int32_t ph,
146 int32_t subpel, char const *make, char const *model,
149 "wl::output %s @ %p x %i y %i w %i h %i spel %x make %s model %s tx %i",
150 __func__, this->proxy.get(), x, y, pw, ph, subpel, make, model, tx);
151 this->physical_width = pw;
152 this->physical_height = ph;
153 this->transform = tx;
156 void output::mode(uint32_t flags, int32_t w, int32_t h, int32_t r) {
157 HMI_DEBUG("wm", "wl::output %s @ %p f %x w %i h %i r %i", __func__,
158 this->proxy.get(), flags, w, h, r);
159 if ((flags & WL_OUTPUT_MODE_CURRENT) != 0u) {
166 void output::done() {
167 HMI_DEBUG("wm", "wl::output %s @ %p done", __func__, this->proxy.get());
169 if (this->transform == WL_OUTPUT_TRANSFORM_90 ||
170 this->transform == WL_OUTPUT_TRANSFORM_270 ||
171 this->transform == WL_OUTPUT_TRANSFORM_FLIPPED_90 ||
172 this->transform == WL_OUTPUT_TRANSFORM_FLIPPED_270) {
173 std::swap(this->width, this->height);
174 std::swap(this->physical_width, this->physical_height);
178 void output::scale(int32_t factor) {
179 HMI_DEBUG("wm", "wl::output %s @ %p f %i", __func__, this->proxy.get(), factor);
184 * namespace compositor
186 namespace compositor {
192 void controller_screen(void *data, struct ivi_controller * /*ivi_controller*/,
194 struct ivi_controller_screen *screen) {
195 static_cast<struct controller *>(data)->controller_screen(id_screen, screen);
198 void controller_layer(void *data, struct ivi_controller * /*ivi_controller*/,
200 static_cast<struct controller *>(data)->controller_layer(id_layer);
203 void controller_surface(void *data, struct ivi_controller * /*ivi_controller*/,
204 uint32_t id_surface) {
205 static_cast<struct controller *>(data)->controller_surface(id_surface);
208 void controller_error(void *data, struct ivi_controller * /*ivi_controller*/,
209 int32_t object_id, int32_t object_type,
210 int32_t error_code, const char *error_text) {
211 static_cast<struct controller *>(data)->controller_error(
212 object_id, object_type, error_code, error_text);
215 constexpr struct ivi_controller_listener listener = {
216 controller_screen, controller_layer, controller_surface, controller_error};
217 } // namespace compositor
219 controller::controller(struct wl_registry *r, uint32_t name, uint32_t version)
221 wl_registry_bind(r, name, &ivi_controller_interface, version)),
223 ivi_controller_add_listener(this->proxy.get(), &listener, this);
226 void controller::layer_create(uint32_t id, int32_t w, int32_t h) {
227 this->layers[id] = std::make_unique<struct layer>(id, w, h, this);
230 void controller::surface_create(uint32_t id) {
231 this->surfaces[id] = std::make_unique<struct surface>(id, this);
233 // configure surface to wxh dimensions
234 this->surfaces[id]->set_configuration(this->output_size.w, this->output_size.h);
237 void controller::controller_screen(uint32_t id,
238 struct ivi_controller_screen *screen) {
239 HMI_DEBUG("wm", "compositor::controller @ %p screen %u (%x) @ %p", this->proxy.get(),
241 this->screens[id] = std::make_unique<struct screen>(id, this, screen);
244 void controller::controller_layer(uint32_t id) {
245 HMI_DEBUG("wm", "compositor::controller @ %p layer %u (%x)", this->proxy.get(), id, id);
246 if (this->layers.find(id) != this->layers.end()) {
247 HMI_DEBUG("wm", "WindowManager has created layer %u (%x) already", id, id);
249 auto &l = this->layers[id] = std::make_unique<struct layer>(id, this);
254 void controller::controller_surface(uint32_t id) {
255 HMI_DEBUG("wm", "compositor::controller @ %p surface %u (%x)", this->proxy.get(), id,
257 if (this->surfaces.find(id) == this->surfaces.end()) {
258 this->surfaces[id] = std::make_unique<struct surface>(id, this);
259 this->chooks->surface_created(id);
261 // configure surface to wxh dimensions
262 this->surfaces[id]->set_configuration(this->output_size.w, this->output_size.h);
266 void controller::controller_error(int32_t object_id, int32_t object_type,
267 int32_t error_code, const char *error_text) {
268 HMI_DEBUG("wm", "compositor::controller @ %p error o %i t %i c %i text %s",
269 this->proxy.get(), object_id, object_type, error_code, error_text);
276 void layer_visibility(void *data,
277 struct ivi_controller_layer * /*ivi_controller_layer*/,
278 int32_t visibility) {
279 auto l = static_cast<struct layer *>(data);
280 l->parent->layer_visibility(l, visibility);
283 void layer_opacity(void *data,
284 struct ivi_controller_layer * /*ivi_controller_layer*/,
285 wl_fixed_t opacity) {
286 auto l = static_cast<struct layer *>(data);
287 l->parent->layer_opacity(l, float(wl_fixed_to_double(opacity)));
290 void layer_source_rectangle(
291 void *data, struct ivi_controller_layer * /*ivi_controller_layer*/,
292 int32_t x, int32_t y, int32_t width, int32_t height) {
293 auto l = static_cast<struct layer *>(data);
294 l->parent->layer_source_rectangle(l, x, y, width, height);
297 void layer_destination_rectangle(
298 void *data, struct ivi_controller_layer * /*ivi_controller_layer*/,
299 int32_t x, int32_t y, int32_t width, int32_t height) {
300 auto l = static_cast<struct layer *>(data);
301 l->parent->layer_destination_rectangle(l, x, y, width, height);
304 void layer_configuration(void *data,
305 struct ivi_controller_layer * /*ivi_controller_layer*/,
306 int32_t width, int32_t height) {
307 auto l = static_cast<struct layer *>(data);
308 l->parent->layer_configuration(l, width, height);
311 void layer_orientation(void *data,
312 struct ivi_controller_layer * /*ivi_controller_layer*/,
313 int32_t orientation) {
314 auto l = static_cast<struct layer *>(data);
315 l->parent->layer_orientation(l, orientation);
318 void layer_screen(void *data,
319 struct ivi_controller_layer * /*ivi_controller_layer*/,
320 struct wl_output *screen) {
321 auto l = static_cast<struct layer *>(data);
322 l->parent->layer_screen(l, screen);
325 void layer_destroyed(void *data,
326 struct ivi_controller_layer * /*ivi_controller_layer*/) {
327 auto l = static_cast<struct layer *>(data);
328 l->parent->layer_destroyed(l);
331 constexpr struct ivi_controller_layer_listener layer_listener = {
332 layer_visibility, layer_opacity,
333 layer_source_rectangle, layer_destination_rectangle,
334 layer_configuration, layer_orientation,
335 layer_screen, layer_destroyed,
339 layer::layer(uint32_t i, struct controller *c) : layer(i, 0, 0, c) {}
341 layer::layer(uint32_t i, int32_t w, int32_t h, struct controller *c)
342 : wayland_proxy(ivi_controller_layer_create(c->proxy.get(), i, w, h),
343 [c, i](ivi_controller_layer *l) {
344 HMI_DEBUG("wm", "~layer layer %i @ %p", i, l);
345 c->remove_proxy_to_id_mapping(l);
346 ivi_controller_layer_destroy(l, 1);
348 controller_child(c, i) {
349 this->parent->add_proxy_to_id_mapping(this->proxy.get(), i);
350 ivi_controller_layer_add_listener(this->proxy.get(), &layer_listener, this);
353 void layer::set_visibility(uint32_t visibility) {
354 ivi_controller_layer_set_visibility(this->proxy.get(), visibility);
357 void layer::set_opacity(wl_fixed_t opacity) {
358 ivi_controller_layer_set_opacity(this->proxy.get(), opacity);
361 void layer::set_source_rectangle(int32_t x, int32_t y, int32_t width,
363 ivi_controller_layer_set_source_rectangle(this->proxy.get(), x, y, width,
367 void layer::set_destination_rectangle(int32_t x, int32_t y, int32_t width,
369 ivi_controller_layer_set_destination_rectangle(this->proxy.get(), x, y,
373 void layer::set_configuration(int32_t width, int32_t height) {
374 ivi_controller_layer_set_configuration(this->proxy.get(), width, height);
377 void layer::set_orientation(int32_t orientation) {
378 ivi_controller_layer_set_orientation(this->proxy.get(), orientation);
381 void layer::screenshot(const char *filename) {
382 ivi_controller_layer_screenshot(this->proxy.get(), filename);
385 void layer::clear_surfaces() {
386 ivi_controller_layer_clear_surfaces(this->proxy.get());
389 void layer::add_surface(struct surface *surface) {
390 ivi_controller_layer_add_surface(this->proxy.get(), surface->proxy.get());
393 void layer::remove_surface(struct surface *surface) {
394 ivi_controller_layer_remove_surface(this->proxy.get(), surface->proxy.get());
397 void layer::set_render_order(std::vector<uint32_t> const &ro) {
398 struct wl_array wlro {
399 .size = ro.size() * sizeof(ro[0]), .alloc = ro.capacity() * sizeof(ro[0]),
400 .data = const_cast<void *>(static_cast<void const *>(ro.data()))
402 ivi_controller_layer_set_render_order(this->proxy.get(), &wlro);
405 void controller::layer_visibility(struct layer *l, int32_t visibility) {
406 HMI_DEBUG("wm", "compositor::layer %s @ %d v %i", __func__, l->id, visibility);
407 this->lprops[l->id].visibility = visibility;
410 void controller::layer_opacity(struct layer *l, float opacity) {
411 HMI_DEBUG("wm", "compositor::layer %s @ %d o %f", __func__, l->id, opacity);
412 this->lprops[l->id].opacity = opacity;
415 void controller::layer_source_rectangle(struct layer *l, int32_t x, int32_t y,
416 int32_t width, int32_t height) {
417 HMI_DEBUG("wm", "compositor::layer %s @ %d x %i y %i w %i h %i", __func__,
418 l->id, x, y, width, height);
419 this->lprops[l->id].src_rect = rect{width, height, x, y};
422 void controller::layer_destination_rectangle(struct layer *l, int32_t x,
423 int32_t y, int32_t width,
425 HMI_DEBUG("wm", "compositor::layer %s @ %d x %i y %i w %i h %i", __func__,
426 l->id, x, y, width, height);
427 this->lprops[l->id].dst_rect = rect{width, height, x, y};
430 void controller::layer_configuration(struct layer *l, int32_t width,
432 HMI_DEBUG("wm", "compositor::layer %s @ %d w %i h %i", __func__, l->id,
434 this->lprops[l->id].size = size{uint32_t(width), uint32_t(height)};
437 void controller::layer_orientation(struct layer *l, int32_t orientation) {
438 HMI_DEBUG("wm", "compositor::layer %s @ %d o %i", __func__, l->id,
440 this->lprops[l->id].orientation = orientation;
443 void controller::layer_screen(struct layer *l, struct wl_output *screen) {
444 HMI_DEBUG("wm", "compositor::layer %s @ %d s %p", __func__, l->id, screen);
447 void controller::layer_destroyed(struct layer *l) {
448 HMI_DEBUG("wm", "compositor::layer %s @ %d", __func__, l->id);
449 this->lprops.erase(l->id);
450 this->layers.erase(l->id);
458 void surface_visibility(
459 void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
460 int32_t visibility) {
461 auto s = static_cast<struct surface *>(data);
462 s->parent->surface_visibility(s, visibility);
465 void surface_opacity(void *data,
466 struct ivi_controller_surface * /*ivi_controller_surface*/,
467 wl_fixed_t opacity) {
468 auto s = static_cast<struct surface *>(data);
469 s->parent->surface_opacity(s, float(wl_fixed_to_double(opacity)));
472 void surface_source_rectangle(
473 void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
474 int32_t x, int32_t y, int32_t width, int32_t height) {
475 auto s = static_cast<struct surface *>(data);
476 s->parent->surface_source_rectangle(s, x, y, width, height);
479 void surface_destination_rectangle(
480 void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
481 int32_t x, int32_t y, int32_t width, int32_t height) {
482 auto s = static_cast<struct surface *>(data);
483 s->parent->surface_destination_rectangle(s, x, y, width, height);
486 void surface_configuration(
487 void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
488 int32_t width, int32_t height) {
489 auto s = static_cast<struct surface *>(data);
490 s->parent->surface_configuration(s, width, height);
493 void surface_orientation(
494 void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
495 int32_t orientation) {
496 auto s = static_cast<struct surface *>(data);
497 s->parent->surface_orientation(s, orientation);
500 void surface_pixelformat(
501 void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
502 int32_t pixelformat) {
503 auto s = static_cast<struct surface *>(data);
504 s->parent->surface_pixelformat(s, pixelformat);
507 void surface_layer(void *data,
508 struct ivi_controller_surface * /*ivi_controller_surface*/,
509 struct ivi_controller_layer *layer) {
510 auto s = static_cast<struct surface *>(data);
511 s->parent->surface_layer(s, layer);
514 void surface_stats(void *data,
515 struct ivi_controller_surface * /*ivi_controller_surface*/,
516 uint32_t redraw_count, uint32_t frame_count,
517 uint32_t update_count, uint32_t pid,
518 const char *process_name) {
519 auto s = static_cast<struct surface *>(data);
520 s->parent->surface_stats(s, redraw_count, frame_count, update_count, pid,
524 void surface_destroyed(
525 void *data, struct ivi_controller_surface * /*ivi_controller_surface*/) {
526 auto s = static_cast<struct surface *>(data);
527 s->parent->surface_destroyed(s);
530 void surface_content(void *data,
531 struct ivi_controller_surface * /*ivi_controller_surface*/,
532 int32_t content_state) {
533 auto s = static_cast<struct surface *>(data);
534 s->parent->surface_content(s, content_state);
537 constexpr struct ivi_controller_surface_listener surface_listener = {
540 surface_source_rectangle,
541 surface_destination_rectangle,
542 surface_configuration,
552 surface::surface(uint32_t i, struct controller *c)
553 : wayland_proxy(ivi_controller_surface_create(c->proxy.get(), i),
554 [c, i](ivi_controller_surface *s) {
555 HMI_DEBUG("wm", "~surface surface %i @ %p", i, s);
556 c->remove_proxy_to_id_mapping(s);
557 ivi_controller_surface_destroy(s, 1);
559 controller_child(c, i) {
560 this->parent->add_proxy_to_id_mapping(this->proxy.get(), i);
561 ivi_controller_surface_add_listener(this->proxy.get(), &surface_listener,
565 void surface::set_visibility(uint32_t visibility) {
566 ivi_controller_surface_set_visibility(this->proxy.get(), visibility);
569 void surface::set_opacity(wl_fixed_t opacity) {
570 ivi_controller_surface_set_opacity(this->proxy.get(), opacity);
573 void surface::set_source_rectangle(int32_t x, int32_t y, int32_t width,
575 ivi_controller_surface_set_source_rectangle(this->proxy.get(), x, y, width,
579 void surface::set_destination_rectangle(int32_t x, int32_t y, int32_t width,
581 ivi_controller_surface_set_destination_rectangle(this->proxy.get(), x, y,
585 void surface::set_configuration(int32_t width, int32_t height) {
586 ivi_controller_surface_set_configuration(this->proxy.get(), width, height);
589 void surface::set_orientation(int32_t orientation) {
590 ivi_controller_surface_set_orientation(this->proxy.get(), orientation);
593 void surface::screenshot(const char *filename) {
594 ivi_controller_surface_screenshot(this->proxy.get(), filename);
597 void surface::send_stats() {
598 ivi_controller_surface_send_stats(this->proxy.get());
601 void surface::destroy(int32_t destroy_scene_object) {
602 ivi_controller_surface_destroy(this->proxy.get(), destroy_scene_object);
605 void controller::surface_visibility(struct surface *s, int32_t visibility) {
606 HMI_DEBUG("wm", "compositor::surface %s @ %d v %i", __func__, s->id,
608 this->sprops[s->id].visibility = visibility;
609 this->chooks->surface_visibility(s->id, visibility);
612 void controller::surface_opacity(struct surface *s, float opacity) {
613 HMI_DEBUG("wm", "compositor::surface %s @ %d o %f", __func__, s->id,
615 this->sprops[s->id].opacity = opacity;
618 void controller::surface_source_rectangle(struct surface *s, int32_t x,
619 int32_t y, int32_t width,
621 HMI_DEBUG("wm", "compositor::surface %s @ %d x %i y %i w %i h %i", __func__,
622 s->id, x, y, width, height);
623 this->sprops[s->id].src_rect = rect{width, height, x, y};
626 void controller::surface_destination_rectangle(struct surface *s, int32_t x,
627 int32_t y, int32_t width,
629 HMI_DEBUG("wm", "compositor::surface %s @ %d x %i y %i w %i h %i", __func__,
630 s->id, x, y, width, height);
631 this->sprops[s->id].dst_rect = rect{width, height, x, y};
632 this->chooks->surface_destination_rectangle(s->id, x, y, width, height);
635 void controller::surface_configuration(struct surface *s, int32_t width,
637 HMI_DEBUG("wm", "compositor::surface %s @ %d w %i h %i", __func__, s->id,
639 this->sprops[s->id].size = size{uint32_t(width), uint32_t(height)};
642 void controller::surface_orientation(struct surface *s, int32_t orientation) {
643 HMI_DEBUG("wm", "compositor::surface %s @ %d o %i", __func__, s->id,
645 this->sprops[s->id].orientation = orientation;
648 void controller::surface_pixelformat(struct surface * s,
649 int32_t pixelformat) {
650 HMI_DEBUG("wm", "compositor::surface %s @ %d f %i", __func__, s->id,
654 void controller::surface_layer(struct surface * s,
655 struct ivi_controller_layer *layer) {
656 HMI_DEBUG("wm", "compositor::surface %s @ %d l %u @ %p", __func__, s->id,
657 this->layer_proxy_to_id[uintptr_t(layer)], layer);
660 void controller::surface_stats(struct surface *s, uint32_t redraw_count,
661 uint32_t frame_count, uint32_t update_count,
662 uint32_t pid, const char *process_name) {
663 HMI_DEBUG("wm", "compositor::surface %s @ %d r %u f %u u %u pid %u p %s", __func__,
664 s->id, redraw_count, frame_count, update_count, pid,
668 void controller::surface_destroyed(struct surface *s) {
669 HMI_DEBUG("wm", "compositor::surface %s @ %d", __func__, s->id);
670 this->chooks->surface_removed(s->id);
671 this->sprops.erase(s->id);
672 this->surfaces.erase(s->id);
675 void controller::surface_content(struct surface *s, int32_t content_state) {
676 HMI_DEBUG("wm", "compositor::surface %s @ %d s %i", __func__, s->id,
678 if (content_state == IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_REMOVED) {
679 this->chooks->surface_removed(s->id);
680 this->sprops.erase(s->id);
681 this->surfaces.erase(s->id);
685 void controller::add_proxy_to_id_mapping(struct ivi_controller_surface *p,
687 HMI_DEBUG("wm", "Add surface proxy mapping for %p (%u)", p, id);
688 this->surface_proxy_to_id[uintptr_t(p)] = id;
689 this->sprops[id].id = id;
692 void controller::remove_proxy_to_id_mapping(struct ivi_controller_surface *p) {
693 HMI_DEBUG("wm", "Remove surface proxy mapping for %p", p);
694 this->surface_proxy_to_id.erase(uintptr_t(p));
697 void controller::add_proxy_to_id_mapping(struct ivi_controller_layer *p,
699 HMI_DEBUG("wm", "Add layer proxy mapping for %p (%u)", p, id);
700 this->layer_proxy_to_id[uintptr_t(p)] = id;
701 this->lprops[id].id = id;
704 void controller::remove_proxy_to_id_mapping(struct ivi_controller_layer *p) {
705 HMI_DEBUG("wm", "Remove layer proxy mapping for %p", p);
706 this->layer_proxy_to_id.erase(uintptr_t(p));
709 void controller::add_proxy_to_id_mapping(struct wl_output *p, uint32_t id) {
710 HMI_DEBUG("wm", "Add screen proxy mapping for %p (%u)", p, id);
711 this->screen_proxy_to_id[uintptr_t(p)] = id;
714 void controller::remove_proxy_to_id_mapping(struct wl_output *p) {
715 HMI_DEBUG("wm", "Remove screen proxy mapping for %p", p);
716 this->screen_proxy_to_id.erase(uintptr_t(p));
722 screen::screen(uint32_t i, struct controller *c,
723 struct ivi_controller_screen *p)
724 : wayland_proxy(p), controller_child(c, i) {
725 HMI_DEBUG("wm", "compositor::screen @ %p id %u", p, i);
728 void screen::clear() { ivi_controller_screen_clear(this->proxy.get()); }
730 void screen::add_layer(layer *l) {
731 ivi_controller_screen_add_layer(this->proxy.get(), l->proxy.get());
734 void screen::set_render_order(std::vector<uint32_t> const &ro) {
735 struct wl_array wlro {
736 .size = ro.size() * sizeof(ro[0]), .alloc = ro.capacity() * sizeof(ro[0]),
737 .data = const_cast<void *>(static_cast<void const *>(ro.data()))
739 ivi_controller_screen_set_render_order(this->proxy.get(), &wlro);
742 } // namespace compositor