From 14c6bba21f7f018035ad017c8a6d771a94243d18 Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Thu, 9 Dec 2021 01:21:06 +0100 Subject: Manually center the window after setting its size on macOS Qt's default window positioning is somewhat unreliable, and since we don't currently remember the window position, let's at least make sure that it's properly centered on open. --- src/frontend/qt_sdl/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 0447cbb..332e3e1 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -1566,6 +1566,13 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) resize(Config::WindowWidth, Config::WindowHeight); +#ifdef Q_OS_MAC + QPoint screenCenter = screen()->availableGeometry().center(); + QRect frameGeo = frameGeometry(); + frameGeo.moveCenter(screenCenter); + move(frameGeo.topLeft()); +#endif + if (oldMax) showMaximized(); else -- cgit v1.2.3