Skip to content

Conversation

@sje397
Copy link

@sje397 sje397 commented Jan 1, 2026

Without this fix, mouse movements during drag on osx aren't reported.

@rustdesk
Copy link
Collaborator

rustdesk commented Jan 2, 2026

@fufesou

Copy link

Copilot AI left a 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, and OtherMouseDragged events as MouseMove events

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}
CGEventType::MouseMoved => {
CGEventType::MouseMoved | CGEventType::LeftMouseDragged | CGEventType::RightMouseDragged | CGEventType::OtherMouseDragged => {
Copy link

Copilot AI Jan 2, 2026

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.

Copilot uses AI. Check for mistakes.
}
}
CGEventType::MouseMoved => {
CGEventType::MouseMoved | CGEventType::LeftMouseDragged | CGEventType::RightMouseDragged | CGEventType::OtherMouseDragged => {
Copy link

Copilot AI Jan 2, 2026

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.

Copilot uses AI. Check for mistakes.
@fufesou
Copy link

fufesou commented Jan 2, 2026

I can verify that CGEventType::LeftMouseDragged and CGEventType::RightMouseDragged work.

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.

This suggestion may make sense.

My mouse does not produce CGEventType::OtherMouseDragged events by default. Adding + (1 << CGEventType::OtherMouseDragged as u64) enables listening for middle‑button drags as that event type.

This is a minor point. In any case, the PR LGTM.

By the way, RustDesk does not capture mouse events via rdev; it uses Flutter's built-in functions for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants