From d2f756360ea4b1bdfbca63bb60f9fcb3ad573926 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 9 Nov 2021 11:53:59 -0800
Subject: [PATCH] When making the window centered it should use windowed mode
size since it doesn't affect fullscreen windows
Fixes bug https://github.com/libsdl-org/SDL/issues/4750
---
src/video/SDL_video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 516c183f03..573b6afbf0 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -2045,10 +2045,10 @@ SDL_SetWindowPosition(SDL_Window * window, int x, int y)
SDL_GetDisplayBounds(displayIndex, &bounds);
if (SDL_WINDOWPOS_ISCENTERED(x)) {
- x = bounds.x + (bounds.w - window->w) / 2;
+ x = bounds.x + (bounds.w - window->windowed.w) / 2;
}
if (SDL_WINDOWPOS_ISCENTERED(y)) {
- y = bounds.y + (bounds.h - window->h) / 2;
+ y = bounds.y + (bounds.h - window->windowed.h) / 2;
}
}