plasma-window-management: Support new activation concepts

This commit is contained in:
Aleix Pol 2021-07-15 18:32:05 +02:00 committed by Aleix Pol Gonzalez
parent aeaa480b0c
commit 773995de56
2 changed files with 71 additions and 4 deletions

View file

@ -23,7 +23,7 @@
namespace KWaylandServer
{
static const quint32 s_version = 14;
static const quint32 s_version = 15;
class PlasmaWindowManagementInterfacePrivate : public QtWaylandServer::org_kde_plasma_window_management
{
@ -1020,4 +1020,51 @@ QString PlasmaWindowInterface::uuid() const
return d->uuid;
}
class PlasmaWindowActivationInterfacePrivate : public QtWaylandServer::org_kde_plasma_activation
{
public:
PlasmaWindowActivationInterfacePrivate(PlasmaWindowActivationInterface *q)
: QtWaylandServer::org_kde_plasma_activation()
, q(q)
{
}
PlasmaWindowActivationInterface *const q;
};
PlasmaWindowActivationInterface::PlasmaWindowActivationInterface()
: d(new PlasmaWindowActivationInterfacePrivate(this))
{
}
PlasmaWindowActivationInterface::~PlasmaWindowActivationInterface()
{
const auto clientResources = d->resourceMap();
for (auto resource : clientResources) {
d->send_finished(resource->handle);
}
}
void PlasmaWindowActivationInterface::sendAppId(const QString &appid)
{
const auto clientResources = d->resourceMap();
for (auto resource : clientResources) {
d->send_app_id(resource->handle, appid);
}
}
KWaylandServer::PlasmaWindowActivationInterface *PlasmaWindowManagementInterface::createActivation(const QString &appid)
{
auto activation = new PlasmaWindowActivationInterface;
const auto resources = d->resourceMap();
for (auto resource : resources) {
if (resource->version() < ORG_KDE_PLASMA_WINDOW_MANAGEMENT_ACTIVATION_SINCE_VERSION) {
continue;
}
auto connection = activation->d->add(resource->client(), resource->version());
d->send_activation(resource->handle, connection->handle);
}
activation->sendAppId(appid);
return activation;
}
}

View file

@ -18,12 +18,24 @@ class Display;
class PlasmaWindowInterface;
class SurfaceInterface;
class PlasmaVirtualDesktopManagementInterface;
class PlasmaWindowActivationInterfacePrivate;
class PlasmaWindowManagementInterfacePrivate;
class PlasmaWindowInterfacePrivate;
/**
* @todo Add documentation
*/
class KWAYLANDSERVER_EXPORT PlasmaWindowActivationInterface
{
public:
~PlasmaWindowActivationInterface();
void sendAppId(const QString &id);
private:
friend class PlasmaWindowManagementInterface;
explicit PlasmaWindowActivationInterface();
QScopedPointer<PlasmaWindowActivationInterfacePrivate> d;
};
class KWAYLANDSERVER_EXPORT PlasmaWindowManagementInterface : public QObject
{
Q_OBJECT
@ -60,6 +72,14 @@ public:
void setStackingOrderUuids(const QVector<QString> &stackingOrderUuids);
/**
* Notify about a new application with @p app_id being started
*
* @returns an instance of @class PlasmaWindowActivationInterface to
* be destroyed as the activation process ends.
*/
PlasmaWindowActivationInterface *createActivation(const QString &app_id);
Q_SIGNALS:
void requestChangeShowingDesktop(ShowingDesktopState requestedState);