X Tutup
Skip to content

Fix Input.is_joy_known response for SDL joypads#111503

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
JestemStefan:fix_111176
Nov 12, 2025
Merged

Fix Input.is_joy_known response for SDL joypads#111503
Repiteo merged 1 commit intogodotengine:masterfrom
JestemStefan:fix_111176

Conversation

@JestemStefan
Copy link
Contributor

@JestemStefan JestemStefan commented Oct 11, 2025

Fix: #111176

I added a wrapped SDL_IsGamepad call in JoypadSDL is_known method as suggested by @Nintorch.
Later I call this method in Input.is_joy_known when SDL is enabled.

EDIT: I exposed new boolean on Joypad class called is_known that is checked in Input.is_joy_known method.
This variable is set during handling of Input.joy_connection_changed based on the joy_info mapping_handled param. This param value is set to true if SDL is recognizing gamepad during connection event

I hope I did it right. Let me know if there are any things I should change.

Not my first contribution, but I'm still a beginner.

@AThousandShips AThousandShips changed the title #111176 - FIx Input.is_joy_known response for SDL joypads Fix Input.is_joy_known response for SDL joypads Oct 11, 2025
@Nintorch
Copy link
Contributor

Otherwise I think it looks good! :)

@JestemStefan JestemStefan marked this pull request as ready for review October 11, 2025 19:16
@JestemStefan JestemStefan requested a review from a team as a code owner October 11, 2025 19:16
@Chaosus Chaosus added this to the 4.6 milestone Oct 12, 2025
@JestemStefan
Copy link
Contributor Author

I pushed and update with condition added as mentioned earlier.

// Skip Godot's mapping system if SDL already handles the joypad's mapping.
joypad_info["mapping_handled"] = SDL_IsGamepad(sdl_event.jdevice.which); 

Let me know if this is fine

Copy link
Contributor

@Nintorch Nintorch left a comment

Choose a reason for hiding this comment

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

Looks good to me :)

@Repiteo Repiteo requested a review from groud October 13, 2025 16:30
@bruvzg bruvzg self-requested a review October 24, 2025 14:15
@akien-mga akien-mga added the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Nov 4, 2025
@Repiteo Repiteo merged commit 08fb2e6 into godotengine:master Nov 12, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 12, 2025

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 4.5.2.

@akien-mga akien-mga removed the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Jan 8, 2026
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.

Input.is_joy_known(device: int) now returns 'false' in Godot 4.5. Where Input.is_joy_known(0) use to return 'true' with xbox controller connected.

7 participants

X Tutup