summaryrefslogtreecommitdiff
path: root/src/video/android/SDL_androidmouse.c
diff options
context:
space:
mode:
authorSylvain Becker <sylvain.becker@gmail.com>2019-01-03 13:14:16 +0100
committerSylvain Becker <sylvain.becker@gmail.com>2019-01-03 13:14:16 +0100
commit0b0ee27be44bef48d2f2b19019aa541da677874a (patch)
treeffee0e76aafa4088144ca1b5de834b09606a08fe /src/video/android/SDL_androidmouse.c
parent510f8360674d01526bf2f32b95196df3519bfcc4 (diff)
downloadsdl-0b0ee27be44bef48d2f2b19019aa541da677874a.tar.gz
Android: preparation bug 4142, reduce usage of global variable Android_Window
Diffstat (limited to 'src/video/android/SDL_androidmouse.c')
-rw-r--r--src/video/android/SDL_androidmouse.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/video/android/SDL_androidmouse.c b/src/video/android/SDL_androidmouse.c
index a66672827..dd0647ca4 100644
--- a/src/video/android/SDL_androidmouse.c
+++ b/src/video/android/SDL_androidmouse.c
@@ -62,7 +62,7 @@ Android_WrapCursor(int custom_cursor, int system_cursor)
cursor = SDL_calloc(1, sizeof(*cursor));
if (cursor) {
- SDL_AndroidCursorData *data = (SDL_AndroidCursorData*)SDL_calloc(1, sizeof(*data));
+ SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)SDL_calloc(1, sizeof(*data));
if (data) {
data->custom_cursor = custom_cursor;
data->system_cursor = system_cursor;
@@ -141,13 +141,13 @@ Android_DestroyEmptyCursor()
}
static int
-Android_ShowCursor(SDL_Cursor * cursor)
+Android_ShowCursor(SDL_Cursor *cursor)
{
if (!cursor) {
cursor = Android_CreateEmptyCursor();
}
if (cursor) {
- SDL_AndroidCursorData *data = (SDL_AndroidCursorData*)cursor->driverdata;
+ SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->driverdata;
if (data->custom_cursor) {
if (!Android_JNI_SetCustomCursor(data->custom_cursor)) {
return SDL_Unsupported();
@@ -220,12 +220,12 @@ TranslateButton(int state)
}
void
-Android_OnMouse(int state, int action, float x, float y, SDL_bool relative)
+Android_OnMouse(SDL_Window *window, int state, int action, float x, float y, SDL_bool relative)
{
int changes;
Uint8 button;
- if (!Android_Window) {
+ if (!window) {
return;
}
@@ -234,25 +234,25 @@ Android_OnMouse(int state, int action, float x, float y, SDL_bool relative)
changes = state & ~last_state;
button = TranslateButton(changes);
last_state = state;
- SDL_SendMouseMotion(Android_Window, 0, relative, (int)x, (int)y);
- SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, button);
+ SDL_SendMouseMotion(window, 0, relative, (int)x, (int)y);
+ SDL_SendMouseButton(window, 0, SDL_PRESSED, button);
break;
case ACTION_UP:
changes = last_state & ~state;
button = TranslateButton(changes);
last_state = state;
- SDL_SendMouseMotion(Android_Window, 0, relative, (int)x, (int)y);
- SDL_SendMouseButton(Android_Window, 0, SDL_RELEASED, button);
+ SDL_SendMouseMotion(window, 0, relative, (int)x, (int)y);
+ SDL_SendMouseButton(window, 0, SDL_RELEASED, button);
break;
case ACTION_MOVE:
case ACTION_HOVER_MOVE:
- SDL_SendMouseMotion(Android_Window, 0, relative, (int)x, (int)y);
+ SDL_SendMouseMotion(window, 0, relative, (int)x, (int)y);
break;
case ACTION_SCROLL:
- SDL_SendMouseWheel(Android_Window, 0, x, y, SDL_MOUSEWHEEL_NORMAL);
+ SDL_SendMouseWheel(window, 0, x, y, SDL_MOUSEWHEEL_NORMAL);
break;
default: