Handle multiple mouse event types in common.rs#18
Handle multiple mouse event types in common.rs#18sje397 wants to merge 1 commit intorustdesk-org:masterfrom
Conversation
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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.