From b473d30f1992b89b627f47fdc9d2083d6520db39 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Wed, 8 Apr 2015 22:15:25 +0200 Subject: [PATCH 1/7] Android: Fixed not resetting mouse pointer state if hint was changed at runtime. --- src/video/android/SDL_androidtouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c index 3b406c96e5d16..1b00db2872457 100644 --- a/src/video/android/SDL_androidtouch.c +++ b/src/video/android/SDL_androidtouch.c @@ -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); From 458b94da5f474c3bfa50a496c0fa8c54d17cca9b Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Wed, 8 Apr 2015 22:18:10 +0200 Subject: [PATCH 2/7] Android: Fixed creating mouse coordinates which are not needed if hint is set. --- src/video/android/SDL_androidtouch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c index 1b00db2872457..5bb17c8c00713 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); } From 049ef9a35b4757fba35480b4152177f7f15eb170 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Wed, 8 Apr 2015 22:24:33 +0200 Subject: [PATCH 3/7] Android: Fixed calling a getter method twice. --- android-project/src/org/libsdl/app/SDLActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android-project/src/org/libsdl/app/SDLActivity.java b/android-project/src/org/libsdl/app/SDLActivity.java index 6c82b76fcc768..3c154da951891 100644 --- a/android-project/src/org/libsdl/app/SDLActivity.java +++ b/android-project/src/org/libsdl/app/SDLActivity.java @@ -1536,7 +1536,7 @@ public boolean onGenericMotion(View v, MotionEvent event) { 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); From 8a573844c9695c66fac27a853c4b198e12c92481 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Thu, 9 Apr 2015 21:11:43 +0200 Subject: [PATCH 4/7] Wayland: Fixed accessing not fully initialized window if no memory available. The CreateWindow() implementation returned 0 on no more memory instead of -1. --- src/video/wayland/SDL_waylandwindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index b66508f3f2c45..d6d83aa2b7330 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; From dc33fb942d1af8c3da07f67d97b9a03e2e3ea38d Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Thu, 9 Apr 2015 21:13:20 +0200 Subject: [PATCH 5/7] Wayland: Fixed accessing not fully initialized subsystem if errors happened. The VideoInit() implementation returned 0 on errors instead of -1. --- src/video/wayland/SDL_waylandvideo.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index e91374b63d819..2e74a086910a4 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(); From f87963488b6f18516d8d8ff6fe3a291ed5e68e4a Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Thu, 9 Apr 2015 21:13:41 +0200 Subject: [PATCH 6/7] Wayland: Fixed not freeing memory if initialization failed. --- src/video/wayland/SDL_waylandvideo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 2e74a086910a4..fd92026e92e22 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -284,11 +284,13 @@ Wayland_VideoInit(_THIS) data->display = WAYLAND_wl_display_connect(NULL); if (data->display == NULL) { + SDL_free(data); return SDL_SetError("Failed to connect to a Wayland display"); } data->registry = wl_display_get_registry(data->display); if (data->registry == NULL) { + SDL_free(data); return SDL_SetError("Failed to get the Wayland registry"); } @@ -302,6 +304,7 @@ Wayland_VideoInit(_THIS) data->xkb_context = WAYLAND_xkb_context_new(0); if (!data->xkb_context) { + SDL_free(data); return SDL_SetError("Failed to create XKB context"); } From 67549d3320a6ac6ffc103dddc19ae379b9877170 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Thu, 9 Apr 2015 22:14:05 +0200 Subject: [PATCH 7/7] Backed out changeset 064a1998a957 --- src/video/wayland/SDL_waylandvideo.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index fd92026e92e22..2e74a086910a4 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -284,13 +284,11 @@ Wayland_VideoInit(_THIS) data->display = WAYLAND_wl_display_connect(NULL); if (data->display == NULL) { - SDL_free(data); return SDL_SetError("Failed to connect to a Wayland display"); } data->registry = wl_display_get_registry(data->display); if (data->registry == NULL) { - SDL_free(data); return SDL_SetError("Failed to get the Wayland registry"); } @@ -304,7 +302,6 @@ Wayland_VideoInit(_THIS) data->xkb_context = WAYLAND_xkb_context_new(0); if (!data->xkb_context) { - SDL_free(data); return SDL_SetError("Failed to create XKB context"); }