Skip to content
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

Removed joysticks should center their inputs #3616

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

Removed joysticks should center their inputs #3616

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2020-03-26 20:49:42 +0000, Ryan C. Gordon wrote:

In SDL_PrivateJoystickRemoved(), we should generate fake input events for any buttons that were still pressed down and center any axes before sending the SDL_JOYDEVICEREMOVED event.

This allows an app that doesn't handle hotplugging to at least not assume the player is pressing down the fire button forever if they yank out the USB cable suddenly.

--ryan.

On 2020-03-26 20:50:21 +0000, Ryan C. Gordon wrote:

Gonna assign this to myself in case this is quick to implement right now.

--ryan.

On 2020-03-26 20:56:06 +0000, Ryan C. Gordon wrote:

Oh, it turns out we already do this (grep for "force_recentering") but we send these recentering events after SDL_JOYDEVICEREMOVED, which is a problem in the opposite direction; if you handle hotplugging, you probably closed the joystick by the time these would show up.

Going to move the force_recentering code to a separate function, so the removal code can call it directly.

Also, force_recentering is only set in one other place (DARWIN_JoystickUpdate), and for the same reason: device removal. We should probably clean that out eventually too.

--ryan.

On 2020-03-26 22:50:04 +0000, Ryan C. Gordon wrote:

Fixed in https://hg.libsdl.org/SDL/rev/9adcb74f0be2

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant