diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index cf0c168b19..f9733b6a45 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -13,7 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/platform/ui_platform_utility.h" #include "history/history.h" #include "window/themes/window_theme.h" -#include "window/window_title_qt.h" // kShowAfterWindowFlagChangeDelay #include "window/window_session_controller.h" #include "window/window_lock_widgets.h" #include "window/window_outdated_bar.h" @@ -365,20 +364,9 @@ void MainWindow::refreshTitleWidget() { _titleShadow.destroy(); } -#if defined Q_OS_UNIX && !defined Q_OS_MAC - // setWindowFlag calls setParent(parentWidget(), newFlags), which - // always calls hide() explicitly, we have to show() the window back. - const auto hidden = isHidden(); const auto withShadow = hasShadow(); - setWindowFlag(Qt::NoDropShadowWindowHint, withShadow); + windowHandle()->setFlag(Qt::NoDropShadowWindowHint, withShadow); setAttribute(Qt::WA_OpaquePaintEvent, !withShadow); - if (!hidden) { - base::call_delayed( - kShowAfterWindowFlagChangeDelay, - this, - [=] { show(); }); - } -#endif // Q_OS_UNIX && !Q_OS_MAC } void MainWindow::updateMinimumSize() { diff --git a/Telegram/SourceFiles/window/window_title_qt.cpp b/Telegram/SourceFiles/window/window_title_qt.cpp index fc210e1aa0..2dbc133b60 100644 --- a/Telegram/SourceFiles/window/window_title_qt.cpp +++ b/Telegram/SourceFiles/window/window_title_qt.cpp @@ -91,17 +91,7 @@ TitleWidgetQt::~TitleWidgetQt() { } void TitleWidgetQt::toggleFramelessWindow(bool enabled) { - // setWindowFlag calls setParent(parentWidget(), newFlags), which - // always calls hide() explicitly, we have to show() the window back. - const auto top = window(); - const auto hidden = top->isHidden(); - top->setWindowFlag(Qt::FramelessWindowHint, enabled); - if (!hidden) { - base::call_delayed( - kShowAfterWindowFlagChangeDelay, - top, - [=] { top->show(); }); - } + window()->windowHandle()->setFlag(Qt::FramelessWindowHint, enabled); } void TitleWidgetQt::init() { diff --git a/Telegram/SourceFiles/window/window_title_qt.h b/Telegram/SourceFiles/window/window_title_qt.h index 126711e954..00b65cc094 100644 --- a/Telegram/SourceFiles/window/window_title_qt.h +++ b/Telegram/SourceFiles/window/window_title_qt.h @@ -22,12 +22,6 @@ class PlainShadow; namespace Window { -// If we toggle frameless window hint in maximized window, and -// show it back too quickly, the mouse position inside the window -// won't be correct (from Qt-s point of view) until we Alt-Tab from -// that window. If we show the window back with this delay it works. -inline constexpr auto kShowAfterWindowFlagChangeDelay = crl::time(1000); - class TitleWidgetQt : public TitleWidget { public: TitleWidgetQt(QWidget *parent);