Android: Added mouse initialization to reset state.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Tue, 12 Jan 2016 22:23:00 +0100
changeset 100512c6c612344b5
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
     1.1 --- a/src/video/android/SDL_androidmouse.c	Tue Jan 12 22:22:24 2016 +0100
     1.2 +++ b/src/video/android/SDL_androidmouse.c	Tue Jan 12 22:23:00 2016 +0100
     1.3 @@ -40,9 +40,15 @@
     1.4  #define BUTTON_BACK 8
     1.5  #define BUTTON_FORWARD 16
     1.6  
     1.7 +static Uint8 SDLButton;
     1.8 +
     1.9 +void
    1.10 +Android_InitMouse(void)
    1.11 +{
    1.12 +    SDLButton = 0;
    1.13 +}
    1.14 +
    1.15  void Android_OnMouse( int androidButton, int action, float x, float y) {
    1.16 -    static Uint8 SDLButton;
    1.17 -
    1.18      if (!Android_Window) {
    1.19          return;
    1.20      }
     2.1 --- a/src/video/android/SDL_androidmouse.h	Tue Jan 12 22:22:24 2016 +0100
     2.2 +++ b/src/video/android/SDL_androidmouse.h	Tue Jan 12 22:23:00 2016 +0100
     2.3 @@ -24,6 +24,7 @@
     2.4  
     2.5  #include "SDL_androidvideo.h"
     2.6  
     2.7 +extern void Android_InitMouse(void);
     2.8  extern void Android_OnMouse( int button, int action, float x, float y);
     2.9  
    2.10  #endif /* _SDL_androidmouse_h */
     3.1 --- a/src/video/android/SDL_androidvideo.c	Tue Jan 12 22:22:24 2016 +0100
     3.2 +++ b/src/video/android/SDL_androidvideo.c	Tue Jan 12 22:23:00 2016 +0100
     3.3 @@ -36,6 +36,7 @@
     3.4  #include "SDL_androidclipboard.h"
     3.5  #include "SDL_androidevents.h"
     3.6  #include "SDL_androidkeyboard.h"
     3.7 +#include "SDL_androidmouse.h"
     3.8  #include "SDL_androidtouch.h"
     3.9  #include "SDL_androidwindow.h"
    3.10  
    3.11 @@ -181,6 +182,8 @@
    3.12  
    3.13      Android_InitTouch();
    3.14  
    3.15 +    Android_InitMouse();
    3.16 +
    3.17      /* We're done! */
    3.18      return 0;
    3.19  }