File indexing completed on 2024-04-28 05:30:42

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 
0016 namespace KWin
0017 {
0018 
0019 class SeatInterface;
0020 class ClientConnection;
0021 class SurfaceInterface;
0022 class XdgActivationV1Interface;
0023 class PlasmaWindowActivationInterface;
0024 
0025 class KWIN_EXPORT XdgActivationV1Integration : public QObject
0026 {
0027     Q_OBJECT
0028 public:
0029     XdgActivationV1Integration(XdgActivationV1Interface *activation, QObject *parent);
0030 
0031     QString requestPrivilegedToken(SurfaceInterface *surface, uint serial, SeatInterface *seat, const QString &appId)
0032     {
0033         return requestToken(true, surface, serial, seat, appId);
0034     }
0035     void activateSurface(SurfaceInterface *surface, const QString &token);
0036 
0037 private:
0038     QString requestToken(bool isPrivileged, SurfaceInterface *surface, uint serial, SeatInterface *seat, const QString &appId);
0039     void clear();
0040 
0041     struct ActivationToken
0042     {
0043         QString token;
0044         bool isPrivileged;
0045         QPointer<const SurfaceInterface> surface;
0046         uint serial;
0047         SeatInterface *seat;
0048         QString applicationId;
0049         bool showNotify;
0050         std::unique_ptr<PlasmaWindowActivationInterface> activation;
0051     };
0052     std::unique_ptr<ActivationToken> m_currentActivationToken;
0053 };
0054 
0055 }