pen: fix buttons incorrectly mapped on linux backends#15556
Open
LordCarve wants to merge 2 commits into
Open
Conversation
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.
Description
On linux backends (both X11 and Wayland) the pen-to-mouse remapping applied in
SDL_pen.cconfused RMB with MMB by hardcoding RMB to button 2 and MMB to button 3 (windows-canon).Erroneous flows:
Since which pen button corresponds to which mouse button is backend-dependent, this information should be passed from backend into
SDL_SendPenButton()and so its signature has been extended withUint8 mouse_button(withbuttonrenamed topen_buttonfor clarity).Now in pen-as-mouse scenarios backend has full control over which mouse button is used in mouse events, and it leverages that to pass the correct per-backend mouse buttons.
As a result, the bug of RMB<->MMB being mixed-up on linux backends is resolved.
For other backends I maintained the exact pen-to-mouse button mappings as they were before (including the edge-case of android's pen button 5 sending a pen event but explicitly not sending a mouse event). This is to avoid regression because I can't test any other backends.
I tested X11 and Wayland, and this addresses the underlying issue.
Existing Issue(s)
Fixes #14788