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
Pick-to: 6.6 6.5
Change-Id: Ib3e1d324a2becd8148cd76b4441fce5c4cc725e8
Reviewed-by: David Redondo <qt@david-redondo.de>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Ilya Fedin 2023-09-04 06:26:16 +04:00
parent 9b40272562
commit d524f0a756

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)