Skip to content

Fix GCMouse scroll axis mapping on macOS#15376

Open
hollinsky wants to merge 1 commit intolibsdl-org:mainfrom
hollinsky:fix/macos-gcmouse-scroll-axes
Open

Fix GCMouse scroll axis mapping on macOS#15376
hollinsky wants to merge 1 commit intolibsdl-org:mainfrom
hollinsky:fix/macos-gcmouse-scroll-axes

Conversation

@hollinsky
Copy link
Copy Markdown

The scroll valueChangedHandler was treating xValue as vertical and yValue as horizontal, copied from the iOS GCMouse implementation. On macOS, the GCControllerDirectionPad axes follow their documented semantics: xAxis (left/right) is horizontal and yAxis (up/down) is vertical.

Swap the axis assignment so xValue maps to horizontal scroll and yValue maps to vertical scroll.

Tested on macOS 26.3.1, using both the internal trackpad of my MacBook Pro M1 Pro and a wireless USB mouse, and ultimately fixes scrolling for me in Dear ImGui.

The scroll valueChangedHandler was treating xValue as vertical and yValue
as horizontal, copied from the iOS GCMouse implementation. On macOS,
the GCControllerDirectionPad axes follow their documented semantics:
xAxis (left/right) is horizontal and yAxis (up/down) is vertical.

Swap the axis assignment so xValue maps to horizontal scroll and yValue
maps to vertical scroll.
@whrvt
Copy link
Copy Markdown
Contributor

whrvt commented Apr 13, 2026

Something to note: this doesn't respect the "natural scrolling" option in system settings, which is kind of unfortunate. I'm not familiar with these macOS APIs or what to do in this situation myself.

Edit: actually, it seems like there are multiple issues:

  • The Y axis is incorrectly inverted here, causing inverted scrolling in general (so I believe it should just be yValue instead of -yValue here)
  • The initial system "Natural Scrolling" setting isn't taken into account unless it's changed while the application is already running. Separate issue unrelated to this PR and the GCMouse implementation, but caused my initial confusion about the setting not being taken into account at all.

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.

2 participants