Add resourceName to plasma windowmanagement

This allows to get the resource name for XWayland windows, which is useful in the task manager
This commit is contained in:
Nicolas Fella 2022-01-23 20:57:16 +01:00
parent 91f883f5ca
commit bb28c84ec4
2 changed files with 28 additions and 0 deletions

View file

@ -67,6 +67,7 @@ public:
void setParentWindow(PlasmaWindowInterface *parent);
void setGeometry(const QRect &geometry);
void setApplicationMenuPaths(const QString &service, const QString &object);
void setResourceName(const QString &resourceName);
wl_resource *resourceForParent(PlasmaWindowInterface *parent, Resource *child) const;
quint32 windowId = 0;
@ -89,6 +90,7 @@ public:
QIcon m_icon;
quint32 m_state = 0;
QString uuid;
QString m_resourceName;
protected:
void org_kde_plasma_window_bind_resource(Resource *resource) override;
@ -375,6 +377,11 @@ void PlasmaWindowInterfacePrivate::org_kde_plasma_window_bind_resource(Resource
if (resource->version() >= ORG_KDE_PLASMA_WINDOW_INITIAL_STATE_SINCE_VERSION) {
send_initial_state(resource->handle);
}
if (!m_resourceName.isEmpty()) {
if (resource->version() >= ORG_KDE_PLASMA_WINDOW_RESOURCE_NAME_CHANGED_SINCE_VERSION) {
send_resource_name_changed(resource->handle, m_resourceName);
}
}
}
void PlasmaWindowInterfacePrivate::setAppId(const QString &appId)
@ -430,6 +437,21 @@ void PlasmaWindowInterfacePrivate::setIcon(const QIcon &icon)
}
}
void PlasmaWindowInterfacePrivate::setResourceName(const QString &resourceName)
{
if (m_resourceName == resourceName) {
return;
}
m_resourceName = resourceName;
const auto clientResources = resourceMap();
for (auto resource : clientResources) {
if (resource->version() >= ORG_KDE_PLASMA_WINDOW_RESOURCE_NAME_CHANGED_SINCE_VERSION) {
send_resource_name_changed(resource->handle, resourceName);
}
}
}
void PlasmaWindowInterfacePrivate::org_kde_plasma_window_get_icon(Resource *resource, int32_t fd)
{
Q_UNUSED(resource)
@ -867,6 +889,11 @@ void PlasmaWindowInterface::setIcon(const QIcon &icon)
d->setIcon(icon);
}
void PlasmaWindowInterface::setResourceName(const QString &resourceName)
{
d->setResourceName(resourceName);
}
void PlasmaWindowInterface::addPlasmaVirtualDesktop(const QString &id)
{
// don't add a desktop we're not sure it exists

View file

@ -129,6 +129,7 @@ public:
void setShaded(bool set);
void setMovable(bool set);
void setResizable(bool set);
void setResourceName(const QString &resourceName);
/**
* FIXME: still relevant with new desktops?
*/