diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-07-28 12:33:56 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-08-08 17:24:00 +0200 |
commit | f690f1bb1a9736ec13cbe1dad721b0bbc1c3af67 (patch) | |
tree | a2356d54b2dd140875ea8d92ee3ed5f69fab9f46 | |
parent | dd128e02635393974aa490388f9d847885921479 (diff) |
app: wire up controller_hooks
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
-rw-r--r-- | src/app.cpp | 41 | ||||
-rw-r--r-- | src/app.hpp | 5 | ||||
-rw-r--r-- | src/wayland.hpp | 4 |
3 files changed, 47 insertions, 3 deletions
diff --git a/src/app.cpp b/src/app.cpp index 29f84f7..e28d8d0 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -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 diff --git a/src/app.hpp b/src/app.hpp index 82acfda..0e38bc0 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -12,6 +12,7 @@ #include "result.hpp" #include "wayland.hpp" #include "layout.hpp" +#include "controller_hooks.hpp" namespace wl { struct display; @@ -25,6 +26,7 @@ namespace wm { struct App { struct binding_api api; + struct controller_hooks chooks; // This is the one thing, we do not own. struct wl::display *display; @@ -43,6 +45,9 @@ struct App { int init(); int dispatch_events(); int init_layout(); + + void surface_created(uint32_t surface_id); + void surface_removed(uint32_t surface_id); }; } // namespace wm diff --git a/src/wayland.hpp b/src/wayland.hpp index e2a1259..af36142 100644 --- a/src/wayland.hpp +++ b/src/wayland.hpp @@ -2,7 +2,7 @@ #define WM_WAYLAND_HPP #include "ivi-controller-client-protocol.h" - +#include "controller_hooks.hpp" #include "util.hpp" #include <functional> @@ -263,6 +263,8 @@ struct controller : public wayland_proxy<struct ivi_controller> { size output_size; + wm::controller_hooks *chooks; + void add_proxy_to_id_mapping(struct ivi_controller_surface *p, uint32_t id); void remove_proxy_to_id_mapping(struct ivi_controller_surface *p); void add_proxy_to_id_mapping(struct ivi_controller_layer *p, uint32_t id); |