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 1892

Summary: Joystick events trigger when the SDL program has no focus
Product: SDL Reporter: Alex Szpakowski <amaranth72>
Component: eventsAssignee: (disabled) Jørgen Tjernø <jorgen>
Status: RESOLVED FIXED QA Contact: (disabled) Jørgen Tjernø <jorgen>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86   
OS: Mac OS X 10.8   

Description Alex Szpakowski 2013-06-04 17:14:07 UTC
Joystick and GameController input events appear to be generated even when the SDL program doesn't have regular input focus, which is not expected behaviour for me.

It would be nice for the Joystick/GameController input events to have an accompanying WindowID, but at the very least I think their input events should not be generated if no SDL window has keyboard focus. Adding a WindowID is not possible without breaking ABI compatibility with older SDL2 revisions.

Currently I can have 2 SDL2 programs open and joystick events will be generated for both at once no matter what has normal focus, unless the programs explicitly check for keyboard input focus when they receive the Joystick input events.

Tested on Mac OS 10.8.3.
Comment 1 (disabled) Jørgen Tjernø 2013-06-05 18:13:07 UTC
This should be fixed in http://hg.libsdl.org/SDL/rev/f7805b13b485 - no windowID for the time being, but SDL_GetKeyboardFocus can be used to figure out what window the user PROBABLY intended it for. :)

The old behavior of receiving all events can be returned by setting SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS to "1".