2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2017 David Edmundson <kde@davidedmundson.co.uk>
|
2017-12-18 21:50:31 +00:00
|
|
|
|
2020-03-15 15:19:28 +00:00
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2021-03-10 16:08:30 +00:00
|
|
|
#pragma once
|
2017-12-18 21:50:31 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
#include <KWaylandServer/kwaylandserver_export.h>
|
2020-05-30 15:35:36 +00:00
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
struct wl_resource;
|
2017-12-18 21:50:31 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2017-12-18 21:50:31 +00:00
|
|
|
{
|
|
|
|
class Display;
|
|
|
|
class SurfaceInterface;
|
|
|
|
class AppMenuInterface;
|
|
|
|
|
2020-05-30 15:35:36 +00:00
|
|
|
class AppMenuManagerInterfacePrivate;
|
|
|
|
class AppMenuInterfacePrivate;
|
|
|
|
|
2017-12-18 21:50:31 +00:00
|
|
|
/**
|
|
|
|
* Provides the DBus service name and object path to a AppMenu DBus interface.
|
|
|
|
*
|
|
|
|
* This global can be used for clients to bind AppmenuInterface instances
|
|
|
|
* and notifies when a new one is created
|
|
|
|
*/
|
2020-05-30 15:35:36 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT AppMenuManagerInterface : public QObject
|
2017-12-18 21:50:31 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-12-09 20:13:19 +00:00
|
|
|
|
2017-12-18 21:50:31 +00:00
|
|
|
public:
|
2020-12-09 20:13:19 +00:00
|
|
|
explicit AppMenuManagerInterface(Display *display, QObject *parent = nullptr);
|
2020-05-30 15:35:36 +00:00
|
|
|
~AppMenuManagerInterface() override;
|
2017-12-18 21:50:31 +00:00
|
|
|
/**
|
|
|
|
* Returns any existing appMenu for a given surface
|
|
|
|
* This returns a null pointer if no AppMenuInterface exists.
|
|
|
|
*/
|
2021-08-29 05:11:06 +00:00
|
|
|
AppMenuInterface *appMenuForSurface(SurfaceInterface *);
|
2017-12-18 21:50:31 +00:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* Emitted whenever a new AppmenuInterface is created.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-08-29 05:11:06 +00:00
|
|
|
void appMenuCreated(KWaylandServer::AppMenuInterface *);
|
2017-12-18 21:50:31 +00:00
|
|
|
|
|
|
|
private:
|
2020-05-30 15:35:36 +00:00
|
|
|
QScopedPointer<AppMenuManagerInterfacePrivate> d;
|
2017-12-18 21:50:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides the DBus service name and object path to a AppMenu DBus interface.
|
|
|
|
* This interface is attached to a wl_surface and provides access to where
|
|
|
|
* the AppMenu DBus interface is registered.
|
|
|
|
*/
|
2020-05-30 15:35:36 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT AppMenuInterface : public QObject
|
2017-12-18 21:50:31 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Structure containing DBus service name and path
|
|
|
|
*/
|
|
|
|
struct InterfaceAddress {
|
|
|
|
/** Service name of host with the AppMenu object*/
|
|
|
|
QString serviceName;
|
|
|
|
/** Object path of the AppMenu interface*/
|
|
|
|
QString objectPath;
|
|
|
|
};
|
2020-05-30 15:35:36 +00:00
|
|
|
~AppMenuInterface() override;
|
2017-12-18 21:50:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns the service name and object path or empty strings if unset
|
|
|
|
*/
|
|
|
|
InterfaceAddress address() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns The SurfaceInterface this AppmenuInterface references.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2017-12-18 21:50:31 +00:00
|
|
|
SurfaceInterface *surface() const;
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* Emitted when the address changes or is first received
|
|
|
|
*/
|
2020-04-29 14:56:38 +00:00
|
|
|
void addressChanged(KWaylandServer::AppMenuInterface::InterfaceAddress);
|
2017-12-18 21:50:31 +00:00
|
|
|
|
|
|
|
private:
|
2020-05-30 15:35:36 +00:00
|
|
|
explicit AppMenuInterface(SurfaceInterface *s, wl_resource *resource);
|
|
|
|
friend class AppMenuManagerInterfacePrivate;
|
|
|
|
|
|
|
|
QScopedPointer<AppMenuInterfacePrivate> d;
|
2017-12-18 21:50:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|