From: Marcus Fritzsch Date: Mon, 24 Jul 2017 09:42:54 +0000 (+0200) Subject: wayland: add display::add_global_handler which forwards to registry X-Git-Tag: 4.99.1~239 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=f0e3d51ee7adb54cd31f0625a71c86995cf0760f;p=staging%2Fwindowmanager.git wayland: add display::add_global_handler which forwards to registry Signed-off-by: Marcus Fritzsch --- diff --git a/src/app.cpp b/src/app.cpp index 29b28b5..ed17107 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -31,21 +31,21 @@ int App::init() { return -1; } - this->display->r.add_global_handler( - "wl_output", [](wl_registry *r, uint32_t name, uint32_t v) { - g_app->outputs.emplace_back(std::make_unique(r, name, v)); + this->display->add_global_handler( + "wl_output", [this](wl_registry *r, uint32_t name, uint32_t v) { + this->outputs.emplace_back(std::make_unique(r, name, v)); }); - this->display->r.add_global_handler( - "ivi_controller", [](wl_registry *r, uint32_t name, uint32_t v) { - g_app->controller = std::make_unique(r, name, v); + this->display->add_global_handler( + "ivi_controller", [this](wl_registry *r, uint32_t name, uint32_t v) { + this->controller = std::make_unique(r, name, v); // XXX: This protocol needs the output, so lets just add our mapping // here... - g_app->controller->add_proxy_to_id_mapping( - g_app->outputs.back()->proxy.get(), + this->controller->add_proxy_to_id_mapping( + this->outputs.back()->proxy.get(), wl_proxy_get_id(reinterpret_cast( - g_app->outputs.back()->proxy.get()))); + this->outputs.back()->proxy.get()))); }); // First level objects diff --git a/src/wayland.hpp b/src/wayland.hpp index 3b81e15..e2a1259 100644 --- a/src/wayland.hpp +++ b/src/wayland.hpp @@ -76,6 +76,11 @@ struct display { void flush(); int get_fd() const; int get_error(); + + // Lets just proxy this for the registry + inline void add_global_handler(char const *iface, registry::binder bind) { + this->r.add_global_handler(iface, bind); + } }; // _ _