mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-19 13:59:10 +08:00
[fix] use relative percentage-based mouse mapping instead of absolute positions
This commit is contained in:
@@ -12,19 +12,14 @@ int MouseController::Init(int screen_width, int screen_height) {
|
||||
screen_width_ = screen_width;
|
||||
screen_height_ = screen_height;
|
||||
|
||||
pixel_width_ =
|
||||
CGDisplayModeGetPixelWidth(CGDisplayCopyDisplayMode(CGMainDisplayID()));
|
||||
pixel_height_ =
|
||||
CGDisplayModeGetPixelHeight(CGDisplayCopyDisplayMode(CGMainDisplayID()));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MouseController::Destroy() { return 0; }
|
||||
|
||||
int MouseController::SendMouseCommand(RemoteAction remote_action) {
|
||||
int mouse_pos_x = remote_action.m.x * screen_width_ / pixel_width_;
|
||||
int mouse_pos_y = remote_action.m.y * screen_height_ / pixel_height_;
|
||||
int mouse_pos_x = remote_action.m.x * screen_width_;
|
||||
int mouse_pos_y = remote_action.m.y * screen_height_;
|
||||
|
||||
if (remote_action.type == ControlType::mouse) {
|
||||
CGEventRef mouse_event = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user