mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-08 06:31:50 +08:00
fixed bugs in mouse motion. wasn't taking care to capture all
motion events relative to the previous mouse position. for example, if two mouse events arrive, the first at x+1,y and the second at x+2,y, we used to compute deltas of 1,0 and 2,0 instead of 1,0 and 1,0. that's fixed. also worked around a bug (probably) in windows that caused a motion event after a SetCursorPos() to be lost or reported one pixel off from the correct position. now using mouse_event() which doesn't have that problem. also fixed calculation of normalized coordinates for mouse_event() when there are multiple displays.
This commit is contained in:
@@ -342,8 +342,8 @@ CMSWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
|
||||
SInt32 x0, y0, w, h;
|
||||
getScreenShape(x0, y0, w, h);
|
||||
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
||||
(SInt32)(65535.99 * x / (w - 1)) + x0,
|
||||
(SInt32)(65535.99 * y / (h - 1)) + y0,
|
||||
(DWORD)((65535.99 * (x - x0)) / (w - 1)),
|
||||
(DWORD)((65535.99 * (y - y0)) / (h - 1)),
|
||||
0, 0);
|
||||
}
|
||||
|
||||
@@ -560,8 +560,8 @@ CMSWindowsSecondaryScreen::onEnter(SInt32 x, SInt32 y)
|
||||
SInt32 x0, y0, w, h;
|
||||
getScreenShape(x0, y0, w, h);
|
||||
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
||||
(DWORD)((65535.99 * x) / (w - 1)) + x0,
|
||||
(DWORD)((65535.99 * y) / (h - 1)) + y0,
|
||||
(DWORD)((65535.99 * (x - x0)) / (w - 1)),
|
||||
(DWORD)((65535.99 * (y - y0)) / (h - 1)),
|
||||
0, 0);
|
||||
|
||||
// show cursor
|
||||
|
||||
Reference in New Issue
Block a user