Qt: Restore maximized state when starting (fixes #487)

This commit is contained in:
Vicki Pfau 2021-04-17 17:41:17 -07:00
parent a7c451708f
commit e6fb9f44a7
2 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,7 @@ Other fixes:
- Qt: Fix smudged window icon on Windows
- Qt: Fix saving settings enabling camera when camera name changes (fixes mgba.io/i/2125)
- Qt: Fix frames getting backlogged (fixes mgba.io/i/2122)
- Qt: Restore maximized state when starting (fixes mgba.io/i/487)
Misc:
- Core: Truncate preloading ROMs that slightly exceed max size (fixes mgba.io/i/2093)
- GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks

View File

@ -668,6 +668,7 @@ void Window::showEvent(QShowEvent* event) {
m_wasOpened = true;
resizeFrame(m_screenWidget->sizeHint());
QVariant windowPos = m_config->getQtOption("windowPos");
bool maximized = m_config->getQtOption("maximized").toBool();
QRect geom = windowHandle()->screen()->availableGeometry();
if (!windowPos.isNull() && geom.contains(windowPos.toPoint())) {
move(windowPos.toPoint());
@ -676,6 +677,9 @@ void Window::showEvent(QShowEvent* event) {
rect.moveCenter(geom.center());
move(rect.topLeft());
}
if (maximized) {
showMaximized();
}
if (m_fullscreenOnStart) {
enterFullScreen();
m_fullscreenOnStart = false;
@ -700,6 +704,7 @@ void Window::hideEvent(QHideEvent* event) {
void Window::closeEvent(QCloseEvent* event) {
emit shutdown();
m_config->setQtOption("windowPos", pos());
m_config->setQtOption("maximized", isMaximized());
if (m_savedScale > 0) {
m_config->setOption("height", GBA_VIDEO_VERTICAL_PIXELS * m_savedScale);