File indexing completed on 2024-04-28 16:49:16

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "kwin_export.h"
0013 #include <QObject>
0014 #include <QPointer>
0015 #include <QSharedPointer>
0016 
0017 namespace KWaylandServer
0018 {
0019 class SeatInterface;
0020 class ClientConnection;
0021 class SurfaceInterface;
0022 class XdgActivationV1Interface;
0023 class PlasmaWindowActivationInterface;
0024 }
0025 
0026 namespace KWin
0027 {
0028 class KWIN_EXPORT XdgActivationV1Integration : public QObject
0029 {
0030     Q_OBJECT
0031 public:
0032     XdgActivationV1Integration(KWaylandServer::XdgActivationV1Interface *activation, QObject *parent);
0033 
0034     QString requestPrivilegedToken(KWaylandServer::SurfaceInterface *surface, uint serial, KWaylandServer::SeatInterface *seat, const QString &appId)
0035     {
0036         return requestToken(true, surface, serial, seat, appId);
0037     }
0038     void activateSurface(KWaylandServer::SurfaceInterface *surface, const QString &token);
0039 
0040 private:
0041     QString requestToken(bool isPrivileged, KWaylandServer::SurfaceInterface *surface, uint serial, KWaylandServer::SeatInterface *seat, const QString &appId);
0042     void clear();
0043 
0044     struct ActivationToken
0045     {
0046         const QString token;
0047         const bool isPrivileged;
0048         const QPointer<const KWaylandServer::SurfaceInterface> surface;
0049         const uint serial;
0050         const KWaylandServer::SeatInterface *seat;
0051         const QString applicationId;
0052         const bool showNotify;
0053         const std::unique_ptr<KWaylandServer::PlasmaWindowActivationInterface> activation;
0054     };
0055     std::unique_ptr<ActivationToken> m_currentActivationToken;
0056 };
0057 
0058 }