Just wanted to make an update on possible ways to get SDL2's relative mouse mode to be raw / unaccelerated on macOS:
It seems like on macOS 10.12, trackpads (at least my 2012 15" rMBP) no longer produce any events through the IOHIDManager API. This breaks my raw mouse patch (which uses
IOHIDManager to listen for the raw mouse deltas), at least for the trackpad. Other people have been reporting the same thing:
- @icculus's ManyMouse library no longer produces events from the trackpad on my mac either, since it uses the same API's
This is really annoying because this seemed like the right way to do raw mouse input on macOS, and IMO it would be a showstopper if relative mouse mode didn't work with the trackpad, so getting mouse deltas from IOHIDManager seems to be a dead end for us now.
We could still look at using the IOHIDSetAccelerationWithKey API's (e.g.: like this http://www.robotplanet.dk/docs/setting_up_your_computer/decelerate_mac_mouse.txt ), but this has several drawbacks:
- these affect all applications / the entire desktop, so you need to be careful to restore the acceleration when SDL loses focus, and it could still break.
NXOpenEventStatus was deprecated in 10.12.
- In my experience it used to be the case that AppKit mouse events were throttled to the display refresh rate and IOHIDManager provided the only way to get e.g. 1000Hz events from a gaming mouse, but in macOS 10.12 I'm now seeing AppKit events arriving at their full rate (e.g. 120Hz for the trackpad on my mac), so this is no longer a disadvantage.
Still, these might be acceptable if there's no other option.
FWIW, we've been using a
IOHIDSetAccelerationWithKey-based hack in Quakespasm for ~5 years now, and not had issues with it, though it's a bit annoying to pause the Xcode debugger and have the unaccelerated mouse input stick around.
Edit: A big open question is, I have no idea on the status of these API's (either reading USB events with IOHIDManager, or the IOHIDSetAccelerationWithKey hack to change acceleration for the entire desktop) for sandboxed / mac app store apps. They seem like the kind of thing that would be blocked, though. Anyone know?