diff --git a/android-project/src/org/libsdl/app/SDLActivity.java b/android-project/src/org/libsdl/app/SDLActivity.java index 6c82b76fc..3c154da95 100644 --- a/android-project/src/org/libsdl/app/SDLActivity.java +++ b/android-project/src/org/libsdl/app/SDLActivity.java @@ -1536,7 +1536,7 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener { case InputDevice.SOURCE_MOUSE: action = event.getActionMasked(); - switch(event.getActionMasked()) { + switch (action) { case MotionEvent.ACTION_SCROLL: x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0); y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0); diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c index 3b406c96e..5bb17c8c0 100644 --- a/src/video/android/SDL_androidtouch.c +++ b/src/video/android/SDL_androidtouch.c @@ -108,8 +108,8 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio switch (action) { case ACTION_DOWN: /* Primary pointer down */ - Android_GetWindowCoordinates(x, y, &window_x, &window_y); if (!separate_mouse_and_touch) { + Android_GetWindowCoordinates(x, y, &window_x, &window_y); /* send moved event */ SDL_SendMouseMotion(Android_Window, SDL_TOUCH_MOUSEID, 0, window_x, window_y); /* send mouse down event */ @@ -123,8 +123,8 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio case ACTION_MOVE: if (!pointerFingerID) { - Android_GetWindowCoordinates(x, y, &window_x, &window_y); if (!separate_mouse_and_touch) { + Android_GetWindowCoordinates(x, y, &window_x, &window_y); /* send moved event */ SDL_SendMouseMotion(Android_Window, SDL_TOUCH_MOUSEID, 0, window_x, window_y); } @@ -136,9 +136,9 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio /* Primary pointer up */ if (!separate_mouse_and_touch) { /* send mouse up */ - pointerFingerID = (SDL_FingerID) 0; SDL_SendMouseButton(Android_Window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); } + pointerFingerID = (SDL_FingerID) 0; case ACTION_POINTER_UP: /* Non primary pointer up */ SDL_SendTouch(touchDeviceId, fingerId, SDL_FALSE, x, y, p); diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index e91374b63..2e74a0869 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -277,21 +277,19 @@ Wayland_VideoInit(_THIS) { SDL_VideoData *data = SDL_malloc(sizeof *data); if (data == NULL) - return 0; + return SDL_OutOfMemory(); memset(data, 0, sizeof *data); _this->driverdata = data; data->display = WAYLAND_wl_display_connect(NULL); if (data->display == NULL) { - SDL_SetError("Failed to connect to a Wayland display"); - return 0; + return SDL_SetError("Failed to connect to a Wayland display"); } data->registry = wl_display_get_registry(data->display); if (data->registry == NULL) { - SDL_SetError("Failed to get the Wayland registry"); - return 0; + return SDL_SetError("Failed to get the Wayland registry"); } wl_registry_add_listener(data->registry, ®istry_listener, data); @@ -304,8 +302,7 @@ Wayland_VideoInit(_THIS) data->xkb_context = WAYLAND_xkb_context_new(0); if (!data->xkb_context) { - SDL_SetError("Failed to create XKB context"); - return 0; + return SDL_SetError("Failed to create XKB context"); } Wayland_InitMouse(); diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index b66508f3f..d6d83aa2b 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -147,7 +147,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) data = calloc(1, sizeof *data); if (data == NULL) - return 0; + return SDL_OutOfMemory(); c = _this->driverdata; window->driverdata = data;