mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-04 06:12:04 +08:00
Don't rely on event.buttonMask being set in touchesEnded
Fixes https://github.com/libsdl-org/SDL/issues/11131
This commit is contained in:
@@ -292,26 +292,11 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|||||||
if (touch.type == UITouchTypeIndirectPointer) {
|
if (touch.type == UITouchTypeIndirectPointer) {
|
||||||
if (!SDL_HasMouse()) {
|
if (!SDL_HasMouse()) {
|
||||||
int i;
|
int i;
|
||||||
|
SDL_MouseButtonFlags buttons = SDL_GetMouseState(NULL, NULL);
|
||||||
|
|
||||||
for (i = 1; i <= MAX_MOUSE_BUTTONS; ++i) {
|
for (i = 0; i < MAX_MOUSE_BUTTONS; ++i) {
|
||||||
if (event.buttonMask & SDL_BUTTON_MASK(i)) {
|
if (buttons & SDL_BUTTON_MASK(i)) {
|
||||||
Uint8 button;
|
SDL_SendMouseButton(UIKit_GetEventTimestamp([event timestamp]), sdlwindow, SDL_GLOBAL_MOUSE_ID, (Uint8)i, false);
|
||||||
|
|
||||||
switch (i) {
|
|
||||||
case 1:
|
|
||||||
button = SDL_BUTTON_LEFT;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
button = SDL_BUTTON_RIGHT;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
button = SDL_BUTTON_MIDDLE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
button = (Uint8)i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
SDL_SendMouseButton(UIKit_GetEventTimestamp([event timestamp]), sdlwindow, SDL_GLOBAL_MOUSE_ID, button, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user