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 2741

Summary: Add support for joysticks with integrated touchpads
Product: SDL Reporter: Frank <frank.praznik>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: gabomdq
Version: HG 2.1   
Hardware: x86_64   
OS: All   
Attachments: Support joystick touchpads via the existing touch system

Description Frank 2014-09-27 18:35:10 UTC
Created attachment 1883 [details]
Support joystick touchpads via the existing touch system

These patches add support for joysticks with integrated trackpads such as the DualShock 4.  Two different forms of implementation are included here: one that uses the existing multitouch system and another that implements joystick touch events separately from others.  There are advantages and drawbacks to each approach as outlined below:

In the version that uses the existing touchpad system the function SDL_JoystickGetTouchDevice() was added to the joystick API to retrieve the SDL_TouchID of the associated touchpad.  Touch events are sent with the existing SDL_FINGER* events and it's up to the application to use the touch device id to determine from which device the touch originated.  This approach uses less code overall and allows for the use of the gesture system on controller touchpads, but it also means that applications that just blindly parse touch events without checking which device they came from may have undesired behavior.

The second approach adds SDL_JoystickNumTouchFingers() and SDL_GetTouchFinger() to the joystick API and sends new SDL_JOYTOUCH* events via a new SDL_JoyTouchEvent struct.  This adds a bit more code but it makes sure that events from joystick touchpads and other devices like touchscreens are explicitly separated.  Applications that don't expect multiple touchpads won't have issues since support for joystick touch events must be handled separately.

In both cases the testjoystick application was updated to demonstrate the new functionality.
Comment 1 Gabriel Jacobo 2014-10-16 11:50:03 UTC
Closing duplicate.

*** This bug has been marked as a duplicate of bug 2742 ***