2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
|
2015-12-10 08:39:24 +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
|
2015-12-10 08:39:24 +00:00
|
|
|
|
2020-07-14 14:25:55 +00:00
|
|
|
#include <QObject>
|
2015-12-10 08:39:24 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
#include <KWaylandServer/kwaylandserver_export.h>
|
2015-12-10 08:39:24 +00:00
|
|
|
|
2020-07-14 14:25:55 +00:00
|
|
|
struct wl_resource;
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2015-12-10 08:39:24 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
class Display;
|
|
|
|
class ServerSideDecorationInterface;
|
|
|
|
class SurfaceInterface;
|
2020-07-14 14:25:55 +00:00
|
|
|
class ServerSideDecorationManagerInterfacePrivate;
|
|
|
|
class ServerSideDecorationInterfacePrivate;
|
2015-12-10 08:39:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Manager to create ServerSideDecorationInterface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-07-14 14:25:55 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT ServerSideDecorationManagerInterface : public QObject
|
2015-12-10 08:39:24 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-12-09 20:13:19 +00:00
|
|
|
|
2015-12-10 08:39:24 +00:00
|
|
|
public:
|
2020-12-09 20:13:19 +00:00
|
|
|
explicit ServerSideDecorationManagerInterface(Display *display, QObject *parent = nullptr);
|
2020-07-14 14:25:55 +00:00
|
|
|
~ServerSideDecorationManagerInterface() override;
|
2015-12-10 08:39:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Decoration mode used for SurfaceInterfaces.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-10 08:39:24 +00:00
|
|
|
enum class Mode {
|
|
|
|
/**
|
|
|
|
* Undecorated: neither client, nor server provide decoration. Example: popups.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-10 08:39:24 +00:00
|
|
|
None,
|
|
|
|
/**
|
|
|
|
* The decoration is part of the surface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-10 08:39:24 +00:00
|
|
|
Client,
|
|
|
|
/**
|
|
|
|
* The surface gets embedded into a decoration frame provided by the Server.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-04-29 09:45:00 +00:00
|
|
|
Server,
|
2015-12-10 08:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the default @p mode which is pushed to the Clients on creating a ServerSideDecorationInterface.
|
|
|
|
* @param mode The new default mode.
|
|
|
|
* @see defaultMode
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-10 08:39:24 +00:00
|
|
|
void setDefaultMode(Mode mode);
|
|
|
|
/**
|
|
|
|
* @returns the current default mode.
|
|
|
|
* @see setDefaultMode
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-10 08:39:24 +00:00
|
|
|
Mode defaultMode() const;
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* Emitted whenever a new ServerSideDecorationInterface is created.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-04-29 14:56:38 +00:00
|
|
|
void decorationCreated(KWaylandServer::ServerSideDecorationInterface*);
|
2015-12-10 08:39:24 +00:00
|
|
|
|
|
|
|
private:
|
2020-07-14 14:25:55 +00:00
|
|
|
QScopedPointer<ServerSideDecorationManagerInterfacePrivate> d;
|
2015-12-10 08:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Representing how a SurfaceInterface should be decorated.
|
|
|
|
*
|
|
|
|
* Created by ServerSideDecorationManagerInterface and emitted with decorationCreated signal.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-07-14 14:25:55 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT ServerSideDecorationInterface : public QObject
|
2015-12-10 08:39:24 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-07-14 14:25:55 +00:00
|
|
|
~ServerSideDecorationInterface() override;
|
2015-12-10 08:39:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the @p mode on the SurfaceInterface. A client might refuse the provided @p mode,
|
|
|
|
* in that case modeRequested will be emitted.
|
|
|
|
* @see mode
|
|
|
|
* @see modeRequested
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-10 08:39:24 +00:00
|
|
|
void setMode(ServerSideDecorationManagerInterface::Mode mode);
|
|
|
|
/**
|
|
|
|
* @returns the currently set mode, not the requested mode.
|
|
|
|
* @see setMode
|
|
|
|
* @see modeRequested
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-10 08:39:24 +00:00
|
|
|
ServerSideDecorationManagerInterface::Mode mode() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns The SurfaceInterface this ServerSideDecorationInterface references.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-10 08:39:24 +00:00
|
|
|
SurfaceInterface *surface() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns The ServerSideDecorationInterface for the given @p surface, @c nullptr if there is none.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-10 08:39:24 +00:00
|
|
|
static ServerSideDecorationInterface *get(SurfaceInterface *surface);
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* The client requested the provided mode.
|
|
|
|
* The server needs to acknowledge the requested mode by setting it through setMode.
|
|
|
|
* @see setMode
|
|
|
|
* @see mode
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-04-29 14:56:38 +00:00
|
|
|
void modeRequested(KWaylandServer::ServerSideDecorationManagerInterface::Mode);
|
2015-12-10 08:39:24 +00:00
|
|
|
|
|
|
|
private:
|
2020-07-14 14:25:55 +00:00
|
|
|
explicit ServerSideDecorationInterface(SurfaceInterface *surface, wl_resource *resource);
|
|
|
|
friend class ServerSideDecorationManagerInterfacePrivate;
|
2015-12-10 08:39:24 +00:00
|
|
|
|
2020-07-14 14:25:55 +00:00
|
|
|
QScopedPointer<ServerSideDecorationInterfacePrivate> d;
|
2015-12-10 08:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
Q_DECLARE_METATYPE(KWaylandServer::ServerSideDecorationInterface*)
|
|
|
|
Q_DECLARE_METATYPE(KWaylandServer::ServerSideDecorationManagerInterface::Mode)
|