plasma-window-management: Support new activation concepts

This commit is contained in:
Aleix Pol 2021-07-15 18:35:04 +02:00 committed by Vlad Zahorodnii
parent 1eb0c09292
commit e729478d09
2 changed files with 10 additions and 1 deletions

View file

@ -15,6 +15,7 @@
#include "workspace.h"
#include <KWaylandServer/display.h>
#include <KWaylandServer/surface_interface.h>
#include <KWaylandServer/plasmawindowmanagement_interface.h>
#include <KWaylandServer/xdgactivation_v1_interface.h>
using namespace KWaylandServer;
@ -51,7 +52,8 @@ XdgActivationV1Integration::XdgActivationV1Integration(XdgActivationV1Interface
if (m_currentActivationToken) {
clear();
}
m_currentActivationToken.reset(new ActivationToken{newToken, client, surface, serial, seat, appId});
QSharedPointer<PlasmaWindowActivationInterface> pwActivation(waylandServer()->windowManagement()->createActivation(appId));
m_currentActivationToken.reset(new ActivationToken{newToken, client, surface, serial, seat, appId, pwActivation});
if (!appId.isEmpty()) {
const auto icon = QIcon::fromTheme(AbstractClient::iconFromDesktopFile(appId), QIcon::fromTheme(QStringLiteral("system-run")));
Q_EMIT effects->startupAdded(m_currentActivationToken->token, icon);
@ -98,4 +100,6 @@ void XdgActivationV1Integration::clear()
m_currentActivationToken.reset();
}
XdgActivationV1Integration::ActivationToken::~ActivationToken() = default;
}

View file

@ -11,6 +11,7 @@
#include "kwin_export.h"
#include <QObject>
#include <QSharedPointer>
namespace KWaylandServer
{
@ -18,6 +19,7 @@ class SeatInterface;
class ClientConnection;
class SurfaceInterface;
class XdgActivationV1Interface;
class PlasmaWindowActivationInterface;
}
namespace KWin
@ -29,12 +31,15 @@ public:
XdgActivationV1Integration(KWaylandServer::XdgActivationV1Interface *activation, QObject *parent);
struct ActivationToken {
~ActivationToken();
const QString token;
const KWaylandServer::ClientConnection *client;
const KWaylandServer::SurfaceInterface *surface;
const uint serial;
const KWaylandServer::SeatInterface *seat;
QString applicationId;
QSharedPointer<KWaylandServer::PlasmaWindowActivationInterface> activation;
};
void activateSurface(KWaylandServer::SurfaceInterface *surface, const QString &token);