From d166f5ef7643ad2a2ec92beb5fbf1e0eae79db13 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 22 Aug 2022 14:10:54 -0700 Subject: [PATCH] Fixed uninitialized variable warning --- src/video/wayland/SDL_waylandevents.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 94374ea72..5c3ac204a 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -734,6 +734,9 @@ pointer_handle_frame(void *data, struct wl_pointer *pointer) case AXIS_EVENT_VALUE120: x = input->pointer_curr_axis_info.x / 120.0f; break; + default: + x = 0.0f; + break; } switch(input->pointer_curr_axis_info.y_axis_type) { @@ -746,15 +749,17 @@ pointer_handle_frame(void *data, struct wl_pointer *pointer) case AXIS_EVENT_VALUE120: y = input->pointer_curr_axis_info.y / 120.0f; break; + default: + y = 0.0f; + break; } /* clear pointer_curr_axis_info for next frame */ SDL_memset(&input->pointer_curr_axis_info, 0, sizeof input->pointer_curr_axis_info); - if(x == 0.0f && y == 0.0f) - return; - else + if (x != 0.0f || y != 0.0f) { SDL_SendMouseWheel(window->sdlwindow, 0, x, y, SDL_MOUSEWHEEL_NORMAL); + } } static void