From 05bd5e990707fbf88c3bea53124ee611cfc60357 Mon Sep 17 00:00:00 2001 From: C-o-r-E Date: Sat, 4 May 2013 16:29:22 -0400 Subject: [PATCH] xfreerdp-client: proper scaling of input --- client/X11/xf_event.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index 3303b6ef1..2c670d43a 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -151,6 +151,13 @@ static BOOL xf_event_MotionNotify(xfInfo* xfi, XEvent* event, BOOL app) RootWindowOfScreen(xfi->screen), x, y, &x, &y, &childWindow); } + + /* Take scaling in to consideration */ + if(xfi->scale != 1.0) + { + x = (int)(x * (1.0 / xfi->scale) ); + y = (int)(y * (1.0 / xfi->scale) ); + } input->MouseEvent(input, PTR_FLAGS_MOVE, x, y); @@ -253,8 +260,16 @@ static BOOL xf_event_ButtonPress(xfInfo* xfi, XEvent* event, BOOL app) XTranslateCoordinates(xfi->display, event->xbutton.window, RootWindowOfScreen(xfi->screen), x, y, &x, &y, &childWindow); + } + /* Take scaling in to consideration */ + if(xfi->scale != 1.0) + { + x = (int)(x * (1.0 / xfi->scale) ); + y = (int)(y * (1.0 / xfi->scale) ); + } + if (extended) input->ExtendedMouseEvent(input, flags, x, y); else @@ -338,6 +353,13 @@ static BOOL xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, BOOL app) x, y, &x, &y, &childWindow); } + /* Take scaling in to consideration */ + if(xfi->scale != 1.0) + { + x = (int)(x * (1.0 / xfi->scale) ); + y = (int)(y * (1.0 / xfi->scale) ); + } + if (extended) input->ExtendedMouseEvent(input, flags, x, y); else