From 9371da0a76d8fcd47792d31af4ffb333025cccc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Fri, 7 Sep 2012 17:22:23 -0400 Subject: [PATCH] wfreerdp-server: fix pointer position --- server/Windows/wf_input.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/server/Windows/wf_input.c b/server/Windows/wf_input.c index 6c28a93cd..a802d2ca2 100644 --- a/server/Windows/wf_input.c +++ b/server/Windows/wf_input.c @@ -65,6 +65,7 @@ void wf_peer_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code) void wf_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) { INPUT mouse_event; + float width, height; ZeroMemory(&mouse_event, sizeof(INPUT)); mouse_event.type = INPUT_MOUSE; @@ -81,12 +82,16 @@ void wf_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) } else { + width = (float) GetSystemMetrics(SM_CXSCREEN); + height = (float) GetSystemMetrics(SM_CYSCREEN); + + mouse_event.mi.dx = (LONG) ((float) x * (65535.0f / width)); + mouse_event.mi.dy = (LONG) ((float) y * (65535.0f / height)); + mouse_event.mi.dwFlags = MOUSEEVENTF_ABSOLUTE; + if (flags & PTR_FLAGS_MOVE) { - mouse_event.mi.dx = x * (0xFFFF / GetSystemMetrics(SM_CXSCREEN)); - mouse_event.mi.dy = y * (0xFFFF / GetSystemMetrics(SM_CYSCREEN)); - mouse_event.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; - + mouse_event.mi.dwFlags |= MOUSEEVENTF_MOVE; SendInput(1, &mouse_event, sizeof(INPUT)); }