From 550b67236e9cf2c43709045157e9056bcf0915b7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 25 Oct 2018 13:01:01 +0400 Subject: [PATCH] Reactive main window only if app is active. Otherwise when we choose "Show in Folder" app looses focus, then destroys PopupMenu and instantly regains focus back. --- Telegram/SourceFiles/ui/widgets/popup_menu.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/ui/widgets/popup_menu.cpp b/Telegram/SourceFiles/ui/widgets/popup_menu.cpp index ad79cb3a8..2c9adbefa 100644 --- a/Telegram/SourceFiles/ui/widgets/popup_menu.cpp +++ b/Telegram/SourceFiles/ui/widgets/popup_menu.cpp @@ -503,11 +503,13 @@ PopupMenu::~PopupMenu() { delete submenu; } if (const auto parent = parentWidget()) { - crl::on_main(parent, [=] { - if (!parent->isHidden()) { - parent->activateWindow(); - } - }); + if (qApp->focusWidget() != nullptr) { + crl::on_main(parent, [=] { + if (!parent->isHidden()) { + parent->activateWindow(); + } + }); + } } if (_destroyedCallback) { _destroyedCallback();