From f18b1a5e8a379b12932705ad0122757d3252ff88 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 8 Apr 2017 23:33:34 +0200 Subject: [PATCH] When resetting Y, make sure we don't end up outside the screen. See #9563 --- Windows/MainWindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index 3970551aad..66621fca9a 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -407,11 +407,13 @@ namespace MainWindow } // Then center if necessary. One dimension at a time. + // Max is to make sure that if we end up making the window bigger than the screen (which is not ideal), the top left + // corner, and thus the menu etc, will be visible. Also potential workaround for #9563. if (resetPositionX) { - g_Config.iWindowX = (currentScreenWidth - g_Config.iWindowWidth) / 2; + g_Config.iWindowX = std::max(0, (currentScreenWidth - g_Config.iWindowWidth) / 2); } if (resetPositionY) { - g_Config.iWindowY = (currentScreenHeight - g_Config.iWindowHeight) / 2; + g_Config.iWindowY = std::max(0, (currentScreenHeight - g_Config.iWindowHeight) / 2); } RECT rc;