246b629a5258fc2eb8db747877fe784376b8a2a4
[staging/windowmanager.git] / src / app.cpp
1 /*
2  * Copyright (C) 2017 Mentor Graphics Development (Deutschland) GmbH
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 "app.hpp"
18 #include "json_helper.hpp"
19 #include "layers.hpp"
20 #include "layout.hpp"
21 #include "util.hpp"
22 #include "wayland.hpp"
23
24 #include <cstdio>
25 #include <memory>
26
27 #include <cassert>
28
29 #include <json-c/json.h>
30
31 #include <algorithm>
32 #include <bits/signum.h>
33 #include <csignal>
34 #include <fstream>
35 #include <json.hpp>
36 #include <regex>
37 #include <thread>
38
39 namespace wm {
40
41 namespace {
42 App *g_app;
43
44 using nlohmann::json;
45
46 result<json> file_to_json(char const *filename) {
47    std::ifstream i(filename);
48    if (i.fail()) {
49       return Err<json>("Could not open config file");
50    }
51    json j;
52    i >> j;
53    return Ok(j);
54 }
55
56 struct result<layer_map> load_layer_map(char const *filename) {
57    logdebug("loading IDs from %s", filename);
58
59    auto j = file_to_json(filename);
60    if (j.is_err()) {
61       return Err<layer_map>(j.unwrap_err());
62    }
63    json jids = j.unwrap();
64
65    return to_layer_map(jids);
66 }
67
68 }  // namespace
69
70 //       _                    _                  _                 _
71 //   ___| | __ _ ___ ___     / \   _ __  _ __   (_)_ __ ___  _ __ | |
72 //  / __| |/ _` / __/ __|   / _ \ | '_ \| '_ \  | | '_ ` _ \| '_ \| |
73 // | (__| | (_| \__ \__ \  / ___ \| |_) | |_) | | | | | | | | |_) | |
74 //  \___|_|\__,_|___/___/ /_/   \_\ .__/| .__/  |_|_| |_| |_| .__/|_|
75 //                                |_|   |_|                 |_|
76 App::App(wl::display *d)
77    : api{this},
78      chooks{this},
79      display{d},
80      controller{},
81      outputs(),
82      config(),
83      layouts(),
84      layers(),
85      id_alloc{},
86      pending_events(false),
87      policy{} {
88    assert(g_app == nullptr);
89    g_app = this;
90
91    try {
92       {
93          auto l = load_layer_map(
94             this->config.get_string("layers.json").value().c_str());
95          if (l.is_ok()) {
96             this->layers = l.unwrap();
97          } else {
98             logerror("%s", l.err().value());
99          }
100       }
101    } catch (std::exception &e) {
102       logerror("Loading of configuration failed: %s", e.what());
103    }
104 }
105
106 App::~App() { g_app = nullptr; }
107
108 int App::init() {
109    if (!this->display->ok()) {
110       return -1;
111    }
112
113    if (this->layers.mapping.empty()) {
114       logerror("No surface -> layer mapping loaded");
115       return -1;
116    }
117
118    this->display->add_global_handler(
119       "wl_output", [this](wl_registry *r, uint32_t name, uint32_t v) {
120          this->outputs.emplace_back(std::make_unique<wl::output>(r, name, v));
121       });
122
123    this->display->add_global_handler(
124       "ivi_controller", [this](wl_registry *r, uint32_t name, uint32_t v) {
125          this->controller =
126             std::make_unique<struct genivi::controller>(r, name, v);
127
128          // Init controller hooks
129          this->controller->chooks = &this->chooks;
130
131          // XXX: This protocol needs the output, so lets just add our mapping
132          // here...
133          this->controller->add_proxy_to_id_mapping(
134             this->outputs.back()->proxy.get(),
135             wl_proxy_get_id(reinterpret_cast<struct wl_proxy *>(
136                this->outputs.back()->proxy.get())));
137       });
138
139    // First level objects
140    this->display->roundtrip();
141    // Second level objects
142    this->display->roundtrip();
143    // Third level objects
144    this->display->roundtrip();
145
146    return init_layers();
147 }
148
149 int App::dispatch_events() {
150    if (this->dispatch_events() == 0) {
151       return 0;
152    }
153
154    int ret = this->display->dispatch();
155    if (ret == -1) {
156       logerror("wl_display_dipatch() returned error %d",
157                this->display->get_error());
158       return -1;
159    }
160    this->display->flush();
161
162    return 0;
163 }
164
165 int App::dispatch_pending_events() {
166    if (this->pop_pending_events()) {
167       this->display->dispatch_pending();
168       return 0;
169    }
170    return -1;
171 }
172
173 bool App::pop_pending_events() {
174    bool x{true};
175    return this->pending_events.compare_exchange_strong(
176       x, false, std::memory_order_consume);
177 }
178
179 void App::set_pending_events() {
180    this->pending_events.store(true, std::memory_order_release);
181 }
182
183 optional<int> App::lookup_id(char const *name) {
184    return this->id_alloc.lookup(std::string(name));
185 }
186 optional<std::string> App::lookup_name(int id) {
187    return this->id_alloc.lookup(id);
188 }
189
190 //  _       _ _       _                         _    ____
191 // (_)_ __ (_) |_    | | __ _ _   _  ___  _   _| |_ / /\ \
192 // | | '_ \| | __|   | |/ _` | | | |/ _ \| | | | __| |  | |
193 // | | | | | | |_    | | (_| | |_| | (_) | |_| | |_| |  | |
194 // |_|_| |_|_|\__|___|_|\__,_|\__, |\___/ \__,_|\__| |  | |
195 //              |_____|       |___/                 \_\/_/
196 int App::init_layers() {
197    if (!this->controller) {
198       logerror("ivi_controller global not available");
199       return -1;
200    }
201
202    if (this->outputs.empty()) {
203       logerror("no output was set up!");
204       return -1;
205    }
206
207    auto &c = this->controller;
208
209    auto &o = this->outputs.front();
210    auto &s = c->screens.begin()->second;
211    auto &layers = c->layers;
212
213    // XXX: Write output dimensions to ivi controller...
214    c->output_size = genivi::size{uint32_t(o->width), uint32_t(o->height)};
215
216    // Clear scene
217    layers.clear();
218
219    // Clear screen
220    s->clear();
221
222    // Quick and dirty setup of layers
223    // XXX: This likely needs to be sorted by order (note, we don't (yet?)
224    // do any zorder arrangement).
225    for (auto const &i : this->layers.mapping) {
226       c->layer_create(i.layer_id, o->width, o->height);
227       auto &l = layers[i.layer_id];
228       l->set_destination_rectangle(0, 0, o->width, o->height);
229       l->set_visibility(1);
230       logdebug(
231          "Setting up layer %s (%d) for surfaces %d-%d and role match \"%s\"",
232          i.name.c_str(), i.layer_id, i.id_min, i.id_max, i.role.c_str());
233       this->layouts[l->id] = LayoutState{};
234    }
235
236    // Add layers to screen (XXX: are they sorted correctly?)
237    s->set_render_order(this->layers.layers);
238
239    this->layout_commit();
240
241    return 0;
242 }
243
244 namespace {
245
246 #ifdef WE_LIKE_NOT_TO_USE_THIS
247 // This can fix the HomeScreen...
248 void redraw_fix(App *app, std::unique_ptr<genivi::surface> &s, int x, int y,
249                 int w, int h) {
250    {  // XXX: Work around weston redraw issues
251       // trigger an update by changing the source dimensions!
252       s->set_configuration(w + 1, h);
253       s->set_source_rectangle(0, 0, w + 1, h);
254       s->set_destination_rectangle(x, y, w + 1, h);
255       app->controller->commit_changes();
256       app->display->roundtrip();
257
258       // wait some time, for the process to do its thing...
259       using namespace std::chrono_literals;
260       std::this_thread::sleep_for(100ms);
261
262       // Set a different size then what we actually want.
263       s->set_configuration(w, h);
264       s->set_source_rectangle(0, 0, w, h);
265       s->set_destination_rectangle(x, y, w, h);
266       app->controller->commit_changes();
267       app->display->roundtrip();
268    }
269 }
270 #endif
271
272 }  // namespace
273
274 void App::surface_set_layout(int surface_id, optional<int> sub_surface_id) {
275    if (!this->controller->surface_exists(surface_id)) {
276       logerror("Surface %d does not exist", surface_id);
277       return;
278    }
279
280    auto o_layer_id = this->layers.get_layer_id(surface_id);
281
282    if (!o_layer_id) {
283       logerror("Surface %d is not associated with any layer!", surface_id);
284       return;
285    }
286
287    uint32_t layer_id = *o_layer_id;
288
289    auto const &layer = this->layers.get_layer(layer_id);
290    auto rect = layer.value().rect;
291    auto &s = this->controller->surfaces[surface_id];
292
293    int x = rect.x;
294    int y = rect.y;
295    int w = rect.w;
296    int h = rect.h;
297
298    // less-than-0 values refer to MAX + 1 - $VALUE
299    // e.g. MAX is either screen width or height
300    if (w < 0) {
301       w = this->controller->output_size.w + 1 + w;
302    }
303    if (h < 0) {
304       h = this->controller->output_size.h + 1 + h;
305    }
306
307    if (sub_surface_id) {
308       if (o_layer_id != this->layers.get_layer_id(*sub_surface_id)) {
309          logerror(
310             "surface_set_layout: layers of surfaces (%d and %d) don't match!",
311             surface_id, *sub_surface_id);
312          return;
313       }
314
315       int x_off = 0;
316       int y_off = 0;
317
318       // split along major axis
319       if (w > h) {
320          w /= 2;
321          x_off = w;
322       } else {
323          h /= 2;
324          y_off = h;
325       }
326
327       auto &ss = this->controller->surfaces[*sub_surface_id];
328
329       logdebug("surface_set_layout for sub surface %u on layer %u",
330                *sub_surface_id, layer_id);
331
332       // configure surface to wxh dimensions
333       ss->set_configuration(w, h);
334       // set source reactangle, even if we should not need to set it.
335       ss->set_source_rectangle(0, 0, w, h);
336       // set destination to the display rectangle
337       ss->set_destination_rectangle(x + x_off, y + y_off, w, h);
338    }
339
340    logdebug("surface_set_layout for surface %u on layer %u", surface_id,
341             layer_id);
342
343    // configure surface to wxh dimensions
344    s->set_configuration(w, h);
345    // set source reactangle, even if we should not need to set it.
346    s->set_source_rectangle(0, 0, w, h);
347    // set destination to the display rectangle
348    s->set_destination_rectangle(x, y, w, h);
349
350    // redraw_fix(this, s, x, y, w, h);
351    // redraw_fix(this, ss, x+x_off, y+y_off, w, h);
352
353    logdebug("Surface %u now on layer %u with rect { %d, %d, %d, %d }",
354             surface_id, layer_id, x, y, w, h);
355 }
356
357 void App::layout_commit() {
358    this->controller->commit_changes();
359    this->display->flush();
360 }
361
362 char const *App::api_activate_surface(char const *drawing_name) {
363    ST();
364    auto const &surface_id = this->lookup_id(drawing_name);
365
366    if (!surface_id) {
367       return "Surface does not exist";
368    }
369
370    if (!this->controller->surface_exists(*surface_id)) {
371       return "Surface does not exist in controller!";
372    }
373
374    auto layer_id = this->layers.get_layer_id(*surface_id);
375
376    if (!layer_id) {
377       return "Surface is not on any layer!";
378    }
379
380    auto o_state = *this->layers.get_layout_state(*surface_id);
381
382    if (!o_state) {
383       return "Could not find layer for surface";
384    }
385
386    struct LayoutState &state = *o_state;
387
388    // disable layers that are above our current layer
389    for (auto const &l : this->layers.mapping) {
390       if (l.layer_id <= *layer_id) {
391          continue;
392       }
393
394       bool flush = false;
395       if (l.state.main != -1) {
396          this->deactivate(l.state.main);
397          l.state.main = -1;
398          flush = true;
399       }
400
401       if (l.state.sub != -1) {
402          this->deactivate(l.state.sub);
403          l.state.sub = -1;
404          flush = true;
405       }
406
407       if (flush) {
408          this->layout_commit();
409       }
410    }
411
412    if (state.main == *surface_id || state.sub == *surface_id) {
413       return "Surface already active";
414    }
415
416    // This should involve a policy check, but as we do not (yet) have
417    // such a thing, we will just switch to this surface.
418    // XXX: input focus missing!!1
419
420    if (state.main == -1) {
421       this->try_layout(
422          state, LayoutState{*surface_id}, [&] (LayoutState const &nl) {
423             this->surface_set_layout(*surface_id);
424             // XXX do we need to activate after enddraw?
425             this->activate(*surface_id);
426             state = nl;
427             this->layout_commit();
428             this->emit_syncdraw(drawing_name);
429             this->enqueue_flushdraw(state.main);
430          });
431    } else {
432       bool can_split = this->can_split(state, *surface_id);
433
434       if (state.sub == -1) {
435          if (can_split) {
436             this->try_layout(
437                state,
438                LayoutState{state.main, *surface_id},
439                [&] (LayoutState const &nl) {
440                   std::string main =
441                      std::move(*this->lookup_name(state.main));
442
443                   this->surface_set_layout(state.main, surface_id);
444                   this->activate(*surface_id);
445                   state = nl;
446
447                   this->layout_commit();
448                   this->emit_syncdraw(drawing_name);
449                   this->emit_syncdraw(main.c_str());
450                   this->enqueue_flushdraw(state.main);
451                   this->enqueue_flushdraw(state.sub);
452                });
453          } else {
454             this->try_layout(
455                state, LayoutState{*surface_id}, [&] (LayoutState const &nl) {
456                   this->surface_set_layout(*surface_id);
457                   this->deactivate(state.main);
458                   this->activate(*surface_id);
459                   this->deactivate(state.sub);
460                   state = nl;
461
462                   this->layout_commit();
463                   this->emit_syncdraw(drawing_name);
464                   this->enqueue_flushdraw(state.main);
465                });
466          }
467       }
468    }
469
470    // no error
471    return nullptr;
472 }
473
474 char const *App::api_deactivate_surface(char const *drawing_name) {
475    ST();
476    auto const &surface_id = this->lookup_id(drawing_name);
477
478    if (!surface_id) {
479       return "Surface does not exist";
480    }
481
482    if (*surface_id == this->layers.main_surface) {
483       return "Cannot deactivate main_surface";
484    }
485
486    auto o_state = *this->layers.get_layout_state(*surface_id);
487
488    if (!o_state) {
489       return "Could not find layer for surface";
490    }
491
492    struct LayoutState &state = *o_state;
493
494    if (state.main == -1) {
495       return "No surface active";
496    }
497
498    // XXX: check against main_surface, main_surface_name is the configuration
499    // item.
500    if (*surface_id == this->layers.main_surface) {
501       logdebug("Refusing to deactivate main_surface %d", *surface_id);
502       return nullptr;
503    }
504
505    if (state.main == *surface_id) {
506       if (state.sub != -1) {
507          this->try_layout(
508             state, LayoutState{state.sub, -1}, [&] (LayoutState const &nl) {
509                std::string sub = std::move(*this->lookup_name(state.sub));
510
511                this->deactivate(*surface_id);
512                this->surface_set_layout(state.sub);
513                state = nl;
514
515                this->layout_commit();
516                this->emit_syncdraw(sub.c_str());
517                this->enqueue_flushdraw(state.sub);
518             });
519       } else {
520          this->try_layout(state, LayoutState{-1, -1}, [&] (LayoutState const &nl) {
521             this->deactivate(*surface_id);
522             state = nl;
523          });
524       }
525    } else if (state.sub == *surface_id) {
526       this->try_layout(
527          state, LayoutState{state.main, -1}, [&] (LayoutState const &nl) {
528             std::string main = std::move(*this->lookup_name(state.main));
529
530             this->deactivate(*surface_id);
531             this->surface_set_layout(state.main);
532             state = nl;
533
534             this->layout_commit();
535             this->emit_syncdraw(main.c_str());
536             this->enqueue_flushdraw(state.main);
537          });
538    } else {
539       return "Surface is not active";
540    }
541
542    return nullptr;
543 }
544
545 void App::enqueue_flushdraw(int surface_id) {
546    this->check_flushdraw(surface_id);
547    logdebug("Enqueuing EndDraw for surface_id %d", surface_id);
548    this->pending_end_draw.push_back(surface_id);
549 }
550
551 void App::check_flushdraw(int surface_id) {
552    auto i = std::find(std::begin(this->pending_end_draw),
553                       std::end(this->pending_end_draw), surface_id);
554    if (i != std::end(this->pending_end_draw)) {
555       auto n = this->lookup_name(surface_id);
556       logerror("Application %s (%d) has pending EndDraw call(s)!",
557                n ? n->c_str() : "unknown-name", surface_id);
558       std::swap(this->pending_end_draw[std::distance(
559                    std::begin(this->pending_end_draw), i)],
560                 this->pending_end_draw.back());
561       this->pending_end_draw.resize(this->pending_end_draw.size() - 1);
562    }
563 }
564
565 char const *App::api_enddraw(char const *drawing_name) {
566    for (unsigned i = 0, iend = this->pending_end_draw.size(); i < iend; i++) {
567       auto n = this->lookup_name(this->pending_end_draw[i]);
568       if (n && *n == drawing_name) {
569          std::swap(this->pending_end_draw[i], this->pending_end_draw[iend - 1]);
570          this->pending_end_draw.resize(iend - 1);
571          // XXX: Please tell the compositor to thaw the surface...
572          this->emit_flushdraw(drawing_name);
573          return nullptr;
574       }
575    }
576    return "No EndDraw pending for surface";
577 }
578
579 void App::api_ping() { this->dispatch_pending_events(); }
580
581 //                      _          _   _____                 _
582 //  _ __  _ __ _____  _(_) ___  __| | | ____|_   _____ _ __ | |_ ___
583 // | '_ \| '__/ _ \ \/ / |/ _ \/ _` | |  _| \ \ / / _ \ '_ \| __/ __|
584 // | |_) | | | (_) >  <| |  __/ (_| | | |___ \ V /  __/ | | | |_\__ \
585 // | .__/|_|  \___/_/\_\_|\___|\__,_| |_____| \_/ \___|_| |_|\__|___/
586 // |_|
587 void App::surface_created(uint32_t surface_id) {
588    auto layer_id = this->layers.get_layer_id(surface_id);
589    if (!layer_id) {
590       logdebug("Newly created surfce %d is not associated with any layer!",
591                surface_id);
592       return;
593    }
594
595    logdebug("surface_id is %u, layer_id is %u", surface_id, *layer_id);
596
597    this->controller->layers[*layer_id]->add_surface(
598       this->controller->surfaces[surface_id].get());
599
600    // activate the main_surface right away
601    if (surface_id == static_cast<unsigned>(this->layers.main_surface)) {
602       logdebug("Activating main_surface (%d)", surface_id);
603
604       this->api_activate_surface(
605          this->lookup_name(surface_id).value_or("unknown-name").c_str());
606    }
607 }
608
609 void App::surface_removed(uint32_t surface_id) {
610    logdebug("surface_id is %u", surface_id);
611
612    // We cannot normally deactivate the main_surface, so be explicit
613    // about it:
614    if (int(surface_id) == this->layers.main_surface) {
615       this->deactivate_main_surface();
616    } else {
617       auto drawing_name = this->lookup_name(surface_id);
618       if (drawing_name) {
619          this->api_deactivate_surface(drawing_name->c_str());
620       }
621    }
622
623    this->id_alloc.remove_id(surface_id);
624    this->layers.remove_surface(surface_id);
625 }
626
627 void App::emit_activated(char const *label) {
628    this->api.send_event("activated", label);
629 }
630
631 void App::emit_deactivated(char const *label) {
632    this->api.send_event("deactivated", label);
633 }
634
635 void App::emit_syncdraw(char const *label) {
636    this->api.send_event("syncdraw", label);
637 }
638
639 void App::emit_flushdraw(char const *label) {
640    this->api.send_event("flushdraw", label);
641 }
642
643 void App::emit_visible(char const *label, bool is_visible) {
644    this->api.send_event(is_visible ? "visible" : "invisible", label);
645 }
646
647 void App::emit_invisible(char const *label) {
648    return emit_visible(label, false);
649 }
650
651 void App::emit_visible(char const *label) { return emit_visible(label, true); }
652
653 result<int> App::api_request_surface(char const *drawing_name) {
654    auto lid = this->layers.get_layer_id(std::string(drawing_name));
655    if (!lid) {
656       // XXX: to we need to put these applications on the App layer?
657       return Err<int>("Drawing name does not match any role");
658    }
659
660    auto rname = this->lookup_id(drawing_name);
661    if (!rname) {
662       // name does not exist yet, allocate surface id...
663       auto id = int(this->id_alloc.generate_id(drawing_name));
664       this->layers.add_surface(id, *lid);
665
666       // XXX: we set the main_surface[_name] here and now,
667       // not sure if we want this, but it worked so far.
668       if (!this->layers.main_surface_name.empty() &&
669           this->layers.main_surface_name == drawing_name) {
670          this->layers.main_surface = id;
671          logdebug("Set main_surface id to %u", id);
672       }
673
674       return Ok<int>(id);
675    }
676
677    // Check currently registered drawing names if it is already there.
678    return Err<int>("Surface already present");
679 }
680
681 void App::activate(int id) {
682    if (this->controller->sprops[id].visibility == 0) {
683       this->controller->surfaces[id]->set_visibility(1);
684       char const *label =
685          this->lookup_name(id).value_or("unknown-name").c_str();
686       this->emit_activated(label);
687       this->emit_visible(label);
688    }
689 }
690
691 void App::deactivate(int id) {
692    if (this->controller->sprops[id].visibility != 0) {
693       this->controller->surfaces[id]->set_visibility(0);
694       char const *label =
695          this->lookup_name(id).value_or("unknown-name").c_str();
696       this->emit_deactivated(label);
697       this->emit_invisible(label);
698    }
699 }
700
701 void App::deactivate_main_surface() {
702    this->layers.main_surface = -1;
703    this->api_deactivate_surface(this->layers.main_surface_name.c_str());
704 }
705
706 bool App::can_split(struct LayoutState const &state, int new_id) {
707    if (state.main != -1 && state.main != new_id) {
708       auto new_id_layer = this->layers.get_layer_id(new_id).value();
709       auto current_id_layer = this->layers.get_layer_id(state.main).value();
710
711       // surfaces are on separate layers, don't bother.
712       if (new_id_layer != current_id_layer) {
713          return false;
714       }
715
716       std::string const &new_id_str = this->lookup_name(new_id).value();
717       std::string const &cur_id_str = this->lookup_name(state.main).value();
718
719       auto const &layer = this->layers.get_layer(new_id_layer);
720
721       logdebug("layer info name: %s", layer->name.c_str());
722
723       if (layer->layouts.empty()) {
724          return false;
725       }
726
727       for (auto i = layer->layouts.cbegin(); i != layer->layouts.cend(); i++) {
728          logdebug("%d main_match '%s'", new_id_layer, i->main_match.c_str());
729          auto rem = std::regex(i->main_match);
730          if (std::regex_match(cur_id_str, rem)) {
731             // build the second one only if the first already matched
732             logdebug("%d sub_match '%s'", new_id_layer, i->sub_match.c_str());
733             auto res = std::regex(i->sub_match);
734             if (std::regex_match(new_id_str, res)) {
735                logdebug("layout matched!");
736                return true;
737             }
738          }
739       }
740    }
741
742    return false;
743 }
744
745 void App::try_layout(struct LayoutState &state,
746                      struct LayoutState const &new_layout,
747                      std::function<void(LayoutState const &nl)> apply) {
748    if (this->policy.layout_is_valid(new_layout)) {
749       apply(new_layout);
750    }
751 }
752
753 //                  _             _ _            _                 _
754 //   ___ ___  _ __ | |_ _ __ ___ | | | ___ _ __ | |__   ___   ___ | | _____
755 //  / __/ _ \| '_ \| __| '__/ _ \| | |/ _ \ '__|| '_ \ / _ \ / _ \| |/ / __|
756 // | (_| (_) | | | | |_| | | (_) | | |  __/ |   | | | | (_) | (_) |   <\__ \
757 //  \___\___/|_| |_|\__|_|  \___/|_|_|\___|_|___|_| |_|\___/ \___/|_|\_\___/
758 //                                         |_____|
759 void controller_hooks::surface_created(uint32_t surface_id) {
760    this->app->surface_created(surface_id);
761 }
762
763 void controller_hooks::surface_removed(uint32_t surface_id) {
764    this->app->surface_removed(surface_id);
765 }
766
767 }  // namespace wm