diff --git a/src/wayland/plasmawindowmanagement_interface.cpp b/src/wayland/plasmawindowmanagement_interface.cpp index d3e4e3104f..d5e3075b20 100644 --- a/src/wayland/plasmawindowmanagement_interface.cpp +++ b/src/wayland/plasmawindowmanagement_interface.cpp @@ -23,7 +23,8 @@ namespace KWaylandServer { -static const quint32 s_version = 15; +static const quint32 s_version = 14; +static const quint32 s_activationVersion = 1; class PlasmaWindowManagementInterfacePrivate : public QtWaylandServer::org_kde_plasma_window_management { @@ -1020,6 +1021,15 @@ QString PlasmaWindowInterface::uuid() const return d->uuid; } +class PlasmaWindowActivationFeedbackInterfacePrivate : public QtWaylandServer::org_kde_plasma_activation_feedback +{ +public: + PlasmaWindowActivationFeedbackInterfacePrivate(Display *display); + +protected: + void org_kde_plasma_activation_feedback_destroy(Resource *resource) override; +}; + class PlasmaWindowActivationInterfacePrivate : public QtWaylandServer::org_kde_plasma_activation { public: @@ -1032,6 +1042,38 @@ public: PlasmaWindowActivationInterface *const q; }; +PlasmaWindowActivationFeedbackInterfacePrivate::PlasmaWindowActivationFeedbackInterfacePrivate(Display *display) + : QtWaylandServer::org_kde_plasma_activation_feedback(*display, s_activationVersion) +{ +} + +void PlasmaWindowActivationFeedbackInterfacePrivate::org_kde_plasma_activation_feedback_destroy(Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +PlasmaWindowActivationFeedbackInterface::PlasmaWindowActivationFeedbackInterface(Display *display, QObject *parent) + : QObject(parent) + , d(new PlasmaWindowActivationFeedbackInterfacePrivate(display)) +{ +} + +PlasmaWindowActivationFeedbackInterface::~PlasmaWindowActivationFeedbackInterface() +{ +} + +PlasmaWindowActivationInterface *PlasmaWindowActivationFeedbackInterface::createActivation(const QString &appid) +{ + auto activation = new PlasmaWindowActivationInterface; + const auto resources = d->resourceMap(); + for (auto resource : resources) { + auto activationResource = activation->d->add(resource->client(), resource->version()); + d->send_activation(resource->handle, activationResource->handle); + } + activation->sendAppId(appid); + return activation; +} + PlasmaWindowActivationInterface::PlasmaWindowActivationInterface() : d(new PlasmaWindowActivationInterfacePrivate(this)) { @@ -1053,18 +1095,4 @@ void PlasmaWindowActivationInterface::sendAppId(const QString &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; -} } diff --git a/src/wayland/plasmawindowmanagement_interface.h b/src/wayland/plasmawindowmanagement_interface.h index 562f872907..21e118c55f 100644 --- a/src/wayland/plasmawindowmanagement_interface.h +++ b/src/wayland/plasmawindowmanagement_interface.h @@ -15,12 +15,13 @@ namespace KWaylandServer { class Display; +class PlasmaWindowActivationFeedbackInterfacePrivate; class PlasmaWindowInterface; -class SurfaceInterface; class PlasmaVirtualDesktopManagementInterface; class PlasmaWindowActivationInterfacePrivate; class PlasmaWindowManagementInterfacePrivate; class PlasmaWindowInterfacePrivate; +class SurfaceInterface; class KWAYLANDSERVER_EXPORT PlasmaWindowActivationInterface { @@ -30,12 +31,32 @@ public: void sendAppId(const QString &id); private: - friend class PlasmaWindowManagementInterface; + friend class PlasmaWindowActivationFeedbackInterface; explicit PlasmaWindowActivationInterface(); QScopedPointer d; }; +class KWAYLANDSERVER_EXPORT PlasmaWindowActivationFeedbackInterface : public QObject +{ + Q_OBJECT + +public: + explicit PlasmaWindowActivationFeedbackInterface(Display *display, QObject *parent = nullptr); + ~PlasmaWindowActivationFeedbackInterface() override; + + /** + * 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); + +private: + QScopedPointer d; +}; + class KWAYLANDSERVER_EXPORT PlasmaWindowManagementInterface : public QObject { Q_OBJECT @@ -72,14 +93,6 @@ public: void setStackingOrderUuids(const QVector &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);