We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3253

Summary: Controller event SDL_CONTROLLERDEVICEREMOVED not clear.
Product: SDL Reporter: Alain Dupuis <adupuis5000>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   

Description Alain Dupuis 2016-02-02 09:39:09 UTC
From the name of the event 'SDL_CONTROLLERDEVICEREMOVED' one would believe the event to be triggered whenever a controller is removed. Only after looking at the source code (as of changeset 10061) file:SDL_events.h line:121 that one can tell that this event is triggered only when an "opened" controller has been removed.

This leaves no event for when any unopened controller is removed. This causes a problem if a list of available controllers is built and presented to the user and a controller is removed before the user makes a choice. Since no events are triggered there is no way of telling that a particular controller is no longer available, unless the program keeps checking all the controllers over and over.

Wouldn't it be better to send that event whenever any controller is removed, and leave it to the programmer to check if it's an opened one and take action if it's the case?

Thanks.
Comment 1 Sam Lantinga 2017-08-12 04:50:34 UTC
Yes, that makes sense. I'm marking this for review for SDL 2.1.

Thanks!