Changeset View
Changeset View
Standalone View
Standalone View
src/server/xdgoutput_interface.h
- This file was added.
1 | /**************************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright 2018 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_XDGOUTPUT_H | ||||
21 | #define KWAYLAND_SERVER_XDGOUTPUT_H | ||||
22 | | ||||
23 | #include "global.h" | ||||
24 | #include "resource.h" | ||||
25 | | ||||
26 | | ||||
27 | #include <KWayland/Server/kwaylandserver_export.h> | ||||
28 | | ||||
29 | | ||||
30 | /* | ||||
31 | * In terms of protocol XdgOutputInterface are a resource | ||||
32 | * but for the sake of sanity, we should treat XdgOutputs as globals like Output is | ||||
33 | * Hence this doesn't match most of kwayland API paradigms. | ||||
34 | */ | ||||
35 | | ||||
36 | namespace KWayland | ||||
37 | { | ||||
38 | namespace Server | ||||
39 | { | ||||
40 | | ||||
41 | class Display; | ||||
42 | class OutputInterface; | ||||
43 | class XdgOutputInterface; | ||||
44 | | ||||
45 | /** | ||||
46 | * Global manager for XdgOutputs | ||||
47 | * @since 5.XDGOUTPUT | ||||
48 | */ | ||||
49 | class KWAYLANDSERVER_EXPORT XdgOutputManagerInterface : public Global | ||||
50 | { | ||||
51 | Q_OBJECT | ||||
52 | public: | ||||
53 | virtual ~XdgOutputManagerInterface(); | ||||
54 | /** | ||||
55 | * Creates an XdgOutputInterface object for an existing Output | ||||
56 | * which exposes XDG specific properties of outputs | ||||
57 | * | ||||
58 | * @arg output the wl_output interface this XDG output is for | ||||
59 | * @parent the parent of the newly created object | ||||
60 | */ | ||||
61 | XdgOutputInterface* createXdgOutput(OutputInterface *output, QObject *parent); | ||||
62 | private: | ||||
63 | explicit XdgOutputManagerInterface(Display *display, QObject *parent = nullptr); | ||||
64 | friend class Display; | ||||
65 | class Private; | ||||
66 | Private *d_func() const; | ||||
67 | }; | ||||
68 | | ||||
69 | /** | ||||
70 | * Extension to Output | ||||
71 | * Users should set all relevant values on creation and on future changes. | ||||
72 | * done() should be explicitly called after change batches including initial setting. | ||||
73 | * @since 5.XDGOUTPUT | ||||
74 | */ | ||||
75 | class KWAYLANDSERVER_EXPORT XdgOutputInterface : public QObject | ||||
76 | { | ||||
77 | Q_OBJECT | ||||
78 | public: | ||||
79 | virtual ~XdgOutputInterface(); | ||||
80 | | ||||
81 | /** | ||||
82 | * Sets the size of this output in logical co-ordinates. | ||||
83 | * Users should call done() after setting all values | ||||
84 | */ | ||||
85 | void setLogicalSize(const QSize &size); | ||||
86 | | ||||
87 | /** | ||||
88 | * Returns the last set logical size on this output | ||||
89 | */ | ||||
90 | QSize logicalSize() const; | ||||
91 | | ||||
92 | /** | ||||
93 | * Sets the topleft position of this output in logical co-ordinates. | ||||
94 | * Users should call done() after setting all values | ||||
95 | * @see OutputInterface::setPosition | ||||
96 | */ | ||||
97 | void setLogicalPosition(const QPoint &pos); | ||||
98 | | ||||
99 | /** | ||||
100 | * Returns the last set logical position on this output | ||||
101 | */ | ||||
102 | QPoint logicalPosition() const; | ||||
103 | | ||||
104 | /** | ||||
105 | * Submit changes to all clients | ||||
106 | */ | ||||
107 | void done(); | ||||
108 | | ||||
109 | private: | ||||
110 | explicit XdgOutputInterface(QObject *parent); | ||||
111 | friend class XdgOutputManagerInterface; | ||||
112 | | ||||
113 | class Private; | ||||
114 | QScopedPointer<Private> d; | ||||
115 | }; | ||||
116 | | ||||
117 | | ||||
118 | } | ||||
119 | } | ||||
120 | | ||||
121 | #endif |