]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/uiaction.cpp
Use the data scheme to load resources in the WebKitGTK+ implementation, rather than...
[wxWidgets.git] / src / msw / uiaction.cpp
index ee59fd0603174501a5f6f440f2716a93c27d7bc2..e8c7d94df88ed826f1ed7cf098b671e54e330b84 100644 (file)
 #if wxUSE_UIACTIONSIMULATOR
 
 #include "wx/uiaction.h"
-#include "wx/window.h" //for wxCharCodeWXToMSW
 #include "wx/msw/wrapwin.h"
 
+#include "wx/msw/private/keyboard.h"
+
+#include "wx/math.h"
+
 namespace
 {
 
@@ -55,11 +58,13 @@ bool wxUIActionSimulator::MouseMove(long x, long y)
 {
     // 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);
-    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);
+
     return true;
 }
 
@@ -75,7 +80,7 @@ bool
 wxUIActionSimulator::DoKey(int keycode, int WXUNUSED(modifiers), bool isDown)
 {
     bool isExtended;
-    DWORD vkkeycode = wxCharCodeWXToMSW(keycode, &isExtended);
+    DWORD vkkeycode = wxMSWKeyboard::WXToVK(keycode, &isExtended);
 
     DWORD flags = 0;
     if ( isExtended )