Fix Universal Control support#1779
Conversation
…urces The previous attempt (865db46) removed someDeviceHas* guards from SwitchMaster but missed three critical blockers: 1. Scroll.m: eventTapCallback filtered scrollPhase != 0, which discards ALL Universal Control scroll events (UC relays trackpad gestures with phase data that real scroll wheels never have). Fix: skip the scrollPhase filter when CGEventGetSendingDevice returns NULL (virtual input source). 2. ButtonInputReceiver.m: NULL sendingDev caused immediate pass-through, so button remapping never happened for UC events. The NO_FILTER macro that would have handled this was never defined despite comments saying it should be on. Fix: always use strangeDevice for unknown sources. 3. SwitchMaster.swift: all toggle functions still had someDeviceHas* guards (v1 only removed some). Fix: remove all guards — event taps that receive no events consume zero CPU. 4. DeviceManager.m: default maxButtonNumberAmongDevices to 5 when no physical devices are attached. 5. Scroll.m heavyProcessing: remove assert(sendingDev != NULL) that would crash on UC events in pre-release builds. Fixes: noah-nuebling#803, noah-nuebling#1235, noah-nuebling#554, noah-nuebling#526, noah-nuebling#365, noah-nuebling#277 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@noah-nuebling Hi Noah! I hope it's OK that I sent an AI-generated PR. Bascially, the point is to make MMF work on the second mac, connected via Universal Control. I can't properly test it on my local mac. |
|
Hey Noah, gentle bump on this. 👋 I wasn't able to test at runtime because building without your signing identity means the Helper can't register as a login agent ( Is there a recommended workflow for contributors to test locally? E.g. a way to bypass the login item registration for dev builds, or should I just sign up for a free Apple Developer account and use automatic signing with my own team ID? Happy to adjust anything in the PR if you have feedback on the approach. |
Summary
Mac Mouse Fix doesn't work on the receiving Mac when using Universal Control (or other virtual input sources like screen sharing, VMs). This PR fixes three root causes:
Scroll events filtered out —
Scroll.m:eventTapCallbackfiltersscrollPhase != 0, which discards ALL Universal Control scroll events. UC relays trackpad gestures that carry phase data real scroll wheels never have. Fix: skip thescrollPhasefilter whenCGEventGetSendingDevicereturns NULL (virtual input source).Button events pass through unprocessed —
ButtonInputReceiver.mreturns immediately whensendingDevis NULL, so button remapping never happens for UC events. TheNO_FILTERmacro that would handle this was never defined despite comments saying it should be on ("We're leaving NO_FILTER on for now, because I can't really think of a good reason to filter"). Fix: always use[Device strangeDevice]for unknown sources.Event taps disabled without physical device — All
someDeviceHas*guards inSwitchMaster.swiftprevent taps from enabling when no IOHIDDevice is attached. Fix: remove these guards. Event taps that receive no events consume zero CPU.Additionally:
DeviceManager.m: defaultmaxButtonNumberAmongDevicesto 5 when no physical devices are attachedScroll.m: removeassert(sendingDev != NULL)that crashes on UC events in pre-release buildsFiles changed
Helper/Core/Scroll/Scroll.mHelper/Core/Buttons/ButtonInputReceiver.mHelper/Core/Coordinate/SwitchMaster.swiftsomeDeviceHas*guards from toggle functionsShared/Devices/DeviceManager.mTesting
com.nuebling.mac-mouse-fix)Issues
Fixes #277, #365, #526, #554, #803, #1235
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com