Commit 63d0ff31 authored by Jan Blackquill's avatar Jan Blackquill 🏳🌈

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
parent 51d2c2d0
......@@ -114,7 +114,7 @@ private:
static void iconChangedCallback(void *data, org_kde_plasma_window *org_kde_plasma_window);
static void virtualDesktopEnteredCallback(void *data, org_kde_plasma_window *org_kde_plasma_window, const char *id);
static void virtualDesktopLeftCallback(void *data, org_kde_plasma_window *org_kde_plasma_window, const char *id);
static void appmenuChangedCallback(void *data, org_kde_plasma_window *org_kde_plasma_window, const char* service_name, const char* object_path);
static void appmenuChangedCallback(void *data, org_kde_plasma_window *org_kde_plasma_window, const char *service_name, const char *object_path);
void setActive(bool set);
void setMinimized(bool set);
void setMaximized(bool set);
......@@ -360,16 +360,16 @@ org_kde_plasma_window_listener PlasmaWindow::Private::s_listener = {
appmenuChangedCallback
};
void PlasmaWindow::Private::appmenuChangedCallback(void *data, org_kde_plasma_window *window, const char* service_name, const char* object_path)
void PlasmaWindow::Private::appmenuChangedCallback(void *data, org_kde_plasma_window *window, const char *service_name, const char *object_path)
{
Q_UNUSED(window)
Private *p = cast(data);
p->applicationMenuServiceName = QString::fromLocal8Bit(service_name);
p->applicationMenuObjectPath = QString::fromLocal8Bit(object_path);
p->applicationMenuServiceName = QString::fromUtf8(service_name);
p->applicationMenuObjectPath = QString::fromUtf8(object_path);
emit p->q->applicationMenuChanged();
Q_UNUSED(window);
}
void PlasmaWindow::Private::parentWindowCallback(void *data, org_kde_plasma_window *window, org_kde_plasma_window *parent)
......
......@@ -523,7 +523,19 @@ public:
*/
QStringList plasmaVirtualDesktops() const;
/**
* Return the D-BUS service name for a window's
* application menu.
*
* @since 5.69
*/
QString applicationMenuServiceName() const;
/**
* Return the D-BUS object path to a windows's
* application menu.
*
* @since 5.69
*/
QString applicationMenuObjectPath() const;
Q_SIGNALS:
......@@ -685,7 +697,10 @@ Q_SIGNALS:
void plasmaVirtualDesktopLeft(const QString &id);
/**
* TODO: Documentation.
* This signal is emitted when either the D-BUS service name or
* object path for the window's application menu changes.
*
* @since 5.69
**/
void applicationMenuChanged();
......
......@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]></copyright>
<interface name="org_kde_plasma_window_management" version="9">
<interface name="org_kde_plasma_window_management" version="10">
<description summary="application windows management">
This interface manages application windows.
It provides requests to show and hide the desktop and emits
......@@ -84,7 +84,7 @@
</event>
</interface>
<interface name="org_kde_plasma_window" version="9">
<interface name="org_kde_plasma_window" version="10">
<description summary="interface to control application windows">
Manages and control an application window.
......@@ -309,7 +309,9 @@
<arg name="is" type="string" summary="desktop id"/>
</event>
<event name="application_menu_changed" since="9">
<!-- Version 10 additions -->
<event name="application_menu" since="10">
<description summary="notify the client that the current appmenu changed">
This event will be sent after the application menu
for the window has changed.
......
......@@ -185,7 +185,7 @@ static const QMap<Registry::Interface, SuppertedInterfaceData> s_interfaces = {
&Registry::plasmaVirtualDesktopManagementRemoved
}},
{Registry::Interface::PlasmaWindowManagement, {
9,
10,
QByteArrayLiteral("org_kde_plasma_window_management"),
&org_kde_plasma_window_management_interface,
&Registry::plasmaWindowManagementAnnounced,
......
......@@ -82,7 +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);
void setApplicationMenuPaths(const QString &service, const QString &object);
wl_resource *resourceForParent(PlasmaWindowInterface *parent, wl_resource *child) const;
QVector<wl_resource*> resources;
......@@ -126,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)
......@@ -593,10 +593,10 @@ void PlasmaWindowInterface::Private::setApplicationMenuPaths(const QString &serv
{
for (auto it = resources.constBegin(); it != resources.constEnd(); ++it) {
auto resource = *it;
if (wl_resource_get_version(resource) < ORG_KDE_PLASMA_WINDOW_APPLICATION_MENU_CHANGED_SINCE_VERSION) {
if (wl_resource_get_version(resource) < ORG_KDE_PLASMA_WINDOW_APPLICATION_MENU_SINCE_VERSION) {
continue;
}
org_kde_plasma_window_send_application_menu_changed(resource, qUtf8Printable(service), qUtf8Printable(object));
org_kde_plasma_window_send_application_menu(resource, qUtf8Printable(service), qUtf8Printable(object));
}
}
......@@ -958,9 +958,9 @@ void PlasmaWindowInterface::setGeometry(const QRect &geometry)
d->setGeometry(geometry);
}
void PlasmaWindowInterface::setApplicationMenuPaths(const QString& service_name, const QString &object_path)
void PlasmaWindowInterface::setApplicationMenuPaths(const QString &serviceName, const QString &objectPath)
{
d->setApplicationMenuPaths(service_name, object_path);
d->setApplicationMenuPaths(serviceName, objectPath);
}
}
......
......@@ -229,9 +229,11 @@ public:
QStringList plasmaVirtualDesktops() const;
/**
* TODO: Documentation.
* Set the application menu D-BUS service name and object path for the window.
*
* @since 5.69
*/
void setApplicationMenuPaths(const QString& service_name, const QString& object_path);
void setApplicationMenuPaths(const QString &serviceName, const QString &objectPath);
Q_SIGNALS:
void closeRequested();
......
Markdown is supported
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