2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-04 16:35:44 +00:00

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.
This commit is contained in:
John Preston
2023-07-12 22:05:58 +04:00
parent 196447ac19
commit 51027a0bc2
2 changed files with 12 additions and 2 deletions

View File

@@ -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 <QtCore/QLockFile>
#include <QtGui/QSessionManager>
@@ -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<base::InvokeQueuedEvent*>(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);
}