all repos — mgba @ b909575a6cb2aa669e4086c2d4e21bcc635e85b5

mGBA Game Boy Advance Emulator

Qt: Fix initial window size (fixes #766)
Vicki Pfau vi@endrift.com
Fri, 30 Jun 2017 11:24:50 -0700
commit

b909575a6cb2aa669e4086c2d4e21bcc635e85b5

parent

4d3d579cae5c96bfc2e70c62b0266c2ad16fff08

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

jump to
M CHANGESCHANGES

@@ -150,6 +150,7 @@ 0.6 beta 2: (Future)

Bugfixes: - Qt: Fix memory search close button (fixes mgba.io/i/769) - Qt: Fix window icon being stretched + - Qt: Fix initial window size (fixes mgba.io/i/766) Misc: - Qt: Add language selector
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -85,7 +85,11 @@ m_logo = m_logo; // Free memory left over in old pixmap

m_screenWidget->setMinimumSize(m_display->minimumSize()); m_screenWidget->setSizePolicy(m_display->sizePolicy()); - int i = 2; +#if defined(M_CORE_GBA) + float i = 2; +#elif defined(M_CORE_GB) + float i = 3; +#endif QVariant multiplier = m_config->getOption("scaleMultiplier"); if (!multiplier.isNull()) { m_savedScale = multiplier.toInt();

@@ -119,8 +123,11 @@ QPair<QString, QString> path = m_libraryView->selectedPath();

m_controller->loadGame(output, path.second, path.first); } }); -#elif defined(M_CORE_GBA) - m_screenWidget->setSizeHint(QSize(VIDEO_HORIZONTAL_PIXELS * i, VIDEO_VERTICAL_PIXELS * i)); +#endif +#if defined(M_CORE_GBA) + resizeFrame(QSize(VIDEO_HORIZONTAL_PIXELS * i, VIDEO_VERTICAL_PIXELS * i)); +#elif defined(M_CORE_GB) + resizeFrame(QSize(GB_VIDEO_HORIZONTAL_PIXELS * i, GB_VIDEO_VERTICAL_PIXELS * i)); #endif m_screenWidget->setPixmap(m_logo); m_screenWidget->setLockAspectRatio(m_logo.width(), m_logo.height());

@@ -233,9 +240,6 @@ }

void Window::resizeFrame(const QSize& size) { QSize newSize(size); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) - newSize /= m_screenWidget->devicePixelRatioF(); -#endif m_screenWidget->setSizeHint(newSize); newSize -= m_screenWidget->size(); newSize += this->size();