From 51027a0bc25e10e22244dedd0349ed939188f190 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 12 Jul 2023 22:05:58 +0400 Subject: [PATCH] Workaround Wayland popup menu bug. When hiding a child popup first the app receives ApplicationDeactivate event and in a short time (a couple of ms) ApplicationActivate. But the first event hides all popups, so the parent popup gets closed too. Delay handling of ApplicationDeactivate event in this specific case. --- Telegram/SourceFiles/core/sandbox.cpp | 12 +++++++++++- Telegram/lib_ui | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index 6c332bbc1..d477101f4 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/qthelp_regex.h" #include "ui/ui_utility.h" #include "ui/effects/animations.h" +#include "ui/platform/ui_platform_utility.h" #include #include @@ -580,9 +581,18 @@ void Sandbox::registerEnterFromEventLoop() { } bool Sandbox::notifyOrInvoke(QObject *receiver, QEvent *e) { - if (e->type() == base::InvokeQueuedEvent::kType) { + const auto type = e->type(); + if (type == base::InvokeQueuedEvent::kType) { static_cast(e)->invoke(); return true; + } else if (receiver == this) { + if (type == QEvent::ApplicationDeactivate) { + if (Ui::Platform::SkipApplicationDeactivateEvent()) { + return true; + } + } else if (type == QEvent::ApplicationActivate) { + Ui::Platform::GotApplicationActivateEvent(); + } } return QApplication::notify(receiver, e); } diff --git a/Telegram/lib_ui b/Telegram/lib_ui index d04a38e15..8db6dcf12 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit d04a38e15d957ab0dacfe825396c199541097443 +Subproject commit 8db6dcf125da5c767d36a696794d4a51d82c7955