X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c6907dcd4129ac374bf582860926fd0038f23f60..be10c7f969bb460dc79bd8946d59bf54c98ac660:/src/msw/uiaction.cpp?ds=sidebyside diff --git a/src/msw/uiaction.cpp b/src/msw/uiaction.cpp index 5aff359052..5308d9c0f1 100644 --- a/src/msw/uiaction.cpp +++ b/src/msw/uiaction.cpp @@ -4,7 +4,6 @@ // Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin // Modified by: // Created: 2010-03-06 -// RCS-ID: $Id$ // Copyright: (c) Kevin Ollivier // (c) 2010 Steven Lamerton // (c) 2010 Vadim Zeitlin @@ -65,8 +64,10 @@ bool wxUIActionSimulator::MouseMove(long x, long y) int displayx, displayy; wxDisplaySize(&displayx, &displayy); - int scaledx = ceil((float)x * 65535.0 / (displayx-1)); - int scaledy = ceil((float)y * 65535.0 / (displayy-1)); + // Casts are safe because x and y are supposed to be less than the display + // size, so there is no danger of overflow. + DWORD scaledx = static_cast(ceil(x * 65535.0 / (displayx-1))); + DWORD scaledy = static_cast(ceil(y * 65535.0 / (displayy-1))); mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, scaledx, scaledy, 0, 0); return true;