Display hotplugging

My tests show SDL2 seems not to support plugging in and out displays after init time. I am developing a VJ application that allows multiple screen/projector output and support for this would be very welcome. A hotplug event system would be handy, but just an update of the list of attached displays whenever SDL_GetNumVideoDisplays() is called would already be very handy.

Thanks.

1 Like

We just added support for this on Windows. Please check it out in this snapshot:
http://www.libsdl.org/tmp/SDL-2.0.zip

You’ll want to watch for the event SDL_DISPLAYEVENT with the values:

typedef enum
{
    SDL_DISPLAYEVENT_NONE,          /**< Never used */
    SDL_DISPLAYEVENT_ORIENTATION,   /**< Display orientation has changed to data1 */
    SDL_DISPLAYEVENT_CONNECTED,     /**< Display has been added to the system */
    SDL_DISPLAYEVENT_DISCONNECTED   /**< Display has been removed from the system */
} SDL_DisplayEventID;

Great!
Are there any future plans for adding it to Linux too?

Feel free to open a bug on GitHub for it. It’s just a matter of someone having a chance to sit down and do it.

Thanks!