all repos — mgba @ 1f899737d9825f60e6713fed4ff6d368dda32e56

mGBA Game Boy Advance Emulator

Qt: Windows no longer spawn in the top left on first launch
Jeffrey Pfau jeffrey@endrift.com
Mon, 17 Aug 2015 23:03:20 -0700
commit

1f899737d9825f60e6713fed4ff6d368dda32e56

parent

46cf812db35b980cfffcaf2936c05b1b571df5c5

2 files changed, 11 insertions(+), 5 deletions(-)

jump to
M CHANGESCHANGES

@@ -1,4 +1,6 @@

0.4.0: (Future) +Bugfixes: + - Qt: Windows no longer spawn in the top left on first launch Misc: - Qt: Window size command line options are now supported - Qt: Increase usability of key mapper
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -5,6 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this

* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "Window.h" +#include <QDesktopWidget> #include <QKeyEvent> #include <QKeySequence> #include <QMenuBar>

@@ -87,11 +88,6 @@ m_screenWidget->setSizeHint(m_display->minimumSize() * 2);

m_screenWidget->setPixmap(m_logo); m_screenWidget->setLockAspectRatio(m_logo.width(), m_logo.height()); setCentralWidget(m_screenWidget); - - QVariant windowPos = m_config->getQtOption("windowPos"); - if (!windowPos.isNull()) { - move(windowPos.toPoint()); - } connect(m_controller, SIGNAL(gameStarted(GBAThread*)), this, SLOT(gameStarted(GBAThread*))); connect(m_controller, SIGNAL(gameStarted(GBAThread*)), &m_inputController, SLOT(suspendScreensaver()));

@@ -465,6 +461,14 @@ }

void Window::showEvent(QShowEvent* event) { resizeFrame(m_screenWidget->sizeHint().width(), m_screenWidget->sizeHint().height()); + QVariant windowPos = m_config->getQtOption("windowPos"); + if (!windowPos.isNull()) { + move(windowPos.toPoint()); + } else { + QRect rect = frameGeometry(); + rect.moveCenter(QApplication::desktop()->availableGeometry().center()); + move(rect.topLeft()); + } } void Window::closeEvent(QCloseEvent* event) {