2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2017 David Edmundson <kde@davidedmundson.co.uk>
|
2018-01-03 10:24:57 +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
|
2018-01-03 10:24:57 +00:00
|
|
|
|
2020-07-13 07:41:56 +00:00
|
|
|
struct wl_resource;
|
2018-01-03 10:24:57 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
#include <KWaylandServer/kwaylandserver_export.h>
|
2021-08-29 05:11:06 +00:00
|
|
|
#include <QObject>
|
2018-01-03 10:24:57 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2018-01-03 10:24:57 +00:00
|
|
|
{
|
|
|
|
class Display;
|
|
|
|
class SurfaceInterface;
|
|
|
|
class ServerSideDecorationPaletteInterface;
|
2020-07-13 07:41:56 +00:00
|
|
|
class ServerSideDecorationPaletteManagerInterfacePrivate;
|
|
|
|
class ServerSideDecorationPaletteInterfacePrivate;
|
2018-01-03 10:24:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allows a client to specify a preferred palette to use for server-side window decorations
|
|
|
|
*
|
|
|
|
* This global can be used for clients to bind ServerSideDecorationPaletteInterface instances
|
|
|
|
* and notifies when a new one is created
|
|
|
|
*/
|
2020-07-13 07:41:56 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT ServerSideDecorationPaletteManagerInterface : public QObject
|
2018-01-03 10:24:57 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-12-09 20:13:19 +00:00
|
|
|
|
2018-01-03 10:24:57 +00:00
|
|
|
public:
|
2020-12-09 20:13:19 +00:00
|
|
|
explicit ServerSideDecorationPaletteManagerInterface(Display *display, QObject *parent = nullptr);
|
2020-07-13 07:41:56 +00:00
|
|
|
~ServerSideDecorationPaletteManagerInterface() override;
|
2018-01-03 10:24:57 +00:00
|
|
|
/**
|
|
|
|
* Returns any existing palette for a given surface
|
|
|
|
* This returns a null pointer if no ServerSideDecorationPaletteInterface exists.
|
|
|
|
*/
|
2021-08-29 05:11:06 +00:00
|
|
|
ServerSideDecorationPaletteInterface *paletteForSurface(SurfaceInterface *);
|
2018-01-03 10:24:57 +00:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* Emitted whenever a new ServerSideDecorationPaletteInterface is created.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-08-29 05:11:06 +00:00
|
|
|
void paletteCreated(KWaylandServer::ServerSideDecorationPaletteInterface *);
|
2018-01-03 10:24:57 +00:00
|
|
|
|
|
|
|
private:
|
2020-07-13 07:41:56 +00:00
|
|
|
QScopedPointer<ServerSideDecorationPaletteManagerInterfacePrivate> d;
|
2018-01-03 10:24:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides the palette
|
|
|
|
* This interface is attached to a wl_surface and informs the server of a requested palette
|
|
|
|
*/
|
2020-07-13 07:41:56 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT ServerSideDecorationPaletteInterface : public QObject
|
2018-01-03 10:24:57 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-07-13 07:41:56 +00:00
|
|
|
~ServerSideDecorationPaletteInterface() override;
|
2018-01-03 10:24:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns the palette or an empty string if unset
|
|
|
|
*/
|
|
|
|
QString palette() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns The SurfaceInterface this ServerSideDecorationPaletteInterface references.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2018-01-03 10:24:57 +00:00
|
|
|
SurfaceInterface *surface() const;
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* Emitted when the palette changes or is first received
|
|
|
|
*/
|
|
|
|
void paletteChanged(const QString &palette);
|
|
|
|
|
|
|
|
private:
|
2020-07-13 07:41:56 +00:00
|
|
|
explicit ServerSideDecorationPaletteInterface(SurfaceInterface *surface, wl_resource *resource);
|
|
|
|
friend class ServerSideDecorationPaletteManagerInterfacePrivate;
|
2018-01-03 10:24:57 +00:00
|
|
|
|
2020-07-13 07:41:56 +00:00
|
|
|
QScopedPointer<ServerSideDecorationPaletteInterfacePrivate> d;
|
2018-01-03 10:24:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|