Android: Added mouse initialization to reset state. If the app is launched again then the shared object may be reused (on Android).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
diff --git a/src/video/android/SDL_androidmouse.c b/src/video/android/SDL_androidmouse.c
index 94b5c95..bfbb843 100644
--- a/src/video/android/SDL_androidmouse.c
+++ b/src/video/android/SDL_androidmouse.c
@@ -40,9 +40,15 @@
#define BUTTON_BACK 8
#define BUTTON_FORWARD 16
-void Android_OnMouse( int androidButton, int action, float x, float y) {
- static Uint8 SDLButton;
+static Uint8 SDLButton;
+
+void
+Android_InitMouse(void)
+{
+ SDLButton = 0;
+}
+void Android_OnMouse( int androidButton, int action, float x, float y) {
if (!Android_Window) {
return;
}
diff --git a/src/video/android/SDL_androidmouse.h b/src/video/android/SDL_androidmouse.h
index 9b68eed..a64e06d 100644
--- a/src/video/android/SDL_androidmouse.h
+++ b/src/video/android/SDL_androidmouse.h
@@ -24,6 +24,7 @@
#include "SDL_androidvideo.h"
+extern void Android_InitMouse(void);
extern void Android_OnMouse( int button, int action, float x, float y);
#endif /* _SDL_androidmouse_h */
diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c
index e14b966..0e24a3d 100644
--- a/src/video/android/SDL_androidvideo.c
+++ b/src/video/android/SDL_androidvideo.c
@@ -36,6 +36,7 @@
#include "SDL_androidclipboard.h"
#include "SDL_androidevents.h"
#include "SDL_androidkeyboard.h"
+#include "SDL_androidmouse.h"
#include "SDL_androidtouch.h"
#include "SDL_androidwindow.h"
@@ -181,6 +182,8 @@ Android_VideoInit(_THIS)
Android_InitTouch();
+ Android_InitMouse();
+
/* We're done! */
return 0;
}