macOS raw mouse woes

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:

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 ), 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.
  • semi-undocumented
  • The 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?

either reading USB events with IOHIDManager

I believe you can still get at these in the sandbox, if you have the entitlement, but I haven’t tried.

Maybe we can ping an Apple engineer about this issue; I’m okay if the existing APIs become non-starters, as long as there is something they recommend in replacement.

Just a small update, nothing changed with macOS 10.13 - the trackpad of my MacBookPro10,1 (15" retina mid 2012) still doesn’t produce any events through the IOHIDManager API’s. External USB mice do, though.