X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0c03f52d02470366a1b1370d918fa5779997e7f0..abd474ea63667f727940a009cc3e0b23ba9f418f:/src/msw/uiaction.cpp?ds=sidebyside diff --git a/src/msw/uiaction.cpp b/src/msw/uiaction.cpp index eb5bfd1e34..e8c7d94df8 100644 --- a/src/msw/uiaction.cpp +++ b/src/msw/uiaction.cpp @@ -20,6 +20,8 @@ #include "wx/msw/private/keyboard.h" +#include "wx/math.h" + namespace { @@ -56,11 +58,13 @@ bool wxUIActionSimulator::MouseMove(long x, long y) { // Because MOUSEEVENTF_ABSOLUTE takes measurements scaled between 0 & 65535 // we need to scale our input too - int displayx, displayy, scaledx, scaledy; + int displayx, displayy; wxDisplaySize(&displayx, &displayy); - scaledx = ((float)x / displayx) * 65535; - scaledy = ((float)y / displayy) * 65535; + + int scaledx = wxRound(((float)x / displayx) * 65535); + int scaledy = wxRound(((float)y / displayy) * 65535); mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, scaledx, scaledy, 0, 0); + return true; }