Qt: Prevent window from being created off-screen

This commit is contained in:
Vicki Pfau 2017-10-16 20:24:34 -07:00
parent a691143777
commit acbd8a3688
2 changed files with 4 additions and 2 deletions

View File

@ -28,6 +28,7 @@ Misc:
- Python: Integrate tests from cinema test suite
- Util: Don't build crc32 if the function already exists
- GBA: Implement display start DMAs
- Qt: Prevent window from being created off-screen
0.6.1: (2017-10-01)
Bugfixes:

View File

@ -550,11 +550,12 @@ void Window::showEvent(QShowEvent* event) {
m_wasOpened = true;
resizeFrame(m_screenWidget->sizeHint());
QVariant windowPos = m_config->getQtOption("windowPos");
if (!windowPos.isNull()) {
QRect geom = QApplication::desktop()->availableGeometry(this);
if (!windowPos.isNull() && geom.contains(windowPos.toPoint())) {
move(windowPos.toPoint());
} else {
QRect rect = frameGeometry();
rect.moveCenter(QApplication::desktop()->availableGeometry().center());
rect.moveCenter(geom.center());
move(rect.topLeft());
}
if (m_fullscreenOnStart) {