all repos — mgba @ 6af4ddefdd3b242e38ac50d780b1e5a5d99e9539

mGBA Game Boy Advance Emulator

Qt: Cap window size to monitor size
Vicki Pfau vi@endrift.com
Fri, 26 Apr 2019 14:53:47 -0700
commit

6af4ddefdd3b242e38ac50d780b1e5a5d99e9539

parent

a32cb5cc5e4fa0f1590725036ca58a490d0f1164

2 files changed, 13 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -41,6 +41,7 @@ - Qt: Improve camera initialization

- Qt: Support switching webcams - Core: Add keysRead callback - Vita: Improved frame drawing speed + - Qt: Cap window size on start to monitor size 0.7.1: (2019-02-24) Bugfixes:
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -5,14 +5,15 @@ * 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> #include <QMessageBox> #include <QMimeData> #include <QPainter> +#include <QScreen> #include <QStackedLayout> +#include <QWindow> #ifdef USE_SQLITE3 #include "ArchiveInspector.h"

@@ -200,6 +201,15 @@ }

void Window::resizeFrame(const QSize& size) { QSize newSize(size); + if (windowHandle()) { + QRect geom = windowHandle()->screen()->availableGeometry(); + if (newSize.width() > geom.width()) { + newSize.setWidth(geom.width()); + } + if (newSize.height() > geom.height()) { + newSize.setHeight(geom.height()); + } + } m_screenWidget->setSizeHint(newSize); newSize -= m_screenWidget->size(); newSize += this->size();

@@ -595,7 +605,7 @@ }

m_wasOpened = true; resizeFrame(m_screenWidget->sizeHint()); QVariant windowPos = m_config->getQtOption("windowPos"); - QRect geom = QApplication::desktop()->availableGeometry(this); + QRect geom = windowHandle()->screen()->availableGeometry(); if (!windowPos.isNull() && geom.contains(windowPos.toPoint())) { move(windowPos.toPoint()); } else {