diff options
author | Nicholas Rishel <rishel.nick@gmail.com> | 2021-01-14 01:07:03 +0300 |
---|---|---|
committer | Nicholas Rishel <rishel.nick@gmail.com> | 2021-01-15 23:18:13 +0300 |
commit | 957de39191709da822631dbe0d19829ff995b8c2 (patch) | |
tree | 2fa4a5daa60d2a00edf27cdae38f7e9ff9231186 /intern | |
parent | de60dc84e249b748105649da1a36b721e7f9f6af (diff) |
Fix T84645 cursor moves when clicking selector.
The absolute position desktop mapping has been corrected. The correct
mapping is 0-65535 inclusive. Additionally, division by the virtual
desktop width and height needed to be subtracted by 1 as width and
height are one more than the final pixel index.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index ca4912ff2c5..718ace9db4a 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -541,11 +541,11 @@ GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 input.type = INPUT_MOUSE; input.mi.mouseData = 0; input.mi.time = ::GetTickCount(); - /* Map from virtual screen to 0-65536. */ - input.mi.dx = (x - GetSystemMetrics(SM_XVIRTUALSCREEN)) * 65536 / - GetSystemMetrics(SM_CXVIRTUALSCREEN); - input.mi.dy = (y - GetSystemMetrics(SM_YVIRTUALSCREEN)) * 65536 / - GetSystemMetrics(SM_CYVIRTUALSCREEN); + /* Map from virtual screen to 0-65535 inclusive. */ + input.mi.dx = (x - GetSystemMetrics(SM_XVIRTUALSCREEN)) * 65535 / + (GetSystemMetrics(SM_CXVIRTUALSCREEN) - 1); + input.mi.dy = (y - GetSystemMetrics(SM_YVIRTUALSCREEN)) * 65535 / + (GetSystemMetrics(SM_CYVIRTUALSCREEN) - 1); input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK; SendInput(1, &input, sizeof(input)); |