Changeset View
Changeset View
Standalone View
Standalone View
src/server/server_decoration_palette_interface.h
- This file was added.
1 | /**************************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright 2017 David Edmundson <kde@davidedmundson.co.uk> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Lesser General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | later version accepted by the membership of KDE e.V. (or its | ||||
9 | successor approved by the membership of KDE e.V.), which shall | ||||
10 | act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | | ||||
12 | This library is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | Lesser General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU Lesser General Public | ||||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | ****************************************************************************/ | ||||
20 | #ifndef KWAYLAND_SERVER_DECORATION_PALETTE_H | ||||
21 | #define KWAYLAND_SERVER_DECORATION_PALETTE_H | ||||
22 | | ||||
23 | #include "global.h" | ||||
24 | #include "resource.h" | ||||
25 | | ||||
26 | #include <KWayland/Server/kwaylandserver_export.h> | ||||
27 | | ||||
28 | namespace KWayland | ||||
29 | { | ||||
30 | namespace Server | ||||
31 | { | ||||
32 | | ||||
33 | class Display; | ||||
34 | class SurfaceInterface; | ||||
35 | class ServerSideDecorationPaletteInterface; | ||||
36 | | ||||
37 | /** | ||||
38 | * Allows a client to specify a preferred palette to use for server-side window decorations | ||||
39 | * | ||||
40 | * This global can be used for clients to bind ServerSideDecorationPaletteInterface instances | ||||
41 | * and notifies when a new one is created | ||||
42 | * @since 5.42 | ||||
43 | */ | ||||
44 | class KWAYLANDSERVER_EXPORT ServerSideDecorationPaletteManagerInterface : public Global | ||||
45 | { | ||||
46 | Q_OBJECT | ||||
47 | public: | ||||
48 | virtual ~ServerSideDecorationPaletteManagerInterface(); | ||||
49 | /** | ||||
50 | * Returns any existing palette for a given surface | ||||
51 | * This returns a null pointer if no ServerSideDecorationPaletteInterface exists. | ||||
52 | */ | ||||
53 | ServerSideDecorationPaletteInterface* paletteForSurface(SurfaceInterface *); | ||||
54 | | ||||
55 | Q_SIGNALS: | ||||
56 | /** | ||||
57 | * Emitted whenever a new ServerSideDecorationPaletteInterface is created. | ||||
58 | **/ | ||||
59 | void paletteCreated(KWayland::Server::ServerSideDecorationPaletteInterface*); | ||||
60 | | ||||
61 | private: | ||||
62 | explicit ServerSideDecorationPaletteManagerInterface(Display *display, QObject *parent = nullptr); | ||||
63 | friend class Display; | ||||
64 | class Private; | ||||
65 | Private *d_func() const; | ||||
66 | }; | ||||
67 | | ||||
68 | /** | ||||
69 | * Provides the palette | ||||
70 | * This interface is attached to a wl_surface and informs the server of a requested palette | ||||
71 | * @since 5.42 | ||||
72 | */ | ||||
73 | class KWAYLANDSERVER_EXPORT ServerSideDecorationPaletteInterface : public Resource | ||||
74 | { | ||||
75 | Q_OBJECT | ||||
76 | public: | ||||
77 | virtual ~ServerSideDecorationPaletteInterface(); | ||||
78 | | ||||
79 | /** | ||||
80 | * @returns the palette or an empty string if unset | ||||
81 | */ | ||||
82 | QString palette() const; | ||||
83 | | ||||
84 | /** | ||||
85 | * @returns The SurfaceInterface this ServerSideDecorationPaletteInterface references. | ||||
86 | **/ | ||||
87 | SurfaceInterface *surface() const; | ||||
88 | | ||||
89 | Q_SIGNALS: | ||||
90 | /** | ||||
91 | * Emitted when the palette changes or is first received | ||||
92 | */ | ||||
93 | void paletteChanged(const QString &palette); | ||||
94 | | ||||
95 | private: | ||||
96 | explicit ServerSideDecorationPaletteInterface(ServerSideDecorationPaletteManagerInterface *parent, SurfaceInterface *s, wl_resource *parentResource); | ||||
97 | friend class ServerSideDecorationPaletteManagerInterface; | ||||
98 | | ||||
99 | class Private; | ||||
100 | Private *d_func() const; | ||||
101 | }; | ||||
102 | | ||||
103 | } | ||||
104 | } | ||||
105 | | ||||
106 | #endif |