main: add wl_output proxy-to-id mapping in wl_output global handler
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Thu, 29 Jun 2017 14:07:05 +0000 (16:07 +0200)
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>
Tue, 8 Aug 2017 15:24:00 +0000 (17:24 +0200)
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
src/main.cpp

index 52d6b32..3c8bc0a 100644 (file)
@@ -141,14 +141,20 @@ int main(int /*argc*/, char ** /*argv*/) {
 
    struct connection c {};
 
+   d.r.add_global_handler(
+           "wl_output", [&c](wl_registry *r, uint32_t name, uint32_t v) {
+               c.outputs.emplace_back(std::make_unique<wl::output>(r, name, v));
+           });
+
    d.r.add_global_handler(
       "ivi_controller", [&c](wl_registry *r, uint32_t name, uint32_t v) {
          c.c = std::make_unique<genivi::controller>(r, name, v);
-      });
 
-   d.r.add_global_handler(
-      "wl_output", [&c](wl_registry *r, uint32_t name, uint32_t v) {
-         c.outputs.emplace_back(std::make_unique<wl::output>(r, name, v));
+         // XXX: This protocol needs the output, so lets just add our mapping here...
+         c.c->add_proxy_to_id_mapping(c.outputs.back()->proxy.get(),
+                                      wl_proxy_get_id(
+                                              reinterpret_cast<struct wl_proxy *>(
+                                                      c.outputs.back()->proxy.get())));
       });
 
    // First level objects