Commit 773995de authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

plasma-window-management: Support new activation concepts

parent aeaa480b
......@@ -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;
}
}
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment