Be explicit about the event mouse and keyboard ID
This commit is contained in:
1 parent
1c54455353
commit
d1eb4adb16
53 files changed
+383
-703
No files matched your search
@@ -330,12 +330,12 @@ static SDL_Scancode TranslateKeycode(int keycode)
|
||||
|
||||
int Android_OnKeyDown(int keycode)
|
||||
{
|
||||
return SDL_SendKeyboardKey(0, 0, SDL_PRESSED, TranslateKeycode(keycode));
|
||||
return SDL_SendKeyboardKey(0, Android_KeyboardID, SDL_PRESSED, TranslateKeycode(keycode));
|
||||
}
|
||||
|
||||
int Android_OnKeyUp(int keycode)
|
||||
{
|
||||
return SDL_SendKeyboardKey(0, 0, SDL_RELEASED, TranslateKeycode(keycode));
|
||||
return SDL_SendKeyboardKey(0, Android_KeyboardID, SDL_RELEASED, TranslateKeycode(keycode));
|
||||
}
|
||||
|
||||
SDL_bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
|
||||
|
||||
@@ -221,25 +221,25 @@ void Android_OnMouse(SDL_Window *window, int state, int action, float x, float y
|
||||
changes = state & ~last_state;
|
||||
button = TranslateButton(changes);
|
||||
last_state = state;
|
||||
SDL_SendMouseMotion(0, window, 0, relative, x, y);
|
||||
SDL_SendMouseButton(0, window, 0, SDL_PRESSED, button);
|
||||
SDL_SendMouseMotion(0, window, Android_MouseID, relative, x, y);
|
||||
SDL_SendMouseButton(0, window, Android_MouseID, SDL_PRESSED, button);
|
||||
break;
|
||||
|
||||
case ACTION_UP:
|
||||
changes = last_state & ~state;
|
||||
button = TranslateButton(changes);
|
||||
last_state = state;
|
||||
SDL_SendMouseMotion(0, window, 0, relative, x, y);
|
||||
SDL_SendMouseButton(0, window, 0, SDL_RELEASED, button);
|
||||
SDL_SendMouseMotion(0, window, Android_MouseID, relative, x, y);
|
||||
SDL_SendMouseButton(0, window, Android_MouseID, SDL_RELEASED, button);
|
||||
break;
|
||||
|
||||
case ACTION_MOVE:
|
||||
case ACTION_HOVER_MOVE:
|
||||
SDL_SendMouseMotion(0, window, 0, relative, x, y);
|
||||
SDL_SendMouseMotion(0, window, Android_MouseID, relative, x, y);
|
||||
break;
|
||||
|
||||
case ACTION_SCROLL:
|
||||
SDL_SendMouseWheel(0, window, 0, x, y, SDL_MOUSEWHEEL_NORMAL);
|
||||
SDL_SendMouseWheel(0, window, Android_MouseID, x, y, SDL_MOUSEWHEEL_NORMAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -67,6 +67,8 @@ SDL_Semaphore *Android_PauseSem = NULL;
|
||||
SDL_Semaphore *Android_ResumeSem = NULL;
|
||||
SDL_Mutex *Android_ActivityMutex = NULL;
|
||||
static SDL_SystemTheme Android_SystemTheme;
|
||||
SDL_KeyboardID Android_KeyboardID = 0;
|
||||
SDL_MouseID Android_MouseID = 0;
|
||||
|
||||
static int Android_SuspendScreenSaver(SDL_VideoDevice *_this)
|
||||
{
|
||||
|
||||
@@ -46,5 +46,7 @@ extern int Android_SurfaceHeight;
|
||||
extern float Android_ScreenDensity;
|
||||
extern SDL_Semaphore *Android_PauseSem, *Android_ResumeSem;
|
||||
extern SDL_Mutex *Android_ActivityMutex;
|
||||
extern SDL_KeyboardID Android_KeyboardID;
|
||||
extern SDL_MouseID Android_MouseID;
|
||||
|
||||
#endif /* SDL_androidvideo_h_ */
|
||||
Reference in new issue
Block a user