Android: Added mouse initialization to reset state.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Tue, 12 Jan 2016 22:23:00 +0100
changeset 10051 2c6c612344b5
parent 10050 2cbe9f525260
child 10052 541e2b6818a7
Android: Added mouse initialization to reset state. If the app is launched again then the shared object may be reused (on Android).
src/video/android/SDL_androidmouse.c
src/video/android/SDL_androidmouse.h
src/video/android/SDL_androidvideo.c
--- a/src/video/android/SDL_androidmouse.c	Tue Jan 12 22:22:24 2016 +0100
+++ b/src/video/android/SDL_androidmouse.c	Tue Jan 12 22:23:00 2016 +0100
@@ -40,9 +40,15 @@
 #define BUTTON_BACK 8
 #define BUTTON_FORWARD 16
 
+static Uint8 SDLButton;
+
+void
+Android_InitMouse(void)
+{
+    SDLButton = 0;
+}
+
 void Android_OnMouse( int androidButton, int action, float x, float y) {
-    static Uint8 SDLButton;
-
     if (!Android_Window) {
         return;
     }
--- a/src/video/android/SDL_androidmouse.h	Tue Jan 12 22:22:24 2016 +0100
+++ b/src/video/android/SDL_androidmouse.h	Tue Jan 12 22:23:00 2016 +0100
@@ -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 */
--- a/src/video/android/SDL_androidvideo.c	Tue Jan 12 22:22:24 2016 +0100
+++ b/src/video/android/SDL_androidvideo.c	Tue Jan 12 22:23:00 2016 +0100
@@ -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_InitTouch();
 
+    Android_InitMouse();
+
     /* We're done! */
     return 0;
 }