xdg_activation_v1: Improve internal API

Be explicit about how we only request privileged tokens internally in
KWin.
This commit is contained in:
Aleix Pol 2022-05-20 16:03:23 +02:00 committed by Aleix Pol Gonzalez
parent 13dd31d98a
commit da8ad3201b
2 changed files with 6 additions and 2 deletions

View file

@ -324,7 +324,7 @@ void WindowSystem::requestToken(QWindow *win, uint32_t serial, const QString &ap
Q_UNUSED(win); // it's coming from within kwin, it doesn't matter the window
auto seat = KWin::waylandServer()->seat();
auto token = KWin::waylandServer()->xdgActivationIntegration()->requestToken(true, nullptr, seat->display()->serial(), seat, appId);
auto token = KWin::waylandServer()->xdgActivationIntegration()->requestPrivilegedToken(nullptr, seat->display()->serial(), seat, appId);
// Ensure that xdgActivationTokenArrived is always emitted asynchronously
QTimer::singleShot(0, [serial, token] {
Q_EMIT KWindowSystem::self()->xdgActivationTokenArrived(serial, token);

View file

@ -44,10 +44,14 @@ public:
QSharedPointer<KWaylandServer::PlasmaWindowActivationInterface> activation;
};
QString requestToken(bool isPrivileged, KWaylandServer::SurfaceInterface *surface, uint serial, KWaylandServer::SeatInterface *seat, const QString &appId);
QString requestPrivilegedToken(KWaylandServer::SurfaceInterface *surface, uint serial, KWaylandServer::SeatInterface *seat, const QString &appId)
{
return requestToken(true, surface, serial, seat, appId);
}
void activateSurface(KWaylandServer::SurfaceInterface *surface, const QString &token);
private:
QString requestToken(bool isPrivileged, KWaylandServer::SurfaceInterface *surface, uint serial, KWaylandServer::SeatInterface *seat, const QString &appId);
void clear();
QScopedPointer<ActivationToken> m_currentActivationToken;