]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/uiaction.cpp
missing commit
[wxWidgets.git] / src / msw / uiaction.cpp
index 09ae5f829673cfce9bff196886cf1857de603b98..5aff359052527b1f53867bc8eec7a167997de887 100644 (file)
 
 #if wxUSE_UIACTIONSIMULATOR
 
+#ifndef WX_PRECOMP
+    #include "wx/msw/private.h"             // For wxGetCursorPosMSW()
+#endif
+
 #include "wx/uiaction.h"
 #include "wx/msw/wrapwin.h"
 
@@ -61,8 +65,8 @@ bool wxUIActionSimulator::MouseMove(long x, long y)
     int displayx, displayy;
     wxDisplaySize(&displayx, &displayy);
 
-    int scaledx = wxRound(((float)x / displayx) * 65535);
-    int scaledy = wxRound(((float)y / displayy) * 65535);
+    int scaledx = ceil((float)x * 65535.0 / (displayx-1));
+    int scaledy = ceil((float)y * 65535.0 / (displayy-1));
     mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, scaledx, scaledy, 0, 0);
 
     return true;