Migrate hmi-debug into util
[apps/agl-service-windowmanager.git] / src / wayland_ivi_wm.cpp
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include "wayland_ivi_wm.hpp"
18
19 /**
20  * namespace wl
21  */
22 namespace wl
23 {
24
25 /**
26  * display
27  */
28 display::display()
29     : d(std::unique_ptr<struct wl_display, void (*)(struct wl_display *)>(
30           wl_display_connect(nullptr), &wl_display_disconnect)),
31       r(d.get()) {}
32
33 bool display::ok() const { return d && wl_display_get_error(d.get()) == 0; }
34
35 void display::roundtrip() { wl_display_roundtrip(this->d.get()); }
36
37 int display::dispatch() { return wl_display_dispatch(this->d.get()); }
38
39 int display::dispatch_pending() { return wl_display_dispatch_pending(this->d.get()); }
40
41 int display::read_events()
42 {
43     while (wl_display_prepare_read(this->d.get()) == -1)
44     {
45         if (wl_display_dispatch_pending(this->d.get()) == -1)
46         {
47             return -1;
48         }
49     }
50
51     if (wl_display_flush(this->d.get()) == -1)
52     {
53         return -1;
54     }
55
56     if (wl_display_read_events(this->d.get()) == -1)
57     {
58         wl_display_cancel_read(this->d.get());
59     }
60
61     return 0;
62 }
63
64 void display::flush() { wl_display_flush(this->d.get()); }
65
66 int display::get_fd() const { return wl_display_get_fd(this->d.get()); }
67
68 int display::get_error() { return wl_display_get_error(this->d.get()); }
69
70 /**
71  * registry
72  */
73 namespace
74 {
75 void registry_global_created(void *data, struct wl_registry * /*r*/, uint32_t name,
76                              char const *iface, uint32_t v)
77 {
78     static_cast<struct registry *>(data)->global_created(name, iface, v);
79 }
80
81 void registry_global_removed(void *data, struct wl_registry * /*r*/,
82                              uint32_t name)
83 {
84     static_cast<struct registry *>(data)->global_removed(name);
85 }
86
87 constexpr struct wl_registry_listener registry_listener = {
88     registry_global_created, registry_global_removed};
89 } // namespace
90
91 registry::registry(struct wl_display *d)
92     : wayland_proxy(d == nullptr ? nullptr : wl_display_get_registry(d))
93 {
94     if (this->proxy != nullptr)
95     {
96         wl_registry_add_listener(this->proxy.get(), &registry_listener, this);
97     }
98 }
99
100 void registry::add_global_handler(char const *iface, binder bind)
101 {
102     this->bindings[iface] = std::move(bind);
103 }
104
105 void registry::global_created(uint32_t name, char const *iface, uint32_t v)
106 {
107     auto b = this->bindings.find(iface);
108     if (b != this->bindings.end())
109     {
110         b->second(this->proxy.get(), name, v);
111     }
112     HMI_DEBUG("wl::registry @ %p global n %u i %s v %u", this->proxy.get(), name,
113               iface, v);
114 }
115
116 void registry::global_removed(uint32_t /*name*/) {}
117
118 /**
119  * output
120  */
121 namespace
122 {
123 void output_geometry(void *data, struct wl_output * /*wl_output*/, int32_t x,
124                      int32_t y, int32_t physical_width, int32_t physical_height,
125                      int32_t subpixel, const char *make, const char *model,
126                      int32_t transform)
127 {
128     static_cast<struct output *>(data)->geometry(
129         x, y, physical_width, physical_height, subpixel, make, model, transform);
130 }
131
132 void output_mode(void *data, struct wl_output * /*wl_output*/, uint32_t flags,
133                  int32_t width, int32_t height, int32_t refresh)
134 {
135     static_cast<struct output *>(data)->mode(flags, width, height, refresh);
136 }
137
138 void output_done(void *data, struct wl_output * /*wl_output*/)
139 {
140     static_cast<struct output *>(data)->done();
141 }
142
143 void output_scale(void *data, struct wl_output * /*wl_output*/,
144                   int32_t factor)
145 {
146     static_cast<struct output *>(data)->scale(factor);
147 }
148
149 constexpr struct wl_output_listener output_listener = {
150     output_geometry, output_mode, output_done, output_scale};
151 } // namespace
152
153 output::output(struct wl_registry *r, uint32_t name, uint32_t v)
154     : wayland_proxy(wl_registry_bind(r, name, &wl_output_interface, v))
155 {
156     wl_output_add_listener(this->proxy.get(), &output_listener, this);
157 }
158
159 void output::geometry(int32_t x, int32_t y, int32_t pw, int32_t ph,
160                       int32_t subpel, char const *make, char const *model,
161                       int32_t tx)
162 {
163     HMI_DEBUG("wl::output %s @ %p x %i y %i w %i h %i spel %x make %s model %s tx %i",
164               __func__, this->proxy.get(), x, y, pw, ph, subpel, make, model, tx);
165     this->physical_width = pw;
166     this->physical_height = ph;
167     this->transform = tx;
168 }
169
170 void output::mode(uint32_t flags, int32_t w, int32_t h, int32_t r)
171 {
172     HMI_DEBUG("wl::output %s @ %p f %x w %i h %i r %i", __func__,
173               this->proxy.get(), flags, w, h, r);
174     if ((flags & WL_OUTPUT_MODE_CURRENT) != 0u)
175     {
176         this->width = w;
177         this->height = h;
178         this->refresh = r;
179     }
180 }
181
182 void output::done()
183 {
184     HMI_DEBUG("wl::output %s @ %p done", __func__, this->proxy.get());
185     // Pivot and flipped
186     if (this->transform == WL_OUTPUT_TRANSFORM_90 ||
187         this->transform == WL_OUTPUT_TRANSFORM_270 ||
188         this->transform == WL_OUTPUT_TRANSFORM_FLIPPED_90 ||
189         this->transform == WL_OUTPUT_TRANSFORM_FLIPPED_270)
190     {
191         std::swap(this->width, this->height);
192         std::swap(this->physical_width, this->physical_height);
193     }
194 }
195
196 void output::scale(int32_t factor)
197 {
198     HMI_DEBUG("wl::output %s @ %p f %i", __func__, this->proxy.get(), factor);
199 }
200 } // namespace wl
201
202 /**
203  * namespace compositor
204  */
205 namespace compositor
206 {
207
208 namespace
209 {
210
211 void surface_visibility_changed(
212     void *data, struct ivi_wm * /*ivi_wm*/,
213     uint32_t surface_id, int32_t visibility)
214 {
215     auto c = static_cast<struct controller *>(data);
216     c->surface_visibility_changed(surface_id, visibility);
217 }
218
219 void surface_opacity_changed(void *data, struct ivi_wm * /*ivi_wm*/,
220                              uint32_t surface_id, wl_fixed_t opacity)
221 {
222     auto c = static_cast<struct controller *>(data);
223     c->surface_opacity_changed(surface_id, float(wl_fixed_to_double(opacity)));
224 }
225
226 void surface_source_rectangle_changed(
227     void *data, struct ivi_wm * /*ivi_wm*/, uint32_t surface_id,
228     int32_t x, int32_t y, int32_t width, int32_t height)
229 {
230     auto c = static_cast<struct controller *>(data);
231     c->surface_source_rectangle_changed(surface_id, x, y, width, height);
232 }
233
234 void surface_destination_rectangle_changed(
235     void *data, struct ivi_wm * /*ivi_wm*/, uint32_t surface_id,
236     int32_t x, int32_t y, int32_t width, int32_t height)
237 {
238     auto c = static_cast<struct controller *>(data);
239     c->surface_destination_rectangle_changed(surface_id, x, y, width, height);
240 }
241
242 void surface_created(void *data, struct ivi_wm * /*ivi_wm*/,
243                      uint32_t id_surface)
244 {
245     static_cast<struct controller *>(data)->surface_created(id_surface);
246 }
247
248 void surface_destroyed(
249     void *data, struct ivi_wm * /*ivi_wm*/, uint32_t surface_id)
250 {
251     auto c = static_cast<struct controller *>(data);
252     c->surface_destroyed(surface_id);
253 }
254
255 void surface_error_detected(void *data, struct ivi_wm * /*ivi_wm*/, uint32_t object_id,
256                             uint32_t error_code, const char *error_text)
257 {
258     static_cast<struct controller *>(data)->surface_error_detected(
259         object_id, error_code, error_text);
260 }
261
262 void surface_size_changed(
263     void *data, struct ivi_wm * /*ivi_wm*/, uint32_t surface_id,
264     int32_t width, int32_t height)
265 {
266     auto c = static_cast<struct controller *>(data);
267     c->surface_size_changed(surface_id, width, height);
268 }
269
270 void surface_stats_received(void *data, struct ivi_wm * /*ivi_wm*/,
271                             uint32_t surface_id, uint32_t frame_count, uint32_t pid)
272 {
273     auto c = static_cast<struct controller *>(data);
274     c->surface_stats_received(surface_id, frame_count, pid);
275 }
276
277 void surface_added_to_layer(void *data, struct ivi_wm * /*ivi_wm*/,
278                             uint32_t layer_id, uint32_t surface_id)
279 {
280     auto c = static_cast<struct controller *>(data);
281     c->surface_added_to_layer(layer_id, surface_id);
282 }
283
284 void layer_visibility_changed(void *data, struct ivi_wm * /*ivi_wm*/,
285                               uint32_t layer_id, int32_t visibility)
286 {
287     auto c = static_cast<struct controller *>(data);
288     c->layer_visibility_changed(layer_id, visibility);
289 }
290
291 void layer_opacity_changed(void *data, struct ivi_wm * /*ivi_wm*/,
292                            uint32_t layer_id, wl_fixed_t opacity)
293 {
294     auto c = static_cast<struct controller *>(data);
295     c->layer_opacity_changed(layer_id, float(wl_fixed_to_double(opacity)));
296 }
297
298 void layer_source_rectangle_changed(
299     void *data, struct ivi_wm * /*ivi_wm*/, uint32_t layer_id,
300     int32_t x, int32_t y, int32_t width, int32_t height)
301 {
302     auto c = static_cast<struct controller *>(data);
303     c->layer_source_rectangle_changed(layer_id, x, y, width, height);
304 }
305
306 void layer_destination_rectangle_changed(
307     void *data, struct ivi_wm * /*ivi_wm*/, uint32_t layer_id,
308     int32_t x, int32_t y, int32_t width, int32_t height)
309 {
310     auto c = static_cast<struct controller *>(data);
311     c->layer_destination_rectangle_changed(layer_id, x, y, width, height);
312 }
313
314 void layer_created(void *data, struct ivi_wm * /*ivi_wm*/,
315                    uint32_t id_layer)
316 {
317     static_cast<struct controller *>(data)->layer_created(id_layer);
318 }
319
320 void layer_destroyed(void *data, struct ivi_wm * /*ivi_wm*/, uint32_t layer_id)
321 {
322     auto c = static_cast<struct controller *>(data);
323     c->layer_destroyed(layer_id);
324 }
325
326 void layer_error_detected(void *data, struct ivi_wm * /*ivi_wm*/, uint32_t object_id,
327                           uint32_t error_code, const char *error_text)
328 {
329     static_cast<struct controller *>(data)->layer_error_detected(
330         object_id, error_code, error_text);
331 }
332
333 constexpr struct ivi_wm_listener listener = {
334     surface_visibility_changed,
335     layer_visibility_changed,
336     surface_opacity_changed,
337     layer_opacity_changed,
338     surface_source_rectangle_changed,
339     layer_source_rectangle_changed,
340     surface_destination_rectangle_changed,
341     layer_destination_rectangle_changed,
342     surface_created,
343     layer_created,
344     surface_destroyed,
345     layer_destroyed,
346     surface_error_detected,
347     layer_error_detected,
348     surface_size_changed,
349     surface_stats_received,
350     surface_added_to_layer,
351 };
352
353 void screen_created(void *data, struct ivi_wm_screen *ivi_wm_screen, uint32_t id)
354 {
355     static_cast<struct screen *>(data)->screen_created((struct screen *)data, id);
356 }
357
358 void layer_added(void *data,
359                  struct ivi_wm_screen *ivi_wm_screen,
360                  uint32_t layer_id)
361 {
362     HMI_DEBUG("added layer_id:%d", layer_id);
363 }
364
365 void connector_name(void *data,
366                     struct ivi_wm_screen *ivi_wm_screen,
367                     const char *process_name)
368 {
369     HMI_DEBUG("process_name:%s", process_name);
370 }
371
372 void screen_error(void *data,
373                   struct ivi_wm_screen *ivi_wm_screen,
374                   uint32_t error,
375                   const char *message)
376 {
377     HMI_DEBUG("screen error:%d message:%s", error, message);
378 }
379
380 constexpr struct ivi_wm_screen_listener screen_listener = {
381     screen_created,
382     layer_added,
383     connector_name,
384     screen_error,
385 };
386 } // namespace
387
388 /**
389  * surface
390  */
391 surface::surface(uint32_t i, struct controller *c)
392     : controller_child(c, i)
393 {
394     this->parent->add_proxy_to_sid_mapping(this->parent->proxy.get(), i);
395 }
396
397 void surface::set_visibility(uint32_t visibility)
398 {
399     HMI_DEBUG("compositor::surface id:%d v:%d", this->id, visibility);
400     ivi_wm_set_surface_visibility(this->parent->proxy.get(), this->id, visibility);
401 }
402
403 void surface::set_source_rectangle(int32_t x, int32_t y,
404                                    int32_t width, int32_t height)
405 {
406     ivi_wm_set_surface_source_rectangle(this->parent->proxy.get(), this->id,
407                                         x, y, width, height);
408 }
409
410 void surface::set_destination_rectangle(int32_t x, int32_t y,
411                                         int32_t width, int32_t height)
412 {
413     ivi_wm_set_surface_destination_rectangle(this->parent->proxy.get(), this->id,
414                                              x, y, width, height);
415 }
416
417 /**
418  * layer
419  */
420 layer::layer(uint32_t i, struct controller *c) : layer(i, 0, 0, c) {}
421
422 layer::layer(uint32_t i, int32_t w, int32_t h, struct controller *c)
423     : controller_child(c, i)
424 {
425     this->parent->add_proxy_to_lid_mapping(this->parent->proxy.get(), i);
426     ivi_wm_create_layout_layer(c->proxy.get(), i, w, h);
427 }
428
429 void layer::set_visibility(uint32_t visibility)
430 {
431     ivi_wm_set_layer_visibility(this->parent->proxy.get(), this->id, visibility);
432 }
433
434 void layer::set_destination_rectangle(int32_t x, int32_t y,
435                                       int32_t width, int32_t height)
436 {
437     ivi_wm_set_layer_destination_rectangle(this->parent->proxy.get(), this->id,
438                                            x, y, width, height);
439 }
440
441 void layer::add_surface(uint32_t surface_id)
442 {
443     ivi_wm_layer_add_surface(this->parent->proxy.get(), this->id, surface_id);
444 }
445
446 void layer::remove_surface(uint32_t surface_id)
447 {
448     ivi_wm_layer_remove_surface(this->parent->proxy.get(), this->id, surface_id);
449 }
450
451 /**
452  * screen
453  */
454 screen::screen(uint32_t i, struct controller *c, struct wl_output *o)
455     : wayland_proxy(ivi_wm_create_screen(c->proxy.get(), o)),
456       controller_child(c, i)
457 {
458     HMI_DEBUG("compositor::screen @ %p id %u o %p", this->proxy.get(), i, o);
459
460     // Add listener for screen
461     ivi_wm_screen_add_listener(this->proxy.get(), &screen_listener, this);
462 }
463
464 void screen::clear() { ivi_wm_screen_clear(this->proxy.get()); }
465
466 void screen::screen_created(struct screen *screen, uint32_t id)
467 {
468     HMI_DEBUG("compositor::screen @ %p screen %u (%x) @ %p", this->proxy.get(),
469               id, id, screen);
470     this->id = id;
471     this->parent->screens[id] = screen;
472 }
473
474 void screen::set_render_order(std::vector<uint32_t> const &ro)
475 {
476     std::size_t i;
477
478     // Remove all layers from the screen render order
479     ivi_wm_screen_clear(this->proxy.get());
480
481     for (i = 0; i < ro.size(); i++)
482     {
483         HMI_DEBUG("compositor::screen @ %p add layer %u", this->proxy.get(), ro[i]);
484         // Add the layer to screen render order at nearest z-position
485         ivi_wm_screen_add_layer(this->proxy.get(), ro[i]);
486     }
487 }
488
489 /**
490  * controller
491  */
492 controller::controller(struct wl_registry *r, uint32_t name, uint32_t version)
493     : wayland_proxy(
494           wl_registry_bind(r, name, &ivi_wm_interface, version)),
495       output_size{}
496 {
497     ivi_wm_add_listener(this->proxy.get(), &listener, this);
498 }
499
500 void controller::layer_create(uint32_t id, int32_t w, int32_t h)
501 {
502     this->layers[id] = std::make_unique<struct layer>(id, w, h, this);
503 }
504
505 void controller::surface_create(uint32_t id)
506 {
507     this->surfaces[id] = std::make_unique<struct surface>(id, this);
508
509     // TODO: If Clipping is necessary, this process should be modified.
510     {
511         // Set surface type:IVI_WM_SURFACE_TYPE_DESKTOP)
512         // for resizing wayland surface when switching from split to full surface.
513         ivi_wm_set_surface_type(this->proxy.get(), id, IVI_WM_SURFACE_TYPE_DESKTOP);
514
515         // Set source reactangle even if we should not need to set it
516         // for enable setting for destination region.
517         this->surfaces[id]->set_source_rectangle(0, 0, this->output_size.w, this->output_size.h);
518
519         // Flush display
520         this->display->flush();
521     }
522 }
523
524 void controller::create_screen(struct wl_output *output)
525 {
526     // TODO: screen id is 0 (WM manages one screen for now)
527     this->screen = std::make_unique<struct screen>(0, this, output);
528 }
529
530 void controller::get_surface_properties(uint32_t surface_id, int param)
531 {
532     ivi_wm_surface_get(this->proxy.get(), surface_id, param);
533 }
534
535 void controller::layer_created(uint32_t id)
536 {
537     HMI_DEBUG("compositor::controller @ %p layer %u (%x)", this->proxy.get(), id, id);
538     if (this->layers.find(id) != this->layers.end())
539     {
540         HMI_DEBUG("WindowManager has created layer %u (%x) already", id, id);
541     }
542     else
543     {
544         this->layers[id] = std::make_unique<struct layer>(id, this);
545     }
546 }
547
548 void controller::layer_error_detected(uint32_t object_id,
549                                       uint32_t error_code, const char *error_text)
550 {
551     HMI_DEBUG("compositor::controller @ %p error o %d c %d text %s",
552               this->proxy.get(), object_id, error_code, error_text);
553 }
554
555 void controller::surface_visibility_changed(uint32_t id, int32_t visibility)
556 {
557     HMI_DEBUG("compositor::surface %s @ %d v %i", __func__, id,
558               visibility);
559     this->sprops[id].visibility = visibility;
560     this->chooks->surface_visibility(id, visibility);
561 }
562
563 void controller::surface_opacity_changed(uint32_t id, float opacity)
564 {
565     HMI_DEBUG("compositor::surface %s @ %d o %f",
566                 __func__, id, opacity);
567     this->sprops[id].opacity = opacity;
568 }
569
570 void controller::surface_source_rectangle_changed(uint32_t id, int32_t x,
571                                                   int32_t y, int32_t width,
572                                                   int32_t height)
573 {
574     HMI_DEBUG("compositor::surface %s @ %d x %i y %i w %i h %i", __func__,
575               id, x, y, width, height);
576     this->sprops[id].src_rect = rect{width, height, x, y};
577 }
578
579 void controller::surface_destination_rectangle_changed(uint32_t id, int32_t x,
580                                                        int32_t y, int32_t width,
581                                                        int32_t height)
582 {
583     HMI_DEBUG("compositor::surface %s @ %d x %i y %i w %i h %i", __func__,
584               id, x, y, width, height);
585     this->sprops[id].dst_rect = rect{width, height, x, y};
586     this->chooks->surface_destination_rectangle(id, x, y, width, height);
587 }
588
589 void controller::surface_size_changed(uint32_t id, int32_t width,
590                                       int32_t height)
591 {
592     HMI_DEBUG("compositor::surface %s @ %d w %i h %i", __func__, id,
593               width, height);
594     this->sprops[id].size = size{uint32_t(width), uint32_t(height)};
595     this->surfaces[id]->set_source_rectangle(0, 0, width, height);
596 }
597
598 void controller::surface_added_to_layer(uint32_t layer_id, uint32_t surface_id)
599 {
600     HMI_DEBUG("compositor::surface %s @ %d l %u",
601               __func__, layer_id, surface_id);
602 }
603
604 void controller::surface_stats_received(uint32_t surface_id,
605                                         uint32_t frame_count, uint32_t pid)
606 {
607     HMI_DEBUG("compositor::surface %s @ %d f %u pid %u",
608               __func__, surface_id, frame_count, pid);
609 }
610
611 void controller::surface_created(uint32_t id)
612 {
613     HMI_DEBUG("compositor::controller @ %p surface %u (%x)", this->proxy.get(), id,
614               id);
615     if (this->surfaces.find(id) == this->surfaces.end())
616     {
617         this->surfaces[id] = std::make_unique<struct surface>(id, this);
618         this->chooks->surface_created(id);
619
620         // Set surface type:IVI_WM_SURFACE_TYPE_DESKTOP)
621         // for resizing wayland surface when switching from split to full surface.
622         ivi_wm_set_surface_type(this->proxy.get(), id, IVI_WM_SURFACE_TYPE_DESKTOP);
623
624         // Flush display
625         this->display->flush();
626     }
627 }
628
629 void controller::surface_destroyed(uint32_t surface_id)
630 {
631     HMI_DEBUG("compositor::surface %s @ %d", __func__, surface_id);
632     this->chooks->surface_removed(surface_id);
633     this->sprops.erase(surface_id);
634     this->surfaces.erase(surface_id);
635 }
636
637 void controller::surface_error_detected(uint32_t object_id,
638                                         uint32_t error_code, const char *error_text)
639 {
640     HMI_DEBUG("compositor::controller @ %p error o %d c %d text %s",
641               this->proxy.get(), object_id, error_code, error_text);
642 }
643
644 void controller::layer_visibility_changed(uint32_t layer_id, int32_t visibility)
645 {
646     HMI_DEBUG("compositor::layer %s @ %d v %i", __func__, layer_id, visibility);
647     this->lprops[layer_id].visibility = visibility;
648 }
649
650 void controller::layer_opacity_changed(uint32_t layer_id, float opacity)
651 {
652     HMI_DEBUG("compositor::layer %s @ %d o %f", __func__, layer_id, opacity);
653     this->lprops[layer_id].opacity = opacity;
654 }
655
656 void controller::layer_source_rectangle_changed(uint32_t layer_id,
657                                                 int32_t x, int32_t y,
658                                                 int32_t width, int32_t height)
659 {
660     HMI_DEBUG("compositor::layer %s @ %d x %i y %i w %i h %i",
661               __func__, layer_id, x, y, width, height);
662     this->lprops[layer_id].src_rect = rect{width, height, x, y};
663 }
664
665 void controller::layer_destination_rectangle_changed(uint32_t layer_id,
666                                                      int32_t x, int32_t y,
667                                                      int32_t width, int32_t height)
668 {
669     HMI_DEBUG("compositor::layer %s @ %d x %i y %i w %i h %i",
670               __func__, layer_id, x, y, width, height);
671     this->lprops[layer_id].dst_rect = rect{width, height, x, y};
672 }
673
674 void controller::layer_destroyed(uint32_t layer_id)
675 {
676     HMI_DEBUG("compositor::layer %s @ %d", __func__, layer_id);
677     this->lprops.erase(layer_id);
678     this->layers.erase(layer_id);
679 }
680
681 void controller::add_proxy_to_sid_mapping(struct ivi_wm *p,
682                                           uint32_t id)
683 {
684     HMI_DEBUG("Add surface proxy mapping for %p (%u)", p, id);
685     this->surface_proxy_to_id[uintptr_t(p)] = id;
686     this->sprops[id].id = id;
687 }
688
689 void controller::remove_proxy_to_sid_mapping(struct ivi_wm *p)
690 {
691     HMI_DEBUG("Remove surface proxy mapping for %p", p);
692     this->surface_proxy_to_id.erase(uintptr_t(p));
693 }
694
695 void controller::add_proxy_to_lid_mapping(struct ivi_wm *p,
696                                           uint32_t id)
697 {
698     HMI_DEBUG("Add layer proxy mapping for %p (%u)", p, id);
699     this->layer_proxy_to_id[uintptr_t(p)] = id;
700     this->lprops[id].id = id;
701 }
702
703 void controller::remove_proxy_to_lid_mapping(struct ivi_wm *p)
704 {
705     HMI_DEBUG("Remove layer proxy mapping for %p", p);
706     this->layer_proxy_to_id.erase(uintptr_t(p));
707 }
708
709 void controller::add_proxy_to_id_mapping(struct wl_output *p, uint32_t id)
710 {
711     HMI_DEBUG("Add screen proxy mapping for %p (%u)", p, id);
712     this->screen_proxy_to_id[uintptr_t(p)] = id;
713 }
714
715 void controller::remove_proxy_to_id_mapping(struct wl_output *p)
716 {
717     HMI_DEBUG("Remove screen proxy mapping for %p", p);
718     this->screen_proxy_to_id.erase(uintptr_t(p));
719 }
720
721 } // namespace compositor