diff options
Diffstat (limited to 'remoting/host/event_executor_win.cc')
-rw-r--r-- | remoting/host/event_executor_win.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/remoting/host/event_executor_win.cc b/remoting/host/event_executor_win.cc index e9229b2..95da76b 100644 --- a/remoting/host/event_executor_win.cc +++ b/remoting/host/event_executor_win.cc @@ -97,10 +97,14 @@ void EventExecutorWin::HandleMouse(const MouseEvent* event) { INPUT input; input.type = INPUT_MOUSE; input.mi.time = 0; - input.mi.dx = static_cast<int>((x * 65535) / capturer_->width()); - input.mi.dy = static_cast<int>((y * 65535) / capturer_->height()); - input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; - SendInput(1, &input, sizeof(INPUT)); + int screen_width = capturer_->width_most_recent(); + int screen_height = capturer_->height_most_recent(); + if ((screen_width > 0) && (screen_height > 0)) { + input.mi.dx = static_cast<int>((x * 65535) / screen_width); + input.mi.dy = static_cast<int>((y * 65535) / screen_height); + input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; + SendInput(1, &input, sizeof(INPUT)); + } } if (event->has_wheel_offset_x() && event->has_wheel_offset_y()) { |