Skip to content

Commit 0343215

Browse files
authored
Merge pull request #711 from go-vgo/bitmap-pr
Refactor: simplify mouse movement implementation for Windows
2 parents e924f25 + 6a1f060 commit 0343215

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

mouse/mouse_c.h

+1-19
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,7 @@ void moveMouse(MMPointInt32 point){
9696

9797
XSync(display, false);
9898
#elif defined(IS_WINDOWS)
99-
// Mouse motion is now done using SendInput with MOUSEINPUT.
100-
// We use Absolute mouse positioning
101-
#define MOUSE_COORD_TO_ABS(coord, width_or_height) ( \
102-
((65536 * coord) / width_or_height) + (coord < 0 ? -1 : 1))
103-
104-
MMRectInt32 rect = getScreenRect(1);
105-
int32_t x = MOUSE_COORD_TO_ABS(point.x - rect.origin.x, rect.size.w);
106-
int32_t y = MOUSE_COORD_TO_ABS(point.y - rect.origin.y, rect.size.h);
107-
108-
INPUT mouseInput;
109-
mouseInput.type = INPUT_MOUSE;
110-
mouseInput.mi.dx = x;
111-
mouseInput.mi.dy = y;
112-
mouseInput.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK;
113-
mouseInput.mi.time = 0; // System will provide the timestamp
114-
115-
mouseInput.mi.dwExtraInfo = 0;
116-
mouseInput.mi.mouseData = 0;
117-
SendInput(1, &mouseInput, sizeof(mouseInput));
99+
SetCursorPos(point.x, point.y);
118100
#endif
119101
}
120102

0 commit comments

Comments
 (0)