-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for focus before reading joypad input. #16276
Conversation
The udev and sdl joypad drivers were reading input in all cases. Now state is not changed if window has no focus, connect / disconnect events are still processed.
Is this how the other input drivers work as well? We wouldn't want to introduce something specific to certain input driver implementations in a non-unified way. Also I think it's the wrong approach to do this 'video_driver_has_focus()' call inside the input driver implementation, should be done higher-level. Also in addition to it being a generic option that should work across the board for all input drivers, I feel this should remain entirely optional and tied behind a setting instead of forced, there might be usecases where we still want input for a non-focused window, this is in fact a handy feature when you want to still be able to play a game in an unfocused window with your gamepad. |
some people specifically request input detection in the background. it's a nasty surprise if you're not wanting, that, though, and end up wreaking havoc. I'm loathe to add more options unnecessarily, but it might be worthwhile here. |
In general I feel that Windows drivers do it correctly, which is: keyboard is ignored when app is not in focus, and controllers never. |
Udev keyboard/mouse does something similar already, but not much else. |
Ye I feel this should be behind a setting with the following options (you can decide on the names of each option) 0 - receives both keyboard and controller input when out of focus 1 should be the default setting value. |
I'm fine with the approach (though option 0 will always be a bit misleading, as the possibility of getting keyboard input when out of focus is very much platform/driver dependent). I'm just wary of doing it centrally in input_driver.c, which is probably the 3rd most complex piece in whole RA I have visited so far, so it may take a while. I can close the PR until that time, if preferred. |
Where do we stand on this now? Was my previous feedback incorporated into the PR? |
I'll close it for the time being, the general solution is still far away and probably better avoid driver-specific changes here. It can be revisited later. |
Description
The udev and sdl joypad drivers were reading input in all cases. Now state is not monitored if window has no focus, connect / disconnect events are still processed.
Related Issues
Fixes #16261