From 3ba210b6e4f156ab5b68365e6d2b4998673ce086 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 18 Jul 2017 19:38:11 +0300 Subject: [PATCH] Automatically return window to screen. Fixes #3551. --- Telegram/SourceFiles/window/main_window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 493aeff808..af6491cda0 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -264,6 +264,8 @@ void MainWindow::initSize() { auto w = screenGeometry.width(), h = screenGeometry.height(); 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.h > h) position.h = h; position.x += screenGeometry.x(); @@ -277,8 +279,6 @@ void MainWindow::initSize() { break; } } - - if (position.y < 0) position.y = 0; 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()));