X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/906c935a80b10d53cecf57f71ab5f3f4f1d529ec..12bb29f5432174ecbd65549bda832d70d34a98ae:/src/msw/uiaction.cpp diff --git a/src/msw/uiaction.cpp b/src/msw/uiaction.cpp index e8c7d94df8..5aff359052 100644 --- a/src/msw/uiaction.cpp +++ b/src/msw/uiaction.cpp @@ -15,6 +15,10 @@ #if wxUSE_UIACTIONSIMULATOR +#ifndef WX_PRECOMP + #include "wx/msw/private.h" // For wxGetCursorPosMSW() +#endif + #include "wx/uiaction.h" #include "wx/msw/wrapwin.h" @@ -49,7 +53,7 @@ DWORD EventTypeForMouseButton(int button, bool isDown) bool wxUIActionSimulator::MouseDown(int button) { POINT p; - GetCursorPos(&p); + wxGetCursorPosMSW(&p); mouse_event(EventTypeForMouseButton(button, true), p.x, p.y, 0, 0); return true; } @@ -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; @@ -71,7 +75,7 @@ bool wxUIActionSimulator::MouseMove(long x, long y) bool wxUIActionSimulator::MouseUp(int button) { POINT p; - GetCursorPos(&p); + wxGetCursorPosMSW(&p); mouse_event(EventTypeForMouseButton(button, false), p.x, p.y, 0, 0); return true; }