QGenericUnixServices: ensure xdg activation token callback is called

The callback doesn't get called if the signal is emitted immediately
or if hitting the early returns

Fixes: QTBUG-113995
Change-Id: Ib3e1d324a2becd8148cd76b4441fce5c4cc725e8
Reviewed-by: David Redondo <qt@david-redondo.de>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit d524f0a75632d8603e32b3ee7fe02138ff8343d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ilya Fedin 2023-09-04 06:26:16 +04:00 committed by Qt Cherry-pick Bot
parent 30d416c67d
commit 91619f0e76

View File

@ -421,6 +421,7 @@ void runWithXdgActivationToken(F &&functionToCall)
QWindow *window = qGuiApp->focusWindow();
if (!window) {
functionToCall({});
return;
}
@ -430,13 +431,14 @@ void runWithXdgActivationToken(F &&functionToCall)
dynamic_cast<QNativeInterface::Private::QWaylandWindow *>(window->handle());
if (!waylandWindow || !waylandApp) {
functionToCall({});
return;
}
waylandWindow->requestXdgActivationToken(waylandApp->lastInputSerial());
QObject::connect(waylandWindow,
&QNativeInterface::Private::QWaylandWindow::xdgActivationTokenCreated,
waylandWindow, functionToCall, Qt::SingleShotConnection);
waylandWindow->requestXdgActivationToken(waylandApp->lastInputSerial());
}
bool QGenericUnixServices::openUrl(const QUrl &url)