#if wxUSE_UIACTIONSIMULATOR
+#ifndef WX_PRECOMP
+ #include "wx/msw/private.h" // For wxGetCursorPosMSW()
+#endif
+
#include "wx/uiaction.h"
#include "wx/msw/wrapwin.h"
bool wxUIActionSimulator::MouseDown(int button)
{
POINT p;
- GetCursorPos(&p);
+ wxGetCursorPosMSW(&p);
mouse_event(EventTypeForMouseButton(button, true), p.x, p.y, 0, 0);
return true;
}
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;
bool wxUIActionSimulator::MouseUp(int button)
{
POINT p;
- GetCursorPos(&p);
+ wxGetCursorPosMSW(&p);
mouse_event(EventTypeForMouseButton(button, false), p.x, p.y, 0, 0);
return true;
}