diff --git a/src/wayland/plasmawindowmanagement_interface.cpp b/src/wayland/plasmawindowmanagement_interface.cpp index c28bc41326..a12f01b976 100644 --- a/src/wayland/plasmawindowmanagement_interface.cpp +++ b/src/wayland/plasmawindowmanagement_interface.cpp @@ -30,9 +30,11 @@ class PlasmaWindowManagementInterfacePrivate : public QtWaylandServer::org_kde_p public: PlasmaWindowManagementInterfacePrivate(PlasmaWindowManagementInterface *_q, Display *display); void sendShowingDesktopState(); - void sendStackingOrderChanged(); void sendShowingDesktopState(wl_resource *resource); + void sendStackingOrderChanged(); void sendStackingOrderChanged(wl_resource *resource); + void sendStackingOrderUuidsChanged(); + void sendStackingOrderUuidsChanged(wl_resource *resource); PlasmaWindowManagementInterface::ShowingDesktopState state = PlasmaWindowManagementInterface::ShowingDesktopState::Disabled; QList windows; @@ -151,13 +153,31 @@ void PlasmaWindowManagementInterfacePrivate::sendStackingOrderChanged(wl_resourc } send_stacking_order_changed(r, QByteArray::fromRawData(reinterpret_cast(stackingOrder.constData()), sizeof(uint32_t) * stackingOrder.size())); +} + +void PlasmaWindowManagementInterfacePrivate::sendStackingOrderUuidsChanged() +{ + const auto clientResources = resourceMap(); + for (auto resource : clientResources) { + sendStackingOrderUuidsChanged(resource->handle); + } +} + +void PlasmaWindowManagementInterfacePrivate::sendStackingOrderUuidsChanged(wl_resource *r) +{ + if (wl_resource_get_version(r) < ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STACKING_ORDER_UUID_CHANGED_SINCE_VERSION) { + return; + } QString uuids; for (const auto &uuid : qAsConst(stackingOrderUuids)) { uuids += uuid; - uuids += QStringLiteral(";"); + uuids += QLatin1Char(';'); + } + // Remove the trailing ';', on the receiving side this is interpreted as an empty uuid. + if (stackingOrderUuids.size() > 0) { + uuids.remove(uuids.length() - 1, 1); } - send_stacking_order_uuid_changed(r, uuids); } @@ -171,6 +191,7 @@ void PlasmaWindowManagementInterfacePrivate::org_kde_plasma_window_management_bi } } sendStackingOrderChanged(resource->handle); + sendStackingOrderUuidsChanged(resource->handle); } void PlasmaWindowManagementInterfacePrivate::org_kde_plasma_window_management_show_desktop(Resource *resource, uint32_t state) @@ -265,7 +286,7 @@ QList PlasmaWindowManagementInterface::windows() const return d->windows; } -void PlasmaWindowManagementInterface::setStackingOrder(const QVector& stackingOrder) +void PlasmaWindowManagementInterface::setStackingOrder(const QVector &stackingOrder) { if (d->stackingOrder == stackingOrder) { return; @@ -274,6 +295,15 @@ void PlasmaWindowManagementInterface::setStackingOrder(const QVector& s d->sendStackingOrderChanged(); } +void PlasmaWindowManagementInterface::setStackingOrderUuids(const QVector &stackingOrderUuids) +{ + if (d->stackingOrderUuids == stackingOrderUuids) { + return; + } + d->stackingOrderUuids = stackingOrderUuids; + d->sendStackingOrderUuidsChanged(); +} + void PlasmaWindowManagementInterface::setPlasmaVirtualDesktopManagementInterface(PlasmaVirtualDesktopManagementInterface *manager) { if (d->plasmaVirtualDesktopManagementInterface == manager) { @@ -930,4 +960,9 @@ quint32 PlasmaWindowInterface::internalId() const return d->windowId; } +QString PlasmaWindowInterface::uuid() const +{ + return d->uuid; +} + } diff --git a/src/wayland/plasmawindowmanagement_interface.h b/src/wayland/plasmawindowmanagement_interface.h index e38fdfd4ad..fd77720c7f 100644 --- a/src/wayland/plasmawindowmanagement_interface.h +++ b/src/wayland/plasmawindowmanagement_interface.h @@ -58,6 +58,8 @@ public: */ void setStackingOrder(const QVector &stackingOrder); + void setStackingOrderUuids(const QVector &stackingOrderUuids); + Q_SIGNALS: void requestChangeShowingDesktop(ShowingDesktopState requestedState); @@ -185,7 +187,7 @@ public: /** * @return a unique string that identifies this window */ - QByteArray uuid() const; + QString uuid() const; Q_SIGNALS: void closeRequested();