mirror of https://github.com/encounter/SDL.git
Don't send game controller touchpad or sensor events unless the application has focus
Fixes https://github.com/libsdl-org/SDL/issues/4891
This commit is contained in:
parent
d2f756360e
commit
d31f90d9e1
|
@ -2721,6 +2721,13 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* We ignore events if we don't have keyboard focus, except for touch release */
|
||||||
|
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
|
||||||
|
if (event_type != SDL_CONTROLLERTOUCHPADUP) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Update internal joystick state */
|
/* Update internal joystick state */
|
||||||
finger_info->state = state;
|
finger_info->state = state;
|
||||||
finger_info->x = x;
|
finger_info->x = x;
|
||||||
|
@ -2750,6 +2757,11 @@ int SDL_PrivateJoystickSensor(SDL_Joystick *joystick, SDL_SensorType type, const
|
||||||
int i;
|
int i;
|
||||||
int posted = 0;
|
int posted = 0;
|
||||||
|
|
||||||
|
/* We ignore events if we don't have keyboard focus */
|
||||||
|
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < joystick->nsensors; ++i) {
|
for (i = 0; i < joystick->nsensors; ++i) {
|
||||||
SDL_JoystickSensorInfo *sensor = &joystick->sensors[i];
|
SDL_JoystickSensorInfo *sensor = &joystick->sensors[i];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue