From 228b9fb5178405138775db55b28a6b6e787d8ce0 Mon Sep 17 00:00:00 2001
From: xeonmc <[EMAIL REDACTED]>
Date: Wed, 14 Sep 2022 03:43:16 +0800
Subject: [PATCH] Update SDL_windowswindow.c (#6225)
Clip rectangle set to int(left+width/2) , int(top+height/2) , int(left+width/2)+1 , int(top+height/2)+1
a 1x1 box
On even-valued resolution, cursor is stable at bottom-right central pixel
On odd-valued resolution, cursor is stable at exact central pixel.
this is the desired behaviour
---
src/video/windows/SDL_windowswindow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index 991ef0ebe3b..77417b28d3f 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -1309,9 +1309,9 @@ WIN_UpdateClipCursor(SDL_Window *window)
cy = (rect.top + rect.bottom) / 2;
/* Make an absurdly small clip rect */
- rect.left = cx - 1;
+ rect.left = cx;
rect.right = cx + 1;
- rect.top = cy - 1;
+ rect.top = cy;
rect.bottom = cy + 1;
if (SDL_memcmp(&rect, &clipped_rect, sizeof(rect)) != 0) {