fix(macOS): correct right and middle mouse drag handling - #95
Merged
ReenigneArcher merged 2 commits intoAug 20, 2026
Merged
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
ReenigneArcher
force-pushed
the
fix-macos-right-mouse-drag
branch
from
August 20, 2026 17:57
486c608 to
3ee1afb
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #95 +/- ##
==========================================
- Coverage 75.47% 75.47% -0.01%
==========================================
Files 34 34
Lines 8131 8133 +2
Branches 3044 3044
==========================================
+ Hits 6137 6138 +1
- Misses 1660 1715 +55
+ Partials 334 280 -54
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 11 files with indirect coverage changes Continue to review full report in Codecov by Harness.
|
Refactor the two private methods `button_for_current_buttons` and `event_for_current_buttons` into a single free function `macos_mouse_motion`, exposing it via test hooks and adding unit tests for all button-state combinations.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes macOS right and middle mouse drag handling in the CoreGraphics mouse backend.
I encountered an issue while using Sunshine as a macOS host with Moonlight as the client where a normal right-click worked, but holding the right mouse button while moving the mouse did not behave correctly.
The macOS backend tracks mouse button state with index 0 as left, 1 as right, and 2 as middle. However,
event_type_for_current_buttons()mapped the right button tokCGEventOtherMouseDraggedand the middle button tokCGEventRightMouseDragged.This change corrects those mappings so that:
kCGEventRightMouseDraggedkCGEventOtherMouseDraggedIt also adds selection of the currently held mouse button for relative and absolute mouse movement. Previously these movement events always passed
kCGMouseButtonLefttopost_mouse(), even when the right or middle button was being held.I tested the change using Sunshine on macOS with Moonlight as the client. Before the change, right-click worked but right-click-and-hold with mouse movement did not work correctly.
Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage
See our AI usage policy.