6 // _ __ __ _ _ __ ___ ___ ___ _ __ __ _ ___ ___ __ _| |
7 // | '_ \ / _` | '_ ` _ \ / _ \/ __| '_ \ / _` |/ __/ _ \ \ \ /\ / / |
8 // | | | | (_| | | | | | | __/\__ \ |_) | (_| | (_| __/ \ V V /| |
9 // |_| |_|\__,_|_| |_| |_|\___||___/ .__/ \__,_|\___\___| \_/\_/ |_|
14 // __| (_)___ _ __ | | __ _ _ _
15 // / _` | / __| '_ \| |/ _` | | | |
16 // | (_| | \__ \ |_) | | (_| | |_| |
17 // \__,_|_|___/ .__/|_|\__,_|\__, |
20 : d(std::unique_ptr<struct wl_display, void (*)(struct wl_display *)>(
21 wl_display_connect(nullptr),
23 [](struct wl_display *d) {
24 logdebug("wl::display ~display @ %p", d);
25 wl_display_disconnect(d);
28 &wl_display_disconnect)),
33 display::~display() = default;
35 bool display::ok() const { return d && wl_display_get_error(d.get()) == 0; }
37 void display::roundtrip() { wl_display_roundtrip(this->d.get()); }
39 int display::dispatch() { return wl_display_dispatch(this->d.get()); }
41 void display::flush() { wl_display_flush(this->d.get()); }
43 int display::get_fd() const { return wl_display_get_fd(this->d.get()); }
46 // _ __ ___ __ _(_)___| |_ _ __ _ _
47 // | '__/ _ \/ _` | / __| __| '__| | | |
48 // | | | __/ (_| | \__ \ |_| | | |_| |
49 // |_| \___|\__, |_|___/\__|_| \__, |
52 void registry_global(void *data, struct wl_registry * /*r*/, uint32_t name,
53 char const *iface, uint32_t v) {
54 static_cast<struct registry *>(data)->global(name, iface, v);
57 void registry_global_remove(void *data, struct wl_registry * /*r*/,
59 static_cast<struct registry *>(data)->global_remove(name);
62 constexpr struct wl_registry_listener registry_listener = {
63 registry_global, registry_global_remove};
66 registry::registry(struct wl_display *d)
67 : wayland_proxy(d == nullptr ? nullptr : wl_display_get_registry(d)) {
68 if (this->proxy != nullptr) {
69 wl_registry_add_listener(this->proxy, ®istry_listener, this);
73 registry::~registry() {
74 logdebug("wl::registry %s @ %p", __func__, this->proxy);
77 void registry::add_global_handler(char const *iface, binder bind) {
78 this->bindings[iface] = std::move(bind);
81 void registry::global(uint32_t name, char const *iface, uint32_t v) {
82 auto b = this->bindings.find(iface);
83 if (b != this->bindings.end()) {
84 b->second(this->proxy, name, v);
86 logdebug("wl::registry @ %p global n %u i %s v %u", this->proxy, name, iface,
90 void registry::global_remove(uint32_t /*name*/) {}
93 // ___ _ _| |_ _ __ _ _| |_
94 // / _ \| | | | __| '_ \| | | | __|
95 // | (_) | |_| | |_| |_) | |_| | |_
96 // \___/ \__,_|\__| .__/ \__,_|\__|
99 void output_geometry(void *data, struct wl_output * /*wl_output*/, int32_t x,
100 int32_t y, int32_t physical_width, int32_t physical_height,
101 int32_t subpixel, const char *make, const char *model,
103 static_cast<struct output *>(data)->geometry(
104 x, y, physical_width, physical_height, subpixel, make, model, transform);
107 void output_mode(void *data, struct wl_output * /*wl_output*/, uint32_t flags,
108 int32_t width, int32_t height, int32_t refresh) {
109 static_cast<struct output *>(data)->mode(flags, width, height, refresh);
112 void output_done(void *data, struct wl_output * /*wl_output*/) {
113 static_cast<struct output *>(data)->done();
116 void output_scale(void *data, struct wl_output * /*wl_output*/,
118 static_cast<struct output *>(data)->scale(factor);
121 constexpr struct wl_output_listener output_listener = {
122 output_geometry, output_mode, output_done, output_scale};
125 output::output(struct wl_registry *r, uint32_t name, uint32_t v)
126 : wayland_proxy(wl_registry_bind(r, name, &wl_output_interface, v)) {
127 wl_output_add_listener(this->proxy, &output_listener, this);
130 void output::geometry(int32_t x, int32_t y, int32_t pw, int32_t ph,
131 int32_t subpel, char const *make, char const *model,
134 "wl::output %s @ %p x %i y %i w %i h %i spel %x make %s model %s tx %i",
135 __func__, this->proxy, x, y, pw, ph, subpel, make, model, tx);
138 void output::mode(uint32_t flags, int32_t w, int32_t h, int32_t r) {
139 logdebug("wl::output %s @ %p f %x w %i h %i r %i", __func__, this->proxy,
141 if ((flags & WL_OUTPUT_MODE_CURRENT) != 0u) {
148 void output::done() {
149 logdebug("wl::output %s @ %p done", __func__, this->proxy);
152 void output::scale(int32_t factor) {
153 logdebug("wl::output %s @ %p f %i", __func__, this->proxy, factor);
157 // _ __ __ _ _ __ ___ ___ ___ _ __ __ _ ___ ___
158 // | '_ \ / _` | '_ ` _ \ / _ \/ __| '_ \ / _` |/ __/ _ \
159 // | | | | (_| | | | | | | __/\__ \ |_) | (_| | (_| __/
160 // |_| |_|\__,_|_| |_| |_|\___||___/ .__/ \__,_|\___\___|
163 // __ _ ___ _ __ (_)_ _(_)
164 // / _` |/ _ \ '_ \| \ \ / / |
165 // | (_| | __/ | | | |\ V /| |
166 // \__, |\___|_| |_|_| \_/ |_|
171 // ___ ___ _ __ | |_ _ __ ___ | | | ___ _ __
172 // / __/ _ \| '_ \| __| '__/ _ \| | |/ _ \ '__|
173 // | (_| (_) | | | | |_| | | (_) | | | __/ |
174 // \___\___/|_| |_|\__|_| \___/|_|_|\___|_|
177 void controller_screen(void *data, struct ivi_controller * /*ivi_controller*/,
179 struct ivi_controller_screen *screen) {
180 static_cast<struct controller *>(data)->controller_screen(id_screen, screen);
183 void controller_layer(void *data, struct ivi_controller * /*ivi_controller*/,
185 static_cast<struct controller *>(data)->controller_layer(id_layer);
188 void controller_surface(void *data, struct ivi_controller * /*ivi_controller*/,
189 uint32_t id_surface) {
190 static_cast<struct controller *>(data)->controller_surface(id_surface);
193 void controller_error(void *data, struct ivi_controller * /*ivi_controller*/,
194 int32_t object_id, int32_t object_type,
195 int32_t error_code, const char *error_text) {
196 static_cast<struct controller *>(data)->controller_error(
197 object_id, object_type, error_code, error_text);
200 constexpr struct ivi_controller_listener listener = {
201 controller_screen, controller_layer, controller_surface, controller_error};
204 controller::controller(struct wl_registry *r, uint32_t name, uint32_t version)
206 wl_registry_bind(r, name, &ivi_controller_interface, version)),
207 surface_proxy_to_id{},
209 screen_proxy_to_id{},
215 ivi_controller_add_listener(this->proxy, &listener, this);
218 controller::~controller() = default;
220 void controller::layer_create(uint32_t id, int32_t w, int32_t h) {
221 this->layers[id] = std::make_unique<layer>(id, w, h, this);
224 void controller::surface_create(uint32_t id) {
225 this->surfaces[id] = std::make_unique<surface>(id, this);
228 void controller::controller_screen(uint32_t id,
229 struct ivi_controller_screen *screen) {
230 logdebug("genivi::controller @ %p screen %u (%x) @ %p", this->proxy, id, id,
232 this->screens[id] = std::make_unique<struct screen>(id, this, screen);
235 void controller::controller_layer(uint32_t id) {
236 logdebug("genivi::controller @ %p layer %u (%x)", this->proxy, id, id);
237 auto &l = this->layers[id] = std::make_unique<struct layer>(id, this);
241 void controller::controller_surface(uint32_t id) {
242 logdebug("genivi::controller @ %p surface %u (%x)", this->proxy, id, id);
243 this->surfaces[id] = std::make_unique<struct surface>(id, this);
245 add_task("fullscreen surface", [id](struct controller *c) {
246 auto &s = c->surfaces[id];
247 s->set_destination_rectangle(0, 0, c->output_size.w, c->output_size.h);
248 s->set_visibility(1);
249 uint32_t lid = id == 0x16180 ? 1000 : 100;
250 c->layers[lid]->add_surface(s.get());
251 logdebug("Surface %u now fullscreen on layer %u", id, lid);
255 void controller::controller_error(int32_t object_id, int32_t object_type,
256 int32_t error_code, const char *error_text) {
257 logdebug("genivi::controller @ %p error o %i t %i c %i text %s", this->proxy,
258 object_id, object_type, error_code, error_text);
262 // | | __ _ _ _ ___ _ __
263 // | |/ _` | | | |/ _ \ '__|
264 // | | (_| | |_| | __/ |
265 // |_|\__,_|\__, |\___|_|
268 void layer_visibility(void *data,
269 struct ivi_controller_layer * /*ivi_controller_layer*/,
270 int32_t visibility) {
271 auto l = static_cast<struct layer *>(data);
272 l->parent->layer_visibility(l->id, visibility);
275 void layer_opacity(void *data,
276 struct ivi_controller_layer * /*ivi_controller_layer*/,
277 wl_fixed_t opacity) {
278 auto l = static_cast<struct layer *>(data);
279 l->parent->layer_opacity(l->id, float(wl_fixed_to_double(opacity)));
282 void layer_source_rectangle(
283 void *data, struct ivi_controller_layer * /*ivi_controller_layer*/,
284 int32_t x, int32_t y, int32_t width, int32_t height) {
285 auto l = static_cast<struct layer *>(data);
286 l->parent->layer_source_rectangle(l->id, x, y, width, height);
289 void layer_destination_rectangle(
290 void *data, struct ivi_controller_layer * /*ivi_controller_layer*/,
291 int32_t x, int32_t y, int32_t width, int32_t height) {
292 auto l = static_cast<struct layer *>(data);
293 l->parent->layer_destination_rectangle(l->id, x, y, width, height);
296 void layer_configuration(void *data,
297 struct ivi_controller_layer * /*ivi_controller_layer*/,
298 int32_t width, int32_t height) {
299 auto l = static_cast<struct layer *>(data);
300 l->parent->layer_configuration(l->id, width, height);
303 void layer_orientation(void *data,
304 struct ivi_controller_layer * /*ivi_controller_layer*/,
305 int32_t orientation) {
306 auto l = static_cast<struct layer *>(data);
307 l->parent->layer_orientation(l->id, orientation);
310 void layer_screen(void *data,
311 struct ivi_controller_layer * /*ivi_controller_layer*/,
312 struct wl_output *screen) {
313 auto l = static_cast<struct layer *>(data);
314 l->parent->layer_screen(l->id, screen);
317 void layer_destroyed(void *data,
318 struct ivi_controller_layer * /*ivi_controller_layer*/) {
319 auto l = static_cast<struct layer *>(data);
320 l->parent->layer_destroyed(l->id);
323 constexpr struct ivi_controller_layer_listener layer_listener = {
324 layer_visibility, layer_opacity,
325 layer_source_rectangle, layer_destination_rectangle,
326 layer_configuration, layer_orientation,
327 layer_screen, layer_destroyed,
331 layer::layer(uint32_t i, struct controller *c) : layer(i, 0, 0, c) {}
333 layer::layer(uint32_t i, int32_t w, int32_t h, struct controller *c)
334 : wayland_proxy(ivi_controller_layer_create(c->proxy, i, w, h)),
335 controller_child(c, i),
342 this->parent->add_proxy_to_id_mapping(this->proxy, i);
343 ivi_controller_layer_add_listener(this->proxy, &layer_listener, this);
347 logdebug("%s layer %i @ %p", __func__, this->id, this->proxy);
348 this->parent->remove_proxy_to_id_mapping(this->proxy);
349 ivi_controller_layer_destroy(this->proxy, 1);
350 this->proxy = nullptr;
353 void layer::set_visibility(uint32_t visibility) {
354 ivi_controller_layer_set_visibility(this->proxy, visibility);
357 void layer::set_opacity(wl_fixed_t opacity) {
358 ivi_controller_layer_set_opacity(this->proxy, 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, x, y, width, height);
366 void layer::set_destination_rectangle(int32_t x, int32_t y, int32_t width,
368 ivi_controller_layer_set_destination_rectangle(this->proxy, x, y, width,
372 void layer::set_configuration(int32_t width, int32_t height) {
373 ivi_controller_layer_set_configuration(this->proxy, width, height);
376 void layer::set_orientation(int32_t orientation) {
377 ivi_controller_layer_set_orientation(this->proxy, orientation);
380 void layer::screenshot(const char *filename) {
381 ivi_controller_layer_screenshot(this->proxy, filename);
384 void layer::clear_surfaces() {
385 ivi_controller_layer_clear_surfaces(this->proxy);
388 void layer::add_surface(struct surface *surface) {
389 ivi_controller_layer_add_surface(this->proxy, surface->proxy);
392 void layer::remove_surface(struct surface *surface) {
393 ivi_controller_layer_remove_surface(this->proxy, surface->proxy);
396 void layer::set_render_order(std::vector<uint32_t> const &ro) {
397 struct wl_array wlro {
398 .size = ro.size() * sizeof(ro[0]), .alloc = ro.capacity() * sizeof(ro[0]),
399 .data = const_cast<void *>(static_cast<void const *>(ro.data()))
401 ivi_controller_layer_set_render_order(this->proxy, &wlro);
404 void controller::layer_visibility(uint32_t id, int32_t visibility) {
405 logdebug("genivi::layer %s @ %p v %i", __func__, this->proxy, visibility);
406 this->layers[id]->visibility = visibility;
409 void controller::layer_opacity(uint32_t id, float opacity) {
410 logdebug("genivi::layer %s @ %p o %f", __func__, this->proxy, opacity);
411 this->layers[id]->opacity = opacity;
414 void controller::layer_source_rectangle(uint32_t id, int32_t x, int32_t y,
415 int32_t width, int32_t height) {
416 logdebug("genivi::layer %s @ %p x %i y %i w %i h %i", __func__, this->proxy,
417 x, y, width, height);
418 this->layers[id]->src_rect = rect{uint32_t(width), uint32_t(height), x, y};
421 void controller::layer_destination_rectangle(uint32_t id, int32_t x, int32_t y,
422 int32_t width, int32_t height) {
423 logdebug("genivi::layer %s @ %p x %i y %i w %i h %i", __func__, this->proxy,
424 x, y, width, height);
425 this->layers[id]->dst_rect = rect{uint32_t(width), uint32_t(height), x, y};
428 void controller::layer_configuration(uint32_t id, int32_t width,
430 logdebug("genivi::layer %s @ %p w %i h %i", __func__, this->proxy, width,
432 this->layers[id]->size = size{uint32_t(width), uint32_t(height)};
435 void controller::layer_orientation(uint32_t id, int32_t orientation) {
436 logdebug("genivi::layer %s @ %p o %i", __func__, this->proxy, orientation);
437 this->layers[id]->orientation = orientation;
440 void controller::layer_screen(uint32_t /*id*/, struct wl_output *screen) {
441 logdebug("genivi::layer %s @ %p s %p", __func__, this->proxy, screen);
444 void controller::layer_destroyed(uint32_t id) {
445 logdebug("genivi::layer %s @ %p", __func__, this->proxy);
446 add_task("remove layer",
447 [id](struct controller *c) { c->layers.erase(id); });
451 // ___ _ _ _ __ / _| __ _ ___ ___
452 // / __| | | | '__| |_ / _` |/ __/ _ \
453 // \__ \ |_| | | | _| (_| | (_| __/
454 // |___/\__,_|_| |_| \__,_|\___\___|
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->id, 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->id, 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->id, 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->id, 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->id, 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->id, 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->id, 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->id, 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->id, redraw_count, frame_count,
521 update_count, pid, process_name);
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->id);
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->id, 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, i)),
554 controller_child(c, i),
561 this->parent->add_proxy_to_id_mapping(this->proxy, i);
562 ivi_controller_surface_add_listener(this->proxy, &surface_listener, this);
565 surface::~surface() {
566 logdebug("%s surface %i @ %p", __func__, this->id, this->proxy);
567 this->parent->remove_proxy_to_id_mapping(this->proxy);
568 ivi_controller_surface_destroy(this->proxy, 1);
569 this->proxy = nullptr;
572 void surface::set_visibility(uint32_t visibility) {
573 ivi_controller_surface_set_visibility(this->proxy, visibility);
576 void surface::set_opacity(wl_fixed_t opacity) {
577 ivi_controller_surface_set_opacity(this->proxy, opacity);
580 void surface::set_source_rectangle(int32_t x, int32_t y, int32_t width,
582 ivi_controller_surface_set_source_rectangle(this->proxy, x, y, width,
586 void surface::set_destination_rectangle(int32_t x, int32_t y, int32_t width,
588 ivi_controller_surface_set_destination_rectangle(this->proxy, x, y, width,
592 void surface::set_configuration(int32_t width, int32_t height) {
593 ivi_controller_surface_set_configuration(this->proxy, width, height);
596 void surface::set_orientation(int32_t orientation) {
597 ivi_controller_surface_set_orientation(this->proxy, orientation);
600 void surface::screenshot(const char *filename) {
601 ivi_controller_surface_screenshot(this->proxy, filename);
604 void surface::send_stats() { ivi_controller_surface_send_stats(this->proxy); }
606 void surface::destroy(int32_t destroy_scene_object) {
607 ivi_controller_surface_destroy(this->proxy, destroy_scene_object);
610 void controller::surface_visibility(uint32_t id, int32_t visibility) {
611 logdebug("genivi::surface %s @ %p v %i", __func__, this->proxy, visibility);
612 this->surfaces[id]->visibility = visibility;
615 void controller::surface_opacity(uint32_t id, float opacity) {
616 logdebug("genivi::surface %s @ %p o %f", __func__, this->proxy, opacity);
617 this->surfaces[id]->opacity = opacity;
620 void controller::surface_source_rectangle(uint32_t id, int32_t x, int32_t y,
621 int32_t width, int32_t height) {
622 logdebug("genivi::surface %s @ %p x %i y %i w %i h %i", __func__,
623 this->proxy, x, y, width, height);
624 this->surfaces[id]->src_rect = rect{uint32_t(width), uint32_t(height), x, y};
627 void controller::surface_destination_rectangle(uint32_t id, int32_t x,
628 int32_t y, int32_t width,
630 logdebug("genivi::surface %s @ %p x %i y %i w %i h %i", __func__,
631 this->proxy, x, y, width, height);
632 this->surfaces[id]->dst_rect = rect{uint32_t(width), uint32_t(height), x, y};
635 void controller::surface_configuration(uint32_t id, int32_t width,
637 logdebug("genivi::surface %s @ %p w %i h %i", __func__, this->proxy, width,
639 this->surfaces[id]->size = size{uint32_t(width), uint32_t(height)};
642 void controller::surface_orientation(uint32_t id, int32_t orientation) {
643 logdebug("genivi::surface %s @ %p o %i", __func__, this->proxy, orientation);
644 this->surfaces[id]->orientation = orientation;
647 void controller::surface_pixelformat(uint32_t /*id*/, int32_t pixelformat) {
648 logdebug("genivi::surface %s @ %p f %i", __func__, this->proxy, pixelformat);
651 void controller::surface_layer(uint32_t /*id*/,
652 struct ivi_controller_layer *layer) {
653 logdebug("genivi::surface %s @ %p l %u @ %p", __func__, this->proxy,
654 this->layer_proxy_to_id[uintptr_t(layer)], layer);
657 void controller::surface_stats(uint32_t /*id*/, uint32_t redraw_count,
658 uint32_t frame_count, uint32_t update_count,
659 uint32_t pid, const char *process_name) {
660 logdebug("genivi::surface %s @ %p r %u f %u u %u pid %u p %s", __func__,
661 this->proxy, redraw_count, frame_count, update_count, pid,
665 void controller::surface_destroyed(uint32_t id) {
666 logdebug("genivi::surface %s @ %p", __func__, this->proxy);
667 this->surfaces.erase(id);
670 void controller::surface_content(uint32_t id, int32_t content_state) {
671 logdebug("genivi::surface %s @ %p s %i", __func__, this->proxy,
673 if (content_state == IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_REMOVED) {
674 add_task("remove surface",
675 [id](struct controller *c) { c->surfaces.erase(id); });
679 void controller::add_proxy_to_id_mapping(struct ivi_controller_surface *p, uint32_t id) {
680 this->surface_proxy_to_id[uintptr_t(p)] = id;
681 logdebug("Add surface proxy mapping for %p (%u)", p, id);
684 void controller::remove_proxy_to_id_mapping(struct ivi_controller_surface *p) {
685 logdebug("Remove surface proxy mapping for %p", p);
686 this->surface_proxy_to_id.erase(uintptr_t(p));
689 void controller::add_proxy_to_id_mapping(struct ivi_controller_layer *p, uint32_t id) {
690 logdebug("Add layer proxy mapping for %p (%u)", p, id);
691 this->layer_proxy_to_id[uintptr_t(p)] = id;
694 void controller::remove_proxy_to_id_mapping(struct ivi_controller_layer *p) {
695 logdebug("Remove layer proxy mapping for %p", p);
696 this->layer_proxy_to_id.erase(uintptr_t(p));
699 void controller::add_proxy_to_id_mapping(struct wl_output *p, uint32_t id) {
700 logdebug("Add screen proxy mapping for %p (%u)", p, id);
701 this->screen_proxy_to_id[uintptr_t(p)] = id;
704 void controller::remove_proxy_to_id_mapping(struct wl_output *p) {
705 logdebug("Remove screen proxy mapping for %p", p);
706 this->screen_proxy_to_id.erase(uintptr_t(p));
709 void controller::add_task(char const *name, std::function<void(struct controller *)> &&f) {
710 this->pending.emplace_back(std::make_pair(name, f));
713 void controller::execute_pending() {
714 if (!this->pending.empty()) {
715 for (auto &t : this->pending) {
716 logdebug("executing task '%s'", t.first);
719 this->pending.clear();
720 ivi_controller_commit_changes(this->proxy);
721 // XXX: No flush here...
726 // ___ ___ _ __ ___ ___ _ __
727 // / __|/ __| '__/ _ \/ _ \ '_ \
728 // \__ \ (__| | | __/ __/ | | |
729 // |___/\___|_| \___|\___|_| |_|
731 screen::screen(uint32_t i, struct controller *c,
732 struct ivi_controller_screen *p)
733 : wayland_proxy(p), controller_child(c, i) {
734 logdebug("genivi::screen @ %p id %u", p, i);
737 void screen::clear() { ivi_controller_screen_clear(this->proxy); }
739 void screen::add_layer(layer *l) {
740 ivi_controller_screen_add_layer(this->proxy, l->proxy);
743 void screen::set_render_order(std::vector<uint32_t> const &ro) {
744 struct wl_array wlro {
745 .size = ro.size() * sizeof(ro[0]), .alloc = ro.capacity() * sizeof(ro[0]),
746 .data = const_cast<void *>(static_cast<void const *>(ro.data()))
748 ivi_controller_screen_set_render_order(this->proxy, &wlro);
751 } // namespace genivi