Android: update with suggestions
diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index a6a9d56..019e4e8 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c
@@ -1358,7 +1358,7 @@ jint device_id, jint keycode) { #ifdef SDL_JOYSTICK_ANDROID -int button = android_keycode_to_SDL(keycode); +int button = Android_keycode_to_SDL(keycode); if (button >= 0) { RPC_Prepare(onNativePadDown); RPC_Add(device_id); @@ -1385,7 +1385,7 @@ jint device_id, jint keycode) { #ifdef SDL_JOYSTICK_ANDROID - int button = android_keycode_to_SDL(keycode); + int button = Android_keycode_to_SDL(keycode); if (button >= 0) { RPC_Prepare(onNativePadUp); RPC_Add(device_id);
diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 8bebf75..a1ed8e4 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c
@@ -1514,8 +1514,12 @@ #ifdef SDL_PLATFORM_ANDROID // Android event processing is independent of the video subsystem SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_Window *window = _this->windows; - Android_PumpEvents(window, 0); + if (_this) { + SDL_Window *window = _this->windows; + if (window) { + Android_PumpEvents(window, 0); + } + } #else // Get events from the video subsystem SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -1750,8 +1754,12 @@ } SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_Window *window = _this->windows; - Android_PumpEvents(window, delay); + if (_this) { + SDL_Window *window = _this->windows; + if (window) { + Android_PumpEvents(window, delay); + } + } } #else SDL_VideoDevice *_this = SDL_GetVideoDevice();
diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c index 04119a4..cd0026e 100644 --- a/src/joystick/android/SDL_sysjoystick.c +++ b/src/joystick/android/SDL_sysjoystick.c
@@ -64,7 +64,7 @@ * This code manipulation is done to get a sequential list of codes. * FIXME: This is only suited for the case where we use a fixed number of buttons determined by ANDROID_MAX_NBUTTONS */ -int android_keycode_to_SDL(int keycode) +int Android_keycode_to_SDL(int keycode) { // FIXME: If this function gets too unwieldy in the future, replace with a lookup table int button = 0; @@ -198,7 +198,7 @@ { Uint64 timestamp = SDL_GetTicksNS(); SDL_joylist_item *item; - int button = android_keycode_to_SDL(keycode); + int button = Android_keycode_to_SDL(keycode); if (button >= 0) { SDL_LockJoysticks(); item = JoystickByDeviceId(device_id); @@ -218,7 +218,7 @@ { Uint64 timestamp = SDL_GetTicksNS(); SDL_joylist_item *item; - int button = android_keycode_to_SDL(keycode); + int button = Android_keycode_to_SDL(keycode); if (button >= 0) { SDL_LockJoysticks(); item = JoystickByDeviceId(device_id);
diff --git a/src/joystick/android/SDL_sysjoystick_c.h b/src/joystick/android/SDL_sysjoystick_c.h index 32aa9a6..c72de24 100644 --- a/src/joystick/android/SDL_sysjoystick_c.h +++ b/src/joystick/android/SDL_sysjoystick_c.h
@@ -28,7 +28,7 @@ #include "../SDL_sysjoystick.h" -extern int android_keycode_to_SDL(int keycode); +extern int Android_keycode_to_SDL(int keycode); extern bool Android_OnPadDown(int device_id, int keycode); extern bool Android_OnPadUp(int device_id, int keycode); extern bool Android_OnJoy(int device_id, int axisnum, float value);
diff --git a/src/video/android/SDL_androidevents.h b/src/video/android/SDL_androidevents.h index b70a69f..1a9062b 100644 --- a/src/video/android/SDL_androidevents.h +++ b/src/video/android/SDL_androidevents.h
@@ -24,5 +24,4 @@ extern void Android_PumpEvents(SDL_Window *window, Sint64 timeoutNS); extern bool Android_WaitActiveAndLockActivity(SDL_Window *window); extern void Android_QuitEvents(void); - extern void Android_PumpLifecycleEvents(SDL_Window *window);
diff --git a/src/video/android/SDL_androidwindow.h b/src/video/android/SDL_androidwindow.h index b788f3b..90f65dd 100644 --- a/src/video/android/SDL_androidwindow.h +++ b/src/video/android/SDL_androidwindow.h
@@ -47,11 +47,8 @@ }; - bool Android_nativeSurfaceCreated(SDL_Window *window); bool Android_nativeSurfaceChanged(SDL_Window *window); void Android_nativeSurfaceDestroyed(SDL_Window *window); - - #endif // SDL_androidwindow_h_