mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 01:16:26 +00:00
SDL_Mouse/Touch: discard synthetic events when hints are not set.
Those are generated/flagged by platform layer.
This commit is contained in:
@@ -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, ¢er_x, ¢er_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:
|
||||
|
Reference in New Issue
Block a user