From 6581d53bbbc6b78ce9efa8d68ae46171abd3de17 Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Tue, 27 Jun 2017 07:55:08 +0200 Subject: [PATCH] wayland: less cast-y, minor style fixes Signed-off-by: Marcus Fritzsch --- src/wayland.cpp | 80 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/src/wayland.cpp b/src/wayland.cpp index ab8fa76..c7287b3 100644 --- a/src/wayland.cpp +++ b/src/wayland.cpp @@ -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, ®istry_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(data)->parent->layer_visibility( - static_cast(data)->id, visibility); + auto l = static_cast(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(data)->parent->layer_opacity( - static_cast(data)->id, - float(wl_fixed_to_double(opacity))); + auto l = static_cast(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(data)->parent->layer_source_rectangle( - static_cast(data)->id, x, y, width, height); + auto l = static_cast(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(data)->parent->layer_destination_rectangle( - static_cast(data)->id, x, y, width, height); + auto l = static_cast(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(data)->parent->layer_configuration( - static_cast(data)->id, width, height); + auto l = static_cast(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(data)->parent->layer_orientation( - static_cast(data)->id, orientation); + auto l = static_cast(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(data)->parent->layer_screen( - static_cast(data)->id, screen); + auto l = static_cast(data); + l->parent->layer_screen(l->id, screen); } void layer_destroyed(void *data, struct ivi_controller_layer * /*ivi_controller_layer*/) { - static_cast(data)->parent->layer_destroyed( - static_cast(data)->id); + auto l = static_cast(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(data)->parent->surface_visibility( - static_cast(data)->id, visibility); + auto s = static_cast(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(data)->parent->surface_opacity( - static_cast(data)->id, - float(wl_fixed_to_double(opacity))); + auto s = static_cast(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(data)->parent->surface_source_rectangle( - static_cast(data)->id, x, y, width, height); + auto s = static_cast(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(data)->parent->surface_destination_rectangle( - static_cast(data)->id, x, y, width, height); + auto s = static_cast(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(data)->parent->surface_configuration( - static_cast(data)->id, width, height); + auto s = static_cast(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(data)->parent->surface_orientation( - static_cast(data)->id, orientation); + auto s = static_cast(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(data)->parent->surface_pixelformat( - static_cast(data)->id, pixelformat); + auto s = static_cast(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(data)->parent->surface_layer( - static_cast(data)->id, layer); + auto s = static_cast(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(data)->parent->surface_stats( - static_cast(data)->id, redraw_count, frame_count, + auto s = static_cast(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(data)->parent->surface_destroyed( - static_cast(data)->id); + auto s = static_cast(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(data)->parent->surface_content( - static_cast(data)->id, content_state); + auto s = static_cast(data); + s->parent->surface_content(s->id, content_state); } constexpr struct ivi_controller_surface_listener surface_listener = { -- 2.16.6