refactor: rename Controller* events to Gamepad* for SDL3 consistency#323
Open
revmischa wants to merge 2 commits into
Open
refactor: rename Controller* events to Gamepad* for SDL3 consistency#323revmischa wants to merge 2 commits into
revmischa wants to merge 2 commits into
Conversation
revmischa
force-pushed
the
fix/joystick-id-newtype
branch
from
May 4, 2026 00:03
6e0465d to
54fa191
Compare
revmischa
force-pushed
the
fix/joystick-id-newtype
branch
from
June 9, 2026 20:57
54fa191 to
8065da9
Compare
revmischa
force-pushed
the
fix/gamepad-event-naming
branch
from
June 9, 2026 21:03
105bf2a to
50be367
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the Rust event API with SDL3’s “gamepad” terminology by renaming Controller* event types/variants to Gamepad*, and introduces is_gamepad() (with a deprecated is_controller() alias) to ease migration. It also includes the JoystickId newtype work (per dependency on #322) and updates call sites/examples accordingly.
Changes:
- Rename
EventType::Controller*andEvent::Controller*variants toGamepad*equivalents. - Rename
Event::is_controller()toEvent::is_gamepad()and keepis_controller()as a deprecated alias. - Convert joystick/gamepad
whichidentifiers to use theJoystickIdnewtype and update subsystem bindings/examples.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sdl3/joystick.rs | Introduces JoystickId as a transparent newtype and updates joystick APIs to convert into SDL’s ID type. |
| src/sdl3/gamepad.rs | Updates gamepad subsystem APIs to accept JoystickId and pass the underlying SDL ID via .into(). |
| src/sdl3/event.rs | Renames controller events/types to gamepad equivalents; adds is_gamepad() and deprecated is_controller() alias. |
| examples/sensors.rs | Updates sensor event matching to Event::GamepadSensorUpdated. |
| examples/gamepad.rs | Updates event matching arms to new Gamepad* event variants. |
Comments suppressed due to low confidence (1)
src/sdl3/event.rs:821
- These doc comments still refer to "controller" even though the variants were renamed to
Gamepad*. Updating the wording keeps the public API docs consistent with the SDL3 gamepad terminology.
GamepadAxisMotion {
timestamp: u64,
/// The controller's joystick `id`
which: JoystickId,
axis: Axis,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
revmischa
force-pushed
the
fix/joystick-id-newtype
branch
from
June 9, 2026 21:21
8065da9 to
3fcd4e2
Compare
Converts JoystickId from a type alias to a proper newtype struct with Debug, Display, and From trait implementations. This allows easier construction via JoystickId::new(id) or .into(), and better debug output. Updates all joystick/gamepad events to use JoystickId for their `which` field instead of raw u32. The From<u32> and From<JoystickId> for u32 impls make migration straightforward. Breaking change: Event `which` fields now require JoystickId instead of u32. Use `JoystickId::new(val)` or `val.into()` to construct, and `.raw()` or `.into()` to get the raw u32 value. Fixes #319
Renames event types and variants to match SDL3's gamepad terminology: - ControllerAxisMotion → GamepadAxisMotion - ControllerButtonDown → GamepadButtonDown - ControllerButtonUp → GamepadButtonUp - ControllerDeviceAdded → GamepadAdded - ControllerDeviceRemoved → GamepadRemoved - ControllerDeviceRemapped → GamepadRemapped - ControllerTouchpadDown → GamepadTouchpadDown - ControllerTouchpadMotion → GamepadTouchpadMotion - ControllerTouchpadUp → GamepadTouchpadUp - ControllerSensorUpdated → GamepadSensorUpdated Also renames is_controller() to is_gamepad() with a deprecated alias for backward compatibility. Breaking change: Event variant names changed from Controller* to Gamepad*. The deprecated is_controller() alias helps migration. Part 2 of 2 for #319
revmischa
force-pushed
the
fix/gamepad-event-naming
branch
from
June 9, 2026 21:22
50be367 to
8c6df42
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renames event types and variants to match SDL3's gamepad terminology:
ControllerAxisMotionGamepadAxisMotionControllerButtonDownGamepadButtonDownControllerButtonUpGamepadButtonUpControllerDeviceAddedGamepadAddedControllerDeviceRemovedGamepadRemovedControllerDeviceRemappedGamepadRemappedControllerTouchpadDownGamepadTouchpadDownControllerTouchpadMotionGamepadTouchpadMotionControllerTouchpadUpGamepadTouchpadUpControllerSensorUpdatedGamepadSensorUpdatedAlso renames
is_controller()tois_gamepad()with a deprecated alias for backward compatibility.Breaking change: Event variant names changed from Controller* to Gamepad*. The deprecated
is_controller()alias helps migration.This PR depends on #322 and together they complete #319.