MainWindow: Initialize geometries before calling GetWindowSystemInfo.

On Windows:
wsi.render_window being set will set/save the initial geometry, which will cause sizing bugs until it's set again by the user resizing/repositioning.
This commit is contained in:
TryTwo 2024-05-22 21:08:26 -07:00
parent e0e09d1074
commit 564d4c3c25

View File

@ -227,8 +227,6 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters,
setAcceptDrops(true);
setAttribute(Qt::WA_NativeWindow);
InitControllers();
CreateComponents();
ConnectGameList();
@ -237,6 +235,13 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters,
ConnectRenderWidget();
ConnectStack();
ConnectMenuBar();
QSettings& settings = Settings::GetQSettings();
restoreState(settings.value(QStringLiteral("mainwindow/state")).toByteArray());
restoreGeometry(settings.value(QStringLiteral("mainwindow/geometry")).toByteArray());
show();
InitControllers();
ConnectHotkeys();
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
@ -289,11 +294,6 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters,
m_state_slot =
std::clamp(Settings::Instance().GetStateSlot(), 1, static_cast<int>(State::NUM_STATES));
QSettings& settings = Settings::GetQSettings();
restoreState(settings.value(QStringLiteral("mainwindow/state")).toByteArray());
restoreGeometry(settings.value(QStringLiteral("mainwindow/geometry")).toByteArray());
m_render_widget_geometry = settings.value(QStringLiteral("renderwidget/geometry")).toByteArray();
// Restoring of window states can sometimes go wrong, resulting in widgets being visible when they