Add application menu dbus paths to org_kde_plasma_window interface

Summary:
This patch adds an interface allowing a compositor to send
the service name and object path of a PlasmaWindow's application menu
to the client.

Reviewers: #kwin, zzag, davidedmundson

Reviewed By: #kwin, zzag, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27464
This commit is contained in:
Carson Black 2020-02-19 21:20:51 -05:00
parent b5a08d87b7
commit 56e2680122
2 changed files with 25 additions and 1 deletions

View file

@ -82,6 +82,7 @@ public:
void setState(org_kde_plasma_window_management_state flag, bool set);
void setParentWindow(PlasmaWindowInterface *parent);
void setGeometry(const QRect &geometry);
void setApplicationMenuPaths(const QString &service, const QString &object);
wl_resource *resourceForParent(PlasmaWindowInterface *parent, wl_resource *child) const;
QVector<wl_resource*> resources;
@ -125,7 +126,7 @@ private:
static const struct org_kde_plasma_window_interface s_interface;
};
const quint32 PlasmaWindowManagementInterface::Private::s_version = 9;
const quint32 PlasmaWindowManagementInterface::Private::s_version = 10;
PlasmaWindowManagementInterface::Private::Private(PlasmaWindowManagementInterface *q, Display *d)
: Global::Private(d, &org_kde_plasma_window_management_interface, s_version)
@ -588,6 +589,17 @@ void PlasmaWindowInterface::Private::setGeometry(const QRect &geo)
}
}
void PlasmaWindowInterface::Private::setApplicationMenuPaths(const QString &service, const QString &object)
{
for (auto it = resources.constBegin(); it != resources.constEnd(); ++it) {
auto resource = *it;
if (wl_resource_get_version(resource) < ORG_KDE_PLASMA_WINDOW_APPLICATION_MENU_SINCE_VERSION) {
continue;
}
org_kde_plasma_window_send_application_menu(resource, qUtf8Printable(service), qUtf8Printable(object));
}
}
void PlasmaWindowInterface::Private::closeCallback(wl_client *client, wl_resource *resource)
{
Q_UNUSED(client)
@ -946,5 +958,10 @@ void PlasmaWindowInterface::setGeometry(const QRect &geometry)
d->setGeometry(geometry);
}
void PlasmaWindowInterface::setApplicationMenuPaths(const QString &serviceName, const QString &objectPath)
{
d->setApplicationMenuPaths(serviceName, objectPath);
}
}
}

View file

@ -228,6 +228,13 @@ public:
*/
QStringList plasmaVirtualDesktops() const;
/**
* Set the application menu D-BUS service name and object path for the window.
*
* @since 5.69
*/
void setApplicationMenuPaths(const QString &serviceName, const QString &objectPath);
Q_SIGNALS:
void closeRequested();
/**