WIP: fix(input): Mouse 4 and Mouse 5 can be bound on Linux #1172
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1172
Loading…
Reference in a new issue
No description provided.
Delete branch "TrashPanda/Longshot:fix/linux-mouse-4-5"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: fix · Risk: low · Tested on: Linux, RTX 4070 Ti (game-free checks) · Needs: Linux, a mouse with side buttons
Why
On Linux the Controls page offers Mouse 4 and Mouse 5, but the side buttons were never seen, so binding one did nothing and a saved binding to one never acted. Windows has them.
Restored from Hookshot 2961, by jarynclouatre, and split out of #286 so it can be reviewed and merged on its own.
How to reproduce
Seen on: Linux, a mouse with side buttons
Settings and switches: defaults
Steps: in Controls, bind an action to Mouse 4
Expected: the side button is taken
Actual: the listener never sees it
What changed
keys_updateinhost/posix/display_sdl.csetsVK_XBUTTON1andVK_XBUTTON2from SDL's X1 and X2 bits, andhost/posix/windows.hdefines them.Commits, each with its original author and message:
944e4ceffix(input): Mouse 4 and Mouse 5 can be bound on Linux (jarynclouatre)On Linux,
keys_updateinhost/posix/display_sdl.cturned three ofSDL's five mouse buttons into virtual keys. The Controls page offers
Mouse 4 and Mouse 5 (0x05 and 0x06), and
host/nn_hid.creads them, buton Linux the listener never saw a side button, and a saved binding to
one (
key_zl=5,0) never acted. Windows has them.Change
keys_updatealso setsVK_XBUTTON1from SDL's X1 bit (8) andVK_XBUTTON2from X2 (16). The bits are the same in SDL 2 and SDL 3,and
hos_sdl_mouse_buttonspasses SDL's mask through unchanged.host/posix/windows.hdefinesVK_XBUTTON1andVK_XBUTTON2besidethe other mouse keys (
nn_hid.c's own definitions are under#ifndef).Testing
tests/test_sdl_mouse_buttons.py(new):keys_updateand the posixvirtual keys cut from the sources, built with stand-ins for SDL. Each of
SDL's five button bits sets only its own key (5 and 6 for the side
buttons), both side buttons together set both, and nothing is set
without a window. It fails on main (keys 5 and 6 stay 0) and passes
here.
(
test_bake_portability:zstandard;nx2/test_texture_init_barrier.py:clang++); both fail the same onmain.
Restored-from: https://github.com/NotRexed/Hookshot/pull/2961
Measurements
Verdict: nothing to measure: a correctness fix off the frame path, covered by game-free checks.
Flags and settings
None.
Testing
Tested: On Linux (kernel 7.0), RTX 4070 Ti,
main@71b1edd8, this PR @944e4cef:tests/test_sdl_mouse_buttons.pypass. The full suite (tests/run_all.py) has not been run on this branch yet; a comment will follow when it has.Not tested: Pressing a side button in the game on Linux. Opened as work in progress until it runs in the game.
Must be tested:
Risks
What could break: mouse buttons on Linux.
Turning it off: revert the commit.
Compatibility: Nothing changes.
Checklist
Everyone
type(scope): description) of the status line's type.main.third_party/untouched (a new folder with aPROVENANCE.mdinstead).python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).When it applies
mainand passing here.Tested in game: Linux (Ubuntu 26.04.1, kernel 7.0.0-43), RTX 4070 Ti 12 GB, NVIDIA 595.99.02, Ryzen 7 9800X3D: this branch built together with the other 18 split from #218 and #284-#288, merged onto main @
71b1edd8(make_game.py --update, build v3.0.0-rc.5-82-g5952bb3d), then played by a scripted tour through the control bridge (scripts/memtour.py: a save loaded, Zora's Domain, the Market, Hyrule Field and Death Mountain Trail, 40 s each with walking and camera swings). All 4 stops reached, a clean quit, and no device loss or Vulkan error in the log. Only scripted input ran; binding Mouse 4 and 5 in Controls was not tried by hand.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.