Skip to content

Commit

Permalink
Qt: Prevent window from being created off-screen
Browse files Browse the repository at this point in the history
  • Loading branch information
endrift committed Oct 17, 2017
1 parent a691143 commit acbd8a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions src/platform/qt/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit acbd8a3

Please sign in to comment.