Fix absolute mouse coordinates with multiple monitors on Windows

This commit is contained in:
loki
2021-06-23 21:51:15 +02:00
parent 029194cb60
commit 926e95f527
4 changed files with 41 additions and 27 deletions

View File

@@ -123,8 +123,8 @@ void abs_mouse(input_t &input, const touch_port_t &touch_port, float x, float y)
// MOUSEEVENTF_VIRTUALDESK maps to the entirety of the desktop rather than the primary desktop
MOUSEEVENTF_VIRTUALDESK;
auto scaled_x = std::lround((x + touch_port.offset_x) * ((float)target_touch_port.width / (float)touch_port.width));
auto scaled_y = std::lround((y + touch_port.offset_y) * ((float)target_touch_port.height / (float)touch_port.height));
auto scaled_x = std::lround((x + touch_port.offset_x) * ((float)target_touch_port.env_width / (float)touch_port.env_width));
auto scaled_y = std::lround((y + touch_port.offset_y) * ((float)target_touch_port.env_height / (float)touch_port.env_height));
mi.dx = scaled_x;
mi.dy = scaled_y;