Automatically return window to screen.

Fixes #3551.
This commit is contained in:
John Preston 2017-07-18 19:38:11 +03:00
parent faf090781d
commit 3ba210b6e4
1 changed files with 2 additions and 2 deletions

View File

@ -264,6 +264,8 @@ void MainWindow::initSize() {
auto w = screenGeometry.width(), h = screenGeometry.height(); auto w = screenGeometry.width(), h = screenGeometry.height();
if (w >= st::windowMinWidth && h >= st::windowMinHeight) { if (w >= st::windowMinWidth && h >= st::windowMinHeight) {
if (position.x < 0) position.x = 0;
if (position.y < 0) position.y = 0;
if (position.w > w) position.w = w; if (position.w > w) position.w = w;
if (position.h > h) position.h = h; if (position.h > h) position.h = h;
position.x += screenGeometry.x(); position.x += screenGeometry.x();
@ -277,8 +279,6 @@ void MainWindow::initSize() {
break; break;
} }
} }
if (position.y < 0) position.y = 0;
maximized = position.maximized; maximized = position.maximized;
} }
DEBUG_LOG(("Window Pos: Setting first %1, %2, %3, %4").arg(geom.x()).arg(geom.y()).arg(geom.width()).arg(geom.height())); DEBUG_LOG(("Window Pos: Setting first %1, %2, %3, %4").arg(geom.x()).arg(geom.y()).arg(geom.width()).arg(geom.height()));