app: wire up controller_hooks
[staging/windowmanager.git] / src / app.cpp
index 29f84f7..e28d8d0 100644 (file)
@@ -84,8 +84,14 @@ struct result<surface_id_to_layer_map>
 
 }  // namespace
 
+//       _                    _                  _                 _
+//   ___| | __ _ ___ ___     / \   _ __  _ __   (_)_ __ ___  _ __ | |
+//  / __| |/ _` / __/ __|   / _ \ | '_ \| '_ \  | | '_ ` _ \| '_ \| |
+// | (__| | (_| \__ \__ \  / ___ \| |_) | |_) | | | | | | | | |_) | |
+//  \___|_|\__,_|___/___/ /_/   \_\ .__/| .__/  |_|_| |_| |_| .__/|_|
+//                                |_|   |_|                 |_|
 App::App(wl::display *d)
-   : api{this}, display{d}, controller{} {
+   : api{this}, chooks{this}, display{d}, controller{} {
    // layouts(load_layout("../layout.json").unwrap()) {
    assert(g_app == nullptr);
    g_app = this;
@@ -119,6 +125,9 @@ int App::init() {
       "ivi_controller", [this](wl_registry *r, uint32_t name, uint32_t v) {
          this->controller = std::make_unique<genivi::controller>(r, name, v);
 
+         // Init controller hooks
+         this->controller->chooks = &this->chooks;
+
          // XXX: This protocol needs the output, so lets just add our mapping
          // here...
          this->controller->add_proxy_to_id_mapping(
@@ -208,6 +217,20 @@ int App::init_layout() {
    return 0;
 }
 
+void App::surface_created(uint32_t surface_id) {
+   DB("surface_id is " << surface_id);
+}
+
+void App::surface_removed(uint32_t surface_id) {
+   DB("surface_id is " << surface_id);
+}
+
+//  _     _           _ _                            _   _                 _
+// | |__ (_)_ __   __| (_)_ __   __ _     __ _ _ __ (_) (_)_ __ ___  _ __ | |
+// | '_ \| | '_ \ / _` | | '_ \ / _` |   / _` | '_ \| | | | '_ ` _ \| '_ \| |
+// | |_) | | | | | (_| | | | | | (_| |  | (_| | |_) | | | | | | | | | |_) | |
+// |_.__/|_|_| |_|\__,_|_|_| |_|\__, |___\__,_| .__/|_| |_|_| |_| |_| .__/|_|
+//                              |___/_____|   |_|                   |_|
 binding_api::result_type binding_api::register_surface(uint32_t appid,
                                                        uint32_t surfid) {
    logdebug("%s appid %u surfid %u", __func__, appid, surfid);
@@ -241,4 +264,18 @@ binding_api::result_type binding_api::debug_status() {
    return Ok(jr);
 }
 
-}  // namespace wm
\ No newline at end of file
+//                  _             _ _            _                 _
+//   ___ ___  _ __ | |_ _ __ ___ | | | ___ _ __ | |__   ___   ___ | | _____
+//  / __/ _ \| '_ \| __| '__/ _ \| | |/ _ \ '__|| '_ \ / _ \ / _ \| |/ / __|
+// | (_| (_) | | | | |_| | | (_) | | |  __/ |   | | | | (_) | (_) |   <\__ \
+//  \___\___/|_| |_|\__|_|  \___/|_|_|\___|_|___|_| |_|\___/ \___/|_|\_\___/
+//                                         |_____|
+void controller_hooks::surface_created(uint32_t surface_id) {
+   this->app->surface_created(surface_id);
+}
+
+void controller_hooks::surface_removed(uint32_t surface_id) {
+   this->app->surface_removed(surface_id);
+}
+
+}  // namespace wm