wayland: genivi object events are called with their respective object
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Thu, 29 Jun 2017 12:27:57 +0000 (14:27 +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/wayland.cpp
src/wayland.hpp

index 800c8da..3162d4e 100644 (file)
@@ -262,55 +262,55 @@ void layer_visibility(void *data,
                       struct ivi_controller_layer * /*ivi_controller_layer*/,
                       int32_t visibility) {
    auto l = static_cast<struct layer *>(data);
-   l->parent->layer_visibility(l->id, visibility);
+   l->parent->layer_visibility(l, visibility);
 }
 
 void layer_opacity(void *data,
                    struct ivi_controller_layer * /*ivi_controller_layer*/,
                    wl_fixed_t opacity) {
    auto l = static_cast<struct layer *>(data);
-   l->parent->layer_opacity(l->id, float(wl_fixed_to_double(opacity)));
+   l->parent->layer_opacity(l, float(wl_fixed_to_double(opacity)));
 }
 
 void layer_source_rectangle(
    void *data, struct ivi_controller_layer * /*ivi_controller_layer*/,
    int32_t x, int32_t y, int32_t width, int32_t height) {
    auto l = static_cast<struct layer *>(data);
-   l->parent->layer_source_rectangle(l->id, x, y, width, height);
+   l->parent->layer_source_rectangle(l, x, y, width, height);
 }
 
 void layer_destination_rectangle(
    void *data, struct ivi_controller_layer * /*ivi_controller_layer*/,
    int32_t x, int32_t y, int32_t width, int32_t height) {
    auto l = static_cast<struct layer *>(data);
-   l->parent->layer_destination_rectangle(l->id, x, y, width, height);
+   l->parent->layer_destination_rectangle(l, x, y, width, height);
 }
 
 void layer_configuration(void *data,
                          struct ivi_controller_layer * /*ivi_controller_layer*/,
                          int32_t width, int32_t height) {
    auto l = static_cast<struct layer *>(data);
-   l->parent->layer_configuration(l->id, width, height);
+   l->parent->layer_configuration(l, width, height);
 }
 
 void layer_orientation(void *data,
                        struct ivi_controller_layer * /*ivi_controller_layer*/,
                        int32_t orientation) {
    auto l = static_cast<struct layer *>(data);
-   l->parent->layer_orientation(l->id, orientation);
+   l->parent->layer_orientation(l, orientation);
 }
 
 void layer_screen(void *data,
                   struct ivi_controller_layer * /*ivi_controller_layer*/,
                   struct wl_output *screen) {
    auto l = static_cast<struct layer *>(data);
-   l->parent->layer_screen(l->id, screen);
+   l->parent->layer_screen(l, screen);
 }
 
 void layer_destroyed(void *data,
                      struct ivi_controller_layer * /*ivi_controller_layer*/) {
    auto l = static_cast<struct layer *>(data);
-   l->parent->layer_destroyed(l->id);
+   l->parent->layer_destroyed(l);
 }
 
 constexpr struct ivi_controller_layer_listener layer_listener = {
@@ -393,52 +393,54 @@ void layer::set_render_order(std::vector<uint32_t> const &ro) {
    ivi_controller_layer_set_render_order(this->proxy.get(), &wlro);
 }
 
-void controller::layer_visibility(uint32_t id, int32_t visibility) {
+void controller::layer_visibility(struct layer *l, int32_t visibility) {
    logdebug("genivi::layer %s @ %p v %i", __func__, this->proxy.get(),
             visibility);
-   this->layers[id]->visibility = visibility;
+   l->visibility = visibility;
 }
 
-void controller::layer_opacity(uint32_t id, float opacity) {
+void controller::layer_opacity(struct layer *l, float opacity) {
    logdebug("genivi::layer %s @ %p o %f", __func__, this->proxy.get(), opacity);
-   this->layers[id]->opacity = opacity;
+   l->opacity = opacity;
 }
 
-void controller::layer_source_rectangle(uint32_t id, int32_t x, int32_t y,
+void controller::layer_source_rectangle(struct layer *l, int32_t x, int32_t y,
                                         int32_t width, int32_t height) {
    logdebug("genivi::layer %s @ %p x %i y %i w %i h %i", __func__,
             this->proxy.get(), x, y, width, height);
-   this->layers[id]->src_rect = rect{uint32_t(width), uint32_t(height), x, y};
+   l->src_rect = rect{uint32_t(width), uint32_t(height), x, y};
 }
 
-void controller::layer_destination_rectangle(uint32_t id, int32_t x, int32_t y,
-                                             int32_t width, int32_t height) {
+void controller::layer_destination_rectangle(struct layer *l, int32_t x,
+                                             int32_t y, int32_t width,
+                                             int32_t height) {
    logdebug("genivi::layer %s @ %p x %i y %i w %i h %i", __func__,
             this->proxy.get(), x, y, width, height);
-   this->layers[id]->dst_rect = rect{uint32_t(width), uint32_t(height), x, y};
+   l->dst_rect = rect{uint32_t(width), uint32_t(height), x, y};
 }
 
-void controller::layer_configuration(uint32_t id, int32_t width,
+void controller::layer_configuration(struct layer *l, int32_t width,
                                      int32_t height) {
    logdebug("genivi::layer %s @ %p w %i h %i", __func__, this->proxy.get(),
             width, height);
-   this->layers[id]->size = size{uint32_t(width), uint32_t(height)};
+   l->size = size{uint32_t(width), uint32_t(height)};
 }
 
-void controller::layer_orientation(uint32_t id, int32_t orientation) {
+void controller::layer_orientation(struct layer *l, int32_t orientation) {
    logdebug("genivi::layer %s @ %p o %i", __func__, this->proxy.get(),
             orientation);
-   this->layers[id]->orientation = orientation;
+   l->orientation = orientation;
 }
 
-void controller::layer_screen(uint32_t /*id*/, struct wl_output *screen) {
+void controller::layer_screen(struct layer *l, struct wl_output *screen) {
    logdebug("genivi::layer %s @ %p s %p", __func__, this->proxy.get(), screen);
+
 }
 
-void controller::layer_destroyed(uint32_t id) {
+void controller::layer_destroyed(struct layer *l) {
    logdebug("genivi::layer %s @ %p", __func__, this->proxy.get());
    add_task("remove layer",
-            [id](struct controller *c) { c->layers.erase(id); });
+            [l](struct controller *c) { c->layers.erase(l->id); });
 }
 
 //                  __
@@ -453,56 +455,56 @@ void surface_visibility(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t visibility) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_visibility(s->id, visibility);
+   s->parent->surface_visibility(s, visibility);
 }
 
 void surface_opacity(void *data,
                      struct ivi_controller_surface * /*ivi_controller_surface*/,
                      wl_fixed_t opacity) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_opacity(s->id, float(wl_fixed_to_double(opacity)));
+   s->parent->surface_opacity(s, float(wl_fixed_to_double(opacity)));
 }
 
 void surface_source_rectangle(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t x, int32_t y, int32_t width, int32_t height) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_source_rectangle(s->id, x, y, width, height);
+   s->parent->surface_source_rectangle(s, x, y, width, height);
 }
 
 void surface_destination_rectangle(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t x, int32_t y, int32_t width, int32_t height) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_destination_rectangle(s->id, x, y, width, height);
+   s->parent->surface_destination_rectangle(s, x, y, width, height);
 }
 
 void surface_configuration(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t width, int32_t height) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_configuration(s->id, width, height);
+   s->parent->surface_configuration(s, width, height);
 }
 
 void surface_orientation(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t orientation) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_orientation(s->id, orientation);
+   s->parent->surface_orientation(s, orientation);
 }
 
 void surface_pixelformat(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t pixelformat) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_pixelformat(s->id, pixelformat);
+   s->parent->surface_pixelformat(s, pixelformat);
 }
 
 void surface_layer(void *data,
                    struct ivi_controller_surface * /*ivi_controller_surface*/,
                    struct ivi_controller_layer *layer) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_layer(s->id, layer);
+   s->parent->surface_layer(s, layer);
 }
 
 void surface_stats(void *data,
@@ -511,21 +513,21 @@ void surface_stats(void *data,
                    uint32_t update_count, uint32_t pid,
                    const char *process_name) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_stats(s->id, redraw_count, frame_count, update_count, pid,
+   s->parent->surface_stats(s, redraw_count, frame_count, update_count, pid,
                             process_name);
 }
 
 void surface_destroyed(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_destroyed(s->id);
+   s->parent->surface_destroyed(s);
 }
 
 void surface_content(void *data,
                      struct ivi_controller_surface * /*ivi_controller_surface*/,
                      int32_t content_state) {
    auto s = static_cast<struct surface *>(data);
-   s->parent->surface_content(s->id, content_state);
+   s->parent->surface_content(s, content_state);
 }
 
 constexpr struct ivi_controller_surface_listener surface_listener = {
@@ -602,58 +604,59 @@ void surface::destroy(int32_t destroy_scene_object) {
    ivi_controller_surface_destroy(this->proxy.get(), destroy_scene_object);
 }
 
-void controller::surface_visibility(uint32_t id, int32_t visibility) {
+void controller::surface_visibility(struct surface *s, int32_t visibility) {
    logdebug("genivi::surface %s @ %p v %i", __func__, this->proxy.get(),
             visibility);
-   this->surfaces[id]->visibility = visibility;
+   s->visibility = visibility;
 }
 
-void controller::surface_opacity(uint32_t id, float opacity) {
+void controller::surface_opacity(struct surface *s, float opacity) {
    logdebug("genivi::surface %s @ %p o %f", __func__, this->proxy.get(),
             opacity);
-   this->surfaces[id]->opacity = opacity;
+   s->opacity = opacity;
 }
 
-void controller::surface_source_rectangle(uint32_t id, int32_t x, int32_t y,
-                                          int32_t width, int32_t height) {
+void controller::surface_source_rectangle(struct surface *s, int32_t x,
+                                          int32_t y, int32_t width,
+                                          int32_t height) {
    logdebug("genivi::surface %s @ %p x %i y %i w %i h %i", __func__,
             this->proxy.get(), x, y, width, height);
-   this->surfaces[id]->src_rect = rect{uint32_t(width), uint32_t(height), x, y};
+   s->src_rect = rect{uint32_t(width), uint32_t(height), x, y};
 }
 
-void controller::surface_destination_rectangle(uint32_t id, int32_t x,
+void controller::surface_destination_rectangle(struct surface *s, int32_t x,
                                                int32_t y, int32_t width,
                                                int32_t height) {
    logdebug("genivi::surface %s @ %p x %i y %i w %i h %i", __func__,
             this->proxy.get(), x, y, width, height);
-   this->surfaces[id]->dst_rect = rect{uint32_t(width), uint32_t(height), x, y};
+   s->dst_rect = rect{uint32_t(width), uint32_t(height), x, y};
 }
 
-void controller::surface_configuration(uint32_t id, int32_t width,
+void controller::surface_configuration(struct surface *s, int32_t width,
                                        int32_t height) {
    logdebug("genivi::surface %s @ %p w %i h %i", __func__, this->proxy.get(),
             width, height);
-   this->surfaces[id]->size = size{uint32_t(width), uint32_t(height)};
+   s->size = size{uint32_t(width), uint32_t(height)};
 }
 
-void controller::surface_orientation(uint32_t id, int32_t orientation) {
+void controller::surface_orientation(struct surface *s, int32_t orientation) {
    logdebug("genivi::surface %s @ %p o %i", __func__, this->proxy.get(),
             orientation);
-   this->surfaces[id]->orientation = orientation;
+   s->orientation = orientation;
 }
 
-void controller::surface_pixelformat(uint32_t /*id*/, int32_t pixelformat) {
+void controller::surface_pixelformat(struct surface *s, int32_t pixelformat) {
    logdebug("genivi::surface %s @ %p f %i", __func__, this->proxy.get(),
             pixelformat);
 }
 
-void controller::surface_layer(uint32_t /*id*/,
+void controller::surface_layer(struct surface *s,
                                struct ivi_controller_layer *layer) {
    logdebug("genivi::surface %s @ %p l %u @ %p", __func__, this->proxy.get(),
             this->layer_proxy_to_id[uintptr_t(layer)], layer);
 }
 
-void controller::surface_stats(uint32_t /*id*/, uint32_t redraw_count,
+void controller::surface_stats(struct surface *s, uint32_t redraw_count,
                                uint32_t frame_count, uint32_t update_count,
                                uint32_t pid, const char *process_name) {
    logdebug("genivi::surface %s @ %p r %u f %u u %u pid %u p %s", __func__,
@@ -661,17 +664,17 @@ void controller::surface_stats(uint32_t /*id*/, uint32_t redraw_count,
             process_name);
 }
 
-void controller::surface_destroyed(uint32_t id) {
+void controller::surface_destroyed(struct surface *s) {
    logdebug("genivi::surface %s @ %p", __func__, this->proxy.get());
-   this->surfaces.erase(id);
+   this->surfaces.erase(s->id);
 }
 
-void controller::surface_content(uint32_t id, int32_t content_state) {
+void controller::surface_content(struct surface *s, int32_t content_state) {
    logdebug("genivi::surface %s @ %p s %i", __func__, this->proxy.get(),
             content_state);
    if (content_state == IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_REMOVED) {
       add_task("remove surface",
-               [id](struct controller *c) { c->surfaces.erase(id); });
+               [s](struct controller *c) { c->surfaces.erase(s->id); });
    }
 }
 
index 5917abf..973e063 100644 (file)
@@ -277,33 +277,33 @@ struct controller : public wayland_proxy<struct ivi_controller> {
                          int32_t error_code, char const *error_text);
 
    // surface
-   void surface_visibility(uint32_t id, int32_t visibility);
-   void surface_opacity(uint32_t id, float opacity);
-   void surface_source_rectangle(uint32_t id, int32_t x, int32_t y,
+   void surface_visibility(struct surface *s, int32_t visibility);
+   void surface_opacity(struct surface *s, float opacity);
+   void surface_source_rectangle(struct surface *s, int32_t x, int32_t y,
                                  int32_t width, int32_t height);
-   void surface_destination_rectangle(uint32_t id, int32_t x, int32_t y,
+   void surface_destination_rectangle(struct surface *s, int32_t x, int32_t y,
                                       int32_t width, int32_t height);
-   void surface_configuration(uint32_t id, int32_t width, int32_t height);
-   void surface_orientation(uint32_t id, int32_t orientation);
-   void surface_pixelformat(uint32_t id, int32_t pixelformat);
-   void surface_layer(uint32_t id, struct ivi_controller_layer *layer);
-   void surface_stats(uint32_t id, uint32_t redraw_count, uint32_t frame_count,
+   void surface_configuration(struct surface *s, int32_t width, int32_t height);
+   void surface_orientation(struct surface *s, int32_t orientation);
+   void surface_pixelformat(struct surface *s, int32_t pixelformat);
+   void surface_layer(struct surface *s, struct ivi_controller_layer *layer);
+   void surface_stats(struct surface *s, uint32_t redraw_count, uint32_t frame_count,
                       uint32_t update_count, uint32_t pid,
                       const char *process_name);
-   void surface_destroyed(uint32_t id);
-   void surface_content(uint32_t id, int32_t content_state);
+   void surface_destroyed(struct surface *s);
+   void surface_content(struct surface *s, int32_t content_state);
 
    // layer
-   void layer_visibility(uint32_t id, int32_t visibility);
-   void layer_opacity(uint32_t id, float opacity);
-   void layer_source_rectangle(uint32_t id, int32_t x, int32_t y, int32_t width,
+   void layer_visibility(struct layer *l, int32_t visibility);
+   void layer_opacity(struct layer *l, float opacity);
+   void layer_source_rectangle(struct layer *l, int32_t x, int32_t y, int32_t width,
                                int32_t height);
-   void layer_destination_rectangle(uint32_t id, int32_t x, int32_t y,
+   void layer_destination_rectangle(struct layer *l, int32_t x, int32_t y,
                                     int32_t width, int32_t height);
-   void layer_configuration(uint32_t id, int32_t width, int32_t height);
-   void layer_orientation(uint32_t id, int32_t orientation);
-   void layer_screen(uint32_t id, struct wl_output *screen);
-   void layer_destroyed(uint32_t id);
+   void layer_configuration(struct layer *l, int32_t width, int32_t height);
+   void layer_orientation(struct layer *l, int32_t orientation);
+   void layer_screen(struct layer *l, struct wl_output *screen);
+   void layer_destroyed(struct layer *l);
 };
 }