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 - Controller event SDL_CONTROLLERDEVICEREMOVED not clear.
Summary: Controller event SDL_CONTROLLERDEVICEREMOVED not clear.
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 enhancement
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-02 09:39 UTC by Alain Dupuis
Modified: 2017-08-12 04:50 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!