mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 20:08:13 +00:00
Fixed relative mouse motion over remote desktop
Setting the cursor clip area to a single pixel prevents the relative mouse motion remote desktop warping from working, so the mouse is never recentered. (cherry picked from commitdaffe02b11
) (cherry picked from commitad09976eca
)
This commit is contained in:
@@ -1325,14 +1325,16 @@ WIN_UpdateClipCursor(SDL_Window *window)
|
|||||||
(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
||||||
if (mouse->relative_mode && !mouse->relative_mode_warp && data->mouse_relative_mode_center) {
|
if (mouse->relative_mode && !mouse->relative_mode_warp && data->mouse_relative_mode_center) {
|
||||||
if (GetWindowRect(data->hwnd, &rect)) {
|
if (GetWindowRect(data->hwnd, &rect)) {
|
||||||
|
/* WIN_WarpCursor() jitters by +1, and remote desktop warp wobble is +/- 1 */
|
||||||
|
LONG remote_desktop_adjustment = GetSystemMetrics(SM_REMOTESESSION) ? 2 : 0;
|
||||||
LONG cx, cy;
|
LONG cx, cy;
|
||||||
|
|
||||||
cx = (rect.left + rect.right) / 2;
|
cx = (rect.left + rect.right) / 2;
|
||||||
cy = (rect.top + rect.bottom) / 2;
|
cy = (rect.top + rect.bottom) / 2;
|
||||||
|
|
||||||
/* Make an absurdly small clip rect */
|
/* Make an absurdly small clip rect */
|
||||||
rect.left = cx;
|
rect.left = cx - remote_desktop_adjustment;
|
||||||
rect.right = cx + 1;
|
rect.right = cx + 1 + remote_desktop_adjustment;
|
||||||
rect.top = cy;
|
rect.top = cy;
|
||||||
rect.bottom = cy + 1;
|
rect.bottom = cy + 1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user