Skip to content

Add support for joypad touchpads#111714

Open
Nintorch wants to merge 1 commit into
godotengine:masterfrom
Nintorch:joypad-touchpads
Open

Add support for joypad touchpads#111714
Nintorch wants to merge 1 commit into
godotengine:masterfrom
Nintorch:joypad-touchpads

Conversation

@Nintorch
Copy link
Copy Markdown
Member

@Nintorch Nintorch commented Oct 16, 2025

I decided to split my big SDL3 joypad features PR ( #107967 ) into several smaller PRs, this PR is one of them.

This PR adds the ability to use touchpads on supported controllers, such as DualShock 4, DualSense and (most likely) Steam Deck built-in controls (EDIT: apparently not, since "thirdparty/sdl/joystick/hidapi/SDL_hidapi_steamdeck.c" file doesn't have any references to touchpads).

Currently there's no InputEvent that gets fired when a finger appears/moves on a touchpad.

TODO:

  • Mark as experimental
  • Add a note about Android automatically turning joypad touchpads into a mouse cursor
  • Test on iOS later after Add support for SDL3 joystick input driver for iOS #114316 is merged
  • Write a proposal
  • Make p_touchpad have the default value of 0
  • Allow touchpad events to be ignored if joypad input is disabled on unfocused application
  • Input events, including a motion event with movement vector (Can be done in a separate PR if required)
  • Method for getting the pressure value
  • Default value for get_joy_touchpad_fingers method touchpad parameter

TODO for a separate PR:
Input events:

  • InputEventJoypadTouchpad (press/release)
  • InputEventJoypadTouchpadMotion (finger motion, with initial position and velocity to make things easier)

Copy link
Copy Markdown
Contributor

@Meorge Meorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with a wired PS4 DualShock and PS5 DualSense controller on macOS, and it works great!

Here's a very minimal Godot project for testing, adapted from the previous PR, to make it easier for others to test as well:
test-joypad-touchpad.zip
(I can put it up on a GitHub repo if necessary, but it's so minimal unlike the adaptive triggers one that it's probably fine this way 😅 )

Comment thread doc/classes/Input.xml Outdated
Comment thread doc/classes/Input.xml Outdated
Comment thread doc/classes/Input.xml Outdated
Comment thread doc/classes/Input.xml Outdated
Comment thread doc/classes/Input.xml Outdated
Comment thread doc/classes/Input.xml Outdated
Comment thread doc/classes/Input.xml Outdated
Comment thread core/input/input.cpp Outdated
Comment thread core/input/input.h Outdated
Comment thread core/input/input.h Outdated
Comment thread core/input/input.h Outdated
Comment thread drivers/sdl/joypad_sdl.h Outdated
@Nintorch Nintorch force-pushed the joypad-touchpads branch 3 times, most recently from 1eaea49 to f4b1be5 Compare November 17, 2025 17:01
Comment thread core/input/input.h Outdated
Comment thread doc/classes/Input.xml Outdated
Comment thread doc/classes/Input.xml Outdated
Comment thread doc/classes/Input.xml Outdated
Comment thread core/input/input.cpp Outdated
Comment thread core/input/input.cpp Outdated
Comment thread core/input/input.cpp Outdated
Comment thread core/input/input.cpp Outdated
Comment thread core/input/input.cpp Outdated
@Nintorch
Copy link
Copy Markdown
Member Author

Thank you for your review, AThousandShips! I included your suggested changes into the code!

Comment thread doc/classes/Input.xml Outdated
@Nintorch
Copy link
Copy Markdown
Member Author

Apparently, SDL only reports pressure values of 0 or 1, so I will probably need to remove the method to get the pressure value, because it's not that useful in this case.
image

Comment thread core/input/input.cpp Outdated
@Nintorch
Copy link
Copy Markdown
Member Author

Since this PR lacked a proposal I decided to write one: godotengine/godot-proposals#14481

@Nintorch Nintorch removed the request for review from a team March 22, 2026 18:48
youfch added a commit to youfch/godot that referenced this pull request Mar 26, 2026
@Nintorch Nintorch marked this pull request as draft March 26, 2026 13:21
@Nintorch Nintorch marked this pull request as ready for review May 7, 2026 05:13
Copy link
Copy Markdown
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on macOS and iOS with DualSense controller, controller touchpad seems to be working as expected.

@Nintorch
Copy link
Copy Markdown
Member Author

Thank you for your review, bruvzg! :)

@Nintorch Nintorch modified the milestones: 4.x, 4.8 May 11, 2026
Comment thread core/input/input.h Outdated
@Nintorch Nintorch force-pushed the joypad-touchpads branch from 6545bf2 to 6fe1384 Compare May 11, 2026 14:09
@Birdulon
Copy link
Copy Markdown
Contributor

Apparently, SDL only reports pressure values of 0 or 1, so I will probably need to remove the method to get the pressure value, because it's not that useful in this case. image

True for Sony controllers, however Valve controllers do report a range of pressure values. Tested on Steam Deck Desktop Mode (Gaming Mode forces Steam Input to present an emulated xinput controller) on SDL3 main, and the new Steam Controller (codename "triton") with libsdl-org/SDL#15528
image

@Nintorch Nintorch force-pushed the joypad-touchpads branch 2 times, most recently from ffb53d0 to 886b4ae Compare May 13, 2026 11:43
This PR adds the ability to use touchpads on supported controllers, such as DualShock 4 and DualSense.
Currently there's no InputEvent that gets fired when a finger appears/moves on a touchpad.
@Nintorch Nintorch force-pushed the joypad-touchpads branch from 886b4ae to 58103e8 Compare May 13, 2026 13:23
Copy link
Copy Markdown
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style and docs look good, haven't tested

@Nintorch
Copy link
Copy Markdown
Member Author

Thank you for your review, AThousandShips! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for accessing DualShock/DualSense touchpad finger touch positions

6 participants