diff --git a/src/video/android/SDL_androidpen.c b/src/video/android/SDL_androidpen.c index cfe091c009..acdf96d3ff 100644 --- a/src/video/android/SDL_androidpen.c +++ b/src/video/android/SDL_androidpen.c @@ -34,6 +34,20 @@ #define ACTION_HOVER_ENTER 9 #define ACTION_HOVER_EXIT 10 +/* +* Helper function to map android pen buttons to SDL mouse buttons +*/ +static inline Uint8 Android_PenToMouseButton(Uint8 pen_button) +{ + switch (pen_button) + { + case 1: return SDL_BUTTON_RIGHT; + case 2: return SDL_BUTTON_MIDDLE; + case 5: return 0; + default: return pen_button + 1; + } +} + void Android_OnPen(SDL_Window *window, int pen_id_in, SDL_PenDeviceType device_type, int button, int action, float x, float y, float p) { if (!window) { @@ -101,15 +115,4 @@ void Android_OnPen(SDL_Window *window, int pen_id_in, SDL_PenDeviceType device_t } } -static inline Uint8 Android_PenToMouseButton(Uint8 pen_button) -{ - switch (pen_button) - { - case 1: return SDL_BUTTON_RIGHT; - case 2: return SDL_BUTTON_MIDDLE; - case 5: return 0; - default: return pen_button + 1; - } -} - -#endif // SDL_VIDEO_DRIVER_ANDROID +#endif // SDL_VIDEO_DRIVER_ANDROID \ No newline at end of file