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 | * | ||||
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 | * | ||||
71 | * @since 5.XDGOUTPUT | ||||
72 | */ | ||||
73 | class KWAYLANDSERVER_EXPORT XdgOutputInterface : public QObject | ||||
74 | { | ||||
75 | Q_OBJECT | ||||
76 | public: | ||||
77 | virtual ~XdgOutputInterface(); | ||||
78 | | ||||
79 | /** | ||||
80 | * Sets the size of this output in logical co-ordinates. | ||||
81 | * Users should call done() after setting all values | ||||
82 | */ | ||||
83 | void setLogicalSize(const QSize &size); | ||||
84 | | ||||
85 | /** | ||||
86 | * Returns the last set logical size on this output | ||||
87 | */ | ||||
88 | QSize logicalSize() const; | ||||
89 | | ||||
90 | /** | ||||
91 | * Sets the topleft position of this output in logical co-ordinates. | ||||
92 | * Users should call done() after setting all values | ||||
93 | * @see OutputInterface::setPosition | ||||
94 | */ | ||||
95 | void setLogicalPosition(const QPoint &pos); | ||||
96 | | ||||
97 | /** | ||||
98 | * Returns the last set logical position on this output | ||||
99 | */ | ||||
100 | QPoint logicalPosition() const; | ||||
101 | | ||||
102 | /** | ||||
103 | * Submit changes to all clients | ||||
104 | */ | ||||
105 | void done(); | ||||
106 | | ||||
107 | private: | ||||
108 | explicit XdgOutputInterface(QObject *parent); | ||||
109 | friend class XdgOutputManagerInterface; | ||||
110 | | ||||
111 | class Private; | ||||
112 | QScopedPointer<Private> d; | ||||
113 | }; | ||||
114 | | ||||
115 | | ||||
116 | } | ||||
117 | } | ||||
118 | | ||||
119 | #endif |