-
Notifications
You must be signed in to change notification settings - Fork 35
Handle multiple mouse event types in common.rs #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where mouse movements during drag operations on macOS weren't being reported. The fix extends the pattern matching in the event conversion logic to handle drag events as mouse movement events.
Key changes:
- Extended pattern matching to treat
LeftMouseDragged,RightMouseDragged, andOtherMouseDraggedevents asMouseMoveevents
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
| CGEventType::MouseMoved => { | ||
| CGEventType::MouseMoved | CGEventType::LeftMouseDragged | CGEventType::RightMouseDragged | CGEventType::OtherMouseDragged => { |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new behavior of treating drag events as mouse move events lacks test coverage. Consider adding tests that verify LeftMouseDragged, RightMouseDragged, and OtherMouseDragged events are correctly converted to EventType::MouseMove, similar to the existing MouseMove tests in tests/listen_and_simulate.rs.
| } | ||
| } | ||
| CGEventType::MouseMoved => { | ||
| CGEventType::MouseMoved | CGEventType::LeftMouseDragged | CGEventType::RightMouseDragged | CGEventType::OtherMouseDragged => { |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event mask kCGEventMaskForAllEvents is missing OtherMouseDragged. While this line correctly handles OtherMouseDragged events in the conversion logic, these events will never be received because they're not registered in the event mask. Add + (1 << CGEventType::OtherMouseDragged as u64) after line 71 in the event mask definition to ensure these events are captured.
|
I can verify that
This suggestion may make sense. My mouse does not produce This is a minor point. In any case, the PR LGTM. By the way, |
Without this fix, mouse movements during drag on osx aren't reported.