Skip to content

Commit

Permalink
Qt: Restore maximized state when starting (fixes #487)
Browse files Browse the repository at this point in the history
  • Loading branch information
endrift committed Apr 19, 2021
1 parent 679f36d commit 53b8fdf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,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
Expand Down
5 changes: 5 additions & 0 deletions src/platform/qt/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,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());
Expand All @@ -628,6 +629,9 @@ void Window::showEvent(QShowEvent* event) {
rect.moveCenter(geom.center());
move(rect.topLeft());
}
if (maximized) {
showMaximized();
}
if (m_fullscreenOnStart) {
enterFullScreen();
m_fullscreenOnStart = false;
Expand All @@ -652,6 +656,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);
Expand Down

0 comments on commit 53b8fdf

Please sign in to comment.