From e058967ddd59ea612afb939558740d2ee2051c2a Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Tue, 12 Oct 2021 09:26:21 +0200 Subject: [PATCH] fix positioning of invisible window (see #833) --- src/common/FBBackendSDL2.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/FBBackendSDL2.cxx b/src/common/FBBackendSDL2.cxx index c1204065e..566d9d713 100644 --- a/src/common/FBBackendSDL2.cxx +++ b/src/common/FBBackendSDL2.cxx @@ -231,7 +231,7 @@ bool FBBackendSDL2::setVideoMode(const VideoModeHandler::Mode& mode, const bool fullScreen = mode.fsIndex != -1; bool forceCreateRenderer = false; - Int32 displayIndex = std::min(myNumDisplays, winIdx); + Int32 displayIndex = std::min(myNumDisplays - 1, winIdx); int posX, posY; @@ -244,9 +244,9 @@ bool FBBackendSDL2::setVideoMode(const VideoModeHandler::Mode& mode, posY = winPos.y; // Make sure the window is at least partially visibile - int x0 = 0, y0 = 0, x1 = 0, y1 = 0; + int x0 = INT_MAX, y0 = INT_MAX, x1 = 0, y1 = 0; - for(int display = SDL_GetNumVideoDisplays() - 1; display >= 0; --display) + for(int display = myNumDisplays - 1; display >= 0; --display) { SDL_Rect rect;