Round the values instead of truncating them when converting from pixel values
to Win32 ::mouse_event() 0..65535 scale. This probably doesn't make any real
difference in practice but seems more correct and also avoids g++ warnings.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67963
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/msw/private/keyboard.h"
#include "wx/msw/private/keyboard.h"
{
// Because MOUSEEVENTF_ABSOLUTE takes measurements scaled between 0 & 65535
// we need to scale our input too
{
// 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);
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);
mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, scaledx, scaledy, 0, 0);