SDL_Mouse/Touch: discard synthetic events when hints are not set.

Those are generated/flagged by platform layer.
This commit is contained in:
Sylvain Becker
2019-07-09 11:46:42 +02:00
parent d550867aef
commit 6625203514
2 changed files with 34 additions and 2 deletions

View File

@@ -338,6 +338,13 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
}
}
/* SDL_HINT_TOUCH_MOUSE_EVENTS: if not set, discard synthetic mouse events coming from platform layer */
if (mouse->touch_mouse_events == 0) {
if (mouseID == SDL_TOUCH_MOUSEID) {
return 0;
}
}
if (mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) {
int center_x = 0, center_y = 0;
SDL_GetWindowSize(window, &center_x, &center_y);
@@ -499,6 +506,13 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state
}
}
/* SDL_HINT_TOUCH_MOUSE_EVENTS: if not set, discard synthetic mouse events coming from platform layer */
if (mouse->touch_mouse_events == 0) {
if (mouseID == SDL_TOUCH_MOUSEID) {
return 0;
}
}
/* Figure out which event to perform */
switch (state) {
case SDL_PRESSED: