wayland: less cast-y, minor style fixes
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Tue, 27 Jun 2017 05:55:08 +0000 (07:55 +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

index ab8fa76..c7287b3 100644 (file)
@@ -67,7 +67,7 @@ registry::registry(struct wl_display *d)
    : wayland_proxy(d == nullptr ? nullptr : wl_display_get_registry(d)) {
    if (this->proxy != nullptr) {
       wl_registry_add_listener(this->proxy, &registry_listener, this);
-}
+   }
 }
 
 registry::~registry() {
@@ -268,57 +268,56 @@ namespace {
 void layer_visibility(void *data,
                       struct ivi_controller_layer * /*ivi_controller_layer*/,
                       int32_t visibility) {
-   static_cast<struct layer *>(data)->parent->layer_visibility(
-      static_cast<struct layer *>(data)->id, visibility);
+   auto l = static_cast<struct layer *>(data);
+   l->parent->layer_visibility(l->id, visibility);
 }
 
 void layer_opacity(void *data,
                    struct ivi_controller_layer * /*ivi_controller_layer*/,
                    wl_fixed_t opacity) {
-   static_cast<struct layer *>(data)->parent->layer_opacity(
-      static_cast<struct layer *>(data)->id,
-      float(wl_fixed_to_double(opacity)));
+   auto l = static_cast<struct layer *>(data);
+   l->parent->layer_opacity(l->id, 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) {
-   static_cast<struct layer *>(data)->parent->layer_source_rectangle(
-      static_cast<struct layer *>(data)->id, x, y, width, height);
+   auto l = static_cast<struct layer *>(data);
+   l->parent->layer_source_rectangle(l->id, 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) {
-   static_cast<struct layer *>(data)->parent->layer_destination_rectangle(
-      static_cast<struct layer *>(data)->id, x, y, width, height);
+   auto l = static_cast<struct layer *>(data);
+   l->parent->layer_destination_rectangle(l->id, x, y, width, height);
 }
 
 void layer_configuration(void *data,
                          struct ivi_controller_layer * /*ivi_controller_layer*/,
                          int32_t width, int32_t height) {
-   static_cast<struct layer *>(data)->parent->layer_configuration(
-      static_cast<struct layer *>(data)->id, width, height);
+   auto l = static_cast<struct layer *>(data);
+   l->parent->layer_configuration(l->id, width, height);
 }
 
 void layer_orientation(void *data,
                        struct ivi_controller_layer * /*ivi_controller_layer*/,
                        int32_t orientation) {
-   static_cast<struct layer *>(data)->parent->layer_orientation(
-      static_cast<struct layer *>(data)->id, orientation);
+   auto l = static_cast<struct layer *>(data);
+   l->parent->layer_orientation(l->id, orientation);
 }
 
 void layer_screen(void *data,
                   struct ivi_controller_layer * /*ivi_controller_layer*/,
                   struct wl_output *screen) {
-   static_cast<struct layer *>(data)->parent->layer_screen(
-      static_cast<struct layer *>(data)->id, screen);
+   auto l = static_cast<struct layer *>(data);
+   l->parent->layer_screen(l->id, screen);
 }
 
 void layer_destroyed(void *data,
                      struct ivi_controller_layer * /*ivi_controller_layer*/) {
-   static_cast<struct layer *>(data)->parent->layer_destroyed(
-      static_cast<struct layer *>(data)->id);
+   auto l = static_cast<struct layer *>(data);
+   l->parent->layer_destroyed(l->id);
 }
 
 constexpr struct ivi_controller_layer_listener layer_listener = {
@@ -408,58 +407,57 @@ namespace {
 void surface_visibility(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t visibility) {
-   static_cast<struct surface *>(data)->parent->surface_visibility(
-      static_cast<struct surface *>(data)->id, visibility);
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_visibility(s->id, visibility);
 }
 
 void surface_opacity(void *data,
                      struct ivi_controller_surface * /*ivi_controller_surface*/,
                      wl_fixed_t opacity) {
-   static_cast<struct surface *>(data)->parent->surface_opacity(
-      static_cast<struct surface *>(data)->id,
-      float(wl_fixed_to_double(opacity)));
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_opacity(s->id, 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) {
-   static_cast<struct surface *>(data)->parent->surface_source_rectangle(
-      static_cast<struct surface *>(data)->id, x, y, width, height);
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_source_rectangle(s->id, 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) {
-   static_cast<struct surface *>(data)->parent->surface_destination_rectangle(
-      static_cast<struct surface *>(data)->id, x, y, width, height);
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_destination_rectangle(s->id, x, y, width, height);
 }
 
 void surface_configuration(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t width, int32_t height) {
-   static_cast<struct surface *>(data)->parent->surface_configuration(
-      static_cast<struct surface *>(data)->id, width, height);
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_configuration(s->id, width, height);
 }
 
 void surface_orientation(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t orientation) {
-   static_cast<struct surface *>(data)->parent->surface_orientation(
-      static_cast<struct surface *>(data)->id, orientation);
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_orientation(s->id, orientation);
 }
 
 void surface_pixelformat(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/,
    int32_t pixelformat) {
-   static_cast<struct surface *>(data)->parent->surface_pixelformat(
-      static_cast<struct surface *>(data)->id, pixelformat);
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_pixelformat(s->id, pixelformat);
 }
 
 void surface_layer(void *data,
                    struct ivi_controller_surface * /*ivi_controller_surface*/,
                    struct ivi_controller_layer *layer) {
-   static_cast<struct surface *>(data)->parent->surface_layer(
-      static_cast<struct surface *>(data)->id, layer);
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_layer(s->id, layer);
 }
 
 void surface_stats(void *data,
@@ -467,22 +465,22 @@ void surface_stats(void *data,
                    uint32_t redraw_count, uint32_t frame_count,
                    uint32_t update_count, uint32_t pid,
                    const char *process_name) {
-   static_cast<struct surface *>(data)->parent->surface_stats(
-      static_cast<struct surface *>(data)->id, redraw_count, frame_count,
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_stats(s->id, redraw_count, frame_count,
       update_count, pid, process_name);
 }
 
 void surface_destroyed(
    void *data, struct ivi_controller_surface * /*ivi_controller_surface*/) {
-   static_cast<struct surface *>(data)->parent->surface_destroyed(
-      static_cast<struct surface *>(data)->id);
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_destroyed(s->id);
 }
 
 void surface_content(void *data,
                      struct ivi_controller_surface * /*ivi_controller_surface*/,
                      int32_t content_state) {
-   static_cast<struct surface *>(data)->parent->surface_content(
-      static_cast<struct surface *>(data)->id, content_state);
+   auto s = static_cast<struct surface *>(data);
+   s->parent->surface_content(s->id, content_state);
 }
 
 constexpr struct ivi_controller_surface_listener surface_listener = {