Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic on unrecognized controller buttons and axes #1156

Merged
merged 3 commits into from
Oct 10, 2021

Conversation

potatotech
Copy link
Contributor

@potatotech potatotech commented Oct 6, 2021

Fixes #1128.
Fixes #1154.

Changes the panics to return None and implements the following button types:

SDL_CONTROLLER_BUTTON_MISC1
SDL_CONTROLLER_BUTTON_PADDLE1
SDL_CONTROLLER_BUTTON_PADDLE2
SDL_CONTROLLER_BUTTON_PADDLE3
SDL_CONTROLLER_BUTTON_PADDLE4
SDL_CONTROLLER_BUTTON_TOUCHPAD

@Cobrand
Copy link
Member

Cobrand commented Oct 10, 2021

#1154 (comment) As discussed here, can you also change the panic do return None instead? We don't want to panic for unrecognized buttons.

@potatotech
Copy link
Contributor Author

potatotech commented Oct 10, 2021

Should I also remove the panic for unrecognized axes, or should that be in its own PR?

@potatotech potatotech changed the title Add undocumented game controller buttons Fix panic on unrecognized controller buttons and axes Oct 10, 2021
@potatotech
Copy link
Contributor Author

I went ahead and changed the axes panic to return None. It is a one-line change, so might as well do it here.

@Cobrand
Copy link
Member

Cobrand commented Oct 10, 2021

Thanks!

@Cobrand Cobrand merged commit f25716a into Rust-SDL2:master Oct 10, 2021
@potatotech potatotech deleted the undocumented-controller-buttons branch October 10, 2021 17:39
@potatotech
Copy link
Contributor Author

I neglected to update the changelog in the PR. Since this adds new enum variants, should this be considered a breaking change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unhandled game controller button events cause a panic Panic triggered by PS4 controller touch-pad button
2 participants