Changeset View
Changeset View
Standalone View
Standalone View
plugins/windowsystem/windowsystem.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2019 Martin Flöser <mgraesslin@kde.org> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2 of | ||||
7 | * the License or (at your option) version 3 or any later version | ||||
8 | * accepted by the membership of KDE e.V. (or its successor approved | ||||
9 | * by the membership of KDE e.V.), which shall act as a proxy | ||||
10 | * defined in Section 14 of version 3 of the license. | ||||
11 | * | ||||
12 | * This program 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 | ||||
15 | * GNU General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU General Public License | ||||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | #include "windowsystem.h" | ||||
21 | | ||||
22 | #include <KWindowSystem/KWindowSystem> | ||||
23 | | ||||
24 | #include <QGuiApplication> | ||||
25 | #include <QWindow> | ||||
26 | | ||||
27 | Q_DECLARE_METATYPE(NET::WindowType) | ||||
28 | | ||||
29 | namespace KWin | ||||
30 | { | ||||
31 | | ||||
32 | WindowSystem::WindowSystem() | ||||
33 | : QObject() | ||||
34 | , KWindowSystemPrivate() | ||||
35 | { | ||||
36 | } | ||||
37 | | ||||
38 | void WindowSystem::activateWindow(WId win, long int time) | ||||
39 | { | ||||
40 | Q_UNUSED(win) | ||||
41 | Q_UNUSED(time) | ||||
42 | // KWin cannot activate own windows | ||||
43 | } | ||||
44 | | ||||
45 | void WindowSystem::forceActiveWindow(WId win, long int time) | ||||
46 | { | ||||
47 | Q_UNUSED(win) | ||||
48 | Q_UNUSED(time) | ||||
49 | // KWin cannot activate own windows | ||||
50 | } | ||||
51 | | ||||
52 | WId WindowSystem::activeWindow() | ||||
53 | { | ||||
54 | // KWin internal should not use KWindowSystem to find active window | ||||
55 | return 0; | ||||
56 | } | ||||
57 | | ||||
58 | bool WindowSystem::allowedActionsSupported() | ||||
59 | { | ||||
60 | return false; | ||||
61 | } | ||||
62 | | ||||
63 | void WindowSystem::allowExternalProcessWindowActivation(int pid) | ||||
64 | { | ||||
65 | Q_UNUSED(pid) | ||||
66 | } | ||||
67 | | ||||
68 | bool WindowSystem::compositingActive() | ||||
69 | { | ||||
70 | // wayland is always composited | ||||
71 | return true; | ||||
72 | } | ||||
73 | | ||||
74 | void WindowSystem::connectNotify(const QMetaMethod &signal) | ||||
75 | { | ||||
76 | Q_UNUSED(signal) | ||||
77 | } | ||||
78 | | ||||
79 | QPoint WindowSystem::constrainViewportRelativePosition(const QPoint &pos) | ||||
80 | { | ||||
81 | Q_UNUSED(pos) | ||||
82 | return QPoint(); | ||||
83 | } | ||||
84 | | ||||
85 | int WindowSystem::currentDesktop() | ||||
86 | { | ||||
87 | // KWin internal should not use KWindowSystem to find current desktop | ||||
88 | return 0; | ||||
89 | } | ||||
90 | | ||||
91 | void WindowSystem::demandAttention(WId win, bool set) | ||||
92 | { | ||||
93 | Q_UNUSED(win) | ||||
94 | Q_UNUSED(set) | ||||
95 | } | ||||
96 | | ||||
97 | QString WindowSystem::desktopName(int desktop) | ||||
98 | { | ||||
99 | Q_UNUSED(desktop) | ||||
100 | return QString(); | ||||
101 | } | ||||
102 | | ||||
103 | QPoint WindowSystem::desktopToViewport(int desktop, bool absolute) | ||||
104 | { | ||||
105 | Q_UNUSED(desktop) | ||||
106 | Q_UNUSED(absolute) | ||||
107 | return QPoint(); | ||||
108 | } | ||||
109 | | ||||
110 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | ||||
111 | WId WindowSystem::groupLeader(WId window) | ||||
112 | { | ||||
113 | Q_UNUSED(window) | ||||
114 | return 0; | ||||
115 | } | ||||
116 | #endif | ||||
117 | | ||||
118 | bool WindowSystem::icccmCompliantMappingState() | ||||
119 | { | ||||
120 | return false; | ||||
121 | } | ||||
122 | | ||||
123 | QPixmap WindowSystem::icon(WId win, int width, int height, bool scale, int flags) | ||||
124 | { | ||||
125 | Q_UNUSED(win) | ||||
126 | Q_UNUSED(width) | ||||
127 | Q_UNUSED(height) | ||||
128 | Q_UNUSED(scale) | ||||
129 | Q_UNUSED(flags) | ||||
130 | return QPixmap(); | ||||
131 | } | ||||
132 | | ||||
133 | void WindowSystem::lowerWindow(WId win) | ||||
134 | { | ||||
135 | Q_UNUSED(win) | ||||
136 | } | ||||
137 | | ||||
138 | bool WindowSystem::mapViewport() | ||||
139 | { | ||||
140 | return false; | ||||
141 | } | ||||
142 | | ||||
143 | void WindowSystem::minimizeWindow(WId win) | ||||
144 | { | ||||
145 | Q_UNUSED(win) | ||||
146 | } | ||||
147 | | ||||
148 | void WindowSystem::unminimizeWindow(WId win) | ||||
149 | { | ||||
150 | Q_UNUSED(win) | ||||
151 | } | ||||
152 | | ||||
153 | int WindowSystem::numberOfDesktops() | ||||
154 | { | ||||
155 | // KWin internal should not use KWindowSystem to find number of desktops | ||||
156 | return 1; | ||||
157 | } | ||||
158 | | ||||
159 | void WindowSystem::raiseWindow(WId win) | ||||
160 | { | ||||
161 | Q_UNUSED(win) | ||||
162 | } | ||||
163 | | ||||
164 | QString WindowSystem::readNameProperty(WId window, long unsigned int atom) | ||||
165 | { | ||||
166 | Q_UNUSED(window) | ||||
167 | Q_UNUSED(atom) | ||||
168 | return QString(); | ||||
169 | } | ||||
170 | | ||||
171 | void WindowSystem::setBlockingCompositing(WId window, bool active) | ||||
172 | { | ||||
173 | Q_UNUSED(window) | ||||
174 | Q_UNUSED(active) | ||||
175 | } | ||||
176 | | ||||
177 | void WindowSystem::setCurrentDesktop(int desktop) | ||||
178 | { | ||||
179 | Q_UNUSED(desktop) | ||||
180 | // KWin internal should not use KWindowSystem to set current desktop | ||||
181 | } | ||||
182 | | ||||
183 | void WindowSystem::setDesktopName(int desktop, const QString &name) | ||||
184 | { | ||||
185 | Q_UNUSED(desktop) | ||||
186 | Q_UNUSED(name) | ||||
187 | // KWin internal should not use KWindowSystem to set desktop name | ||||
188 | } | ||||
189 | | ||||
190 | void WindowSystem::setExtendedStrut(WId win, int left_width, int left_start, int left_end, int right_width, int right_start, int right_end, int top_width, int top_start, int top_end, int bottom_width, int bottom_start, int bottom_end) | ||||
191 | { | ||||
192 | Q_UNUSED(win) | ||||
193 | Q_UNUSED(left_width) | ||||
194 | Q_UNUSED(left_start) | ||||
195 | Q_UNUSED(left_end) | ||||
196 | Q_UNUSED(right_width) | ||||
197 | Q_UNUSED(right_start) | ||||
198 | Q_UNUSED(right_end) | ||||
199 | Q_UNUSED(top_width) | ||||
200 | Q_UNUSED(top_start) | ||||
201 | Q_UNUSED(top_end) | ||||
202 | Q_UNUSED(bottom_width) | ||||
203 | Q_UNUSED(bottom_start) | ||||
204 | Q_UNUSED(bottom_end) | ||||
205 | } | ||||
206 | | ||||
207 | void WindowSystem::setStrut(WId win, int left, int right, int top, int bottom) | ||||
208 | { | ||||
209 | Q_UNUSED(win) | ||||
210 | Q_UNUSED(left) | ||||
211 | Q_UNUSED(right) | ||||
212 | Q_UNUSED(top) | ||||
213 | Q_UNUSED(bottom) | ||||
214 | } | ||||
215 | | ||||
216 | void WindowSystem::setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon) | ||||
217 | { | ||||
218 | Q_UNUSED(win) | ||||
219 | Q_UNUSED(icon) | ||||
220 | Q_UNUSED(miniIcon) | ||||
221 | } | ||||
222 | | ||||
223 | void WindowSystem::setOnActivities(WId win, const QStringList &activities) | ||||
224 | { | ||||
225 | Q_UNUSED(win) | ||||
226 | Q_UNUSED(activities) | ||||
227 | } | ||||
228 | | ||||
229 | void WindowSystem::setOnAllDesktops(WId win, bool b) | ||||
230 | { | ||||
231 | Q_UNUSED(win) | ||||
232 | Q_UNUSED(b) | ||||
233 | } | ||||
234 | | ||||
235 | void WindowSystem::setOnDesktop(WId win, int desktop) | ||||
236 | { | ||||
237 | Q_UNUSED(win) | ||||
238 | Q_UNUSED(desktop) | ||||
239 | } | ||||
240 | | ||||
241 | void WindowSystem::setShowingDesktop(bool showing) | ||||
242 | { | ||||
243 | Q_UNUSED(showing) | ||||
244 | // KWin should not use KWindowSystem to set showing desktop state | ||||
245 | } | ||||
246 | | ||||
247 | void WindowSystem::clearState(WId win, NET::States state) | ||||
248 | { | ||||
249 | // KWin's windows don't support state | ||||
250 | Q_UNUSED(win) | ||||
251 | Q_UNUSED(state) | ||||
252 | } | ||||
253 | | ||||
254 | void WindowSystem::setState(WId win, NET::States state) | ||||
255 | { | ||||
256 | // KWin's windows don't support state | ||||
257 | Q_UNUSED(win) | ||||
258 | Q_UNUSED(state) | ||||
259 | } | ||||
260 | | ||||
261 | void WindowSystem::setType(WId win, NET::WindowType windowType) | ||||
262 | { | ||||
263 | const auto windows = qApp->allWindows(); | ||||
264 | auto it = std::find_if(windows.begin(), windows.end(), [win] (QWindow *w) { return w->winId() == win; }); | ||||
265 | if (it == windows.end()) { | ||||
266 | return; | ||||
267 | } | ||||
268 | | ||||
269 | (*it)->setProperty("kwin_windowType", QVariant::fromValue(windowType)); | ||||
270 | } | ||||
271 | | ||||
272 | void WindowSystem::setUserTime(WId win, long int time) | ||||
273 | { | ||||
274 | Q_UNUSED(win) | ||||
275 | Q_UNUSED(time) | ||||
276 | } | ||||
277 | | ||||
278 | bool WindowSystem::showingDesktop() | ||||
279 | { | ||||
280 | // KWin should not use KWindowSystem for showing desktop state | ||||
281 | return false; | ||||
282 | } | ||||
283 | | ||||
284 | QList< WId > WindowSystem::stackingOrder() | ||||
285 | { | ||||
286 | // KWin should not use KWindowSystem for stacking order | ||||
287 | return {}; | ||||
288 | } | ||||
289 | | ||||
290 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | ||||
291 | WId WindowSystem::transientFor(WId window) | ||||
292 | { | ||||
293 | Q_UNUSED(window) | ||||
294 | return 0; | ||||
295 | } | ||||
296 | #endif | ||||
297 | | ||||
298 | int WindowSystem::viewportToDesktop(const QPoint &pos) | ||||
299 | { | ||||
300 | Q_UNUSED(pos) | ||||
301 | return 0; | ||||
302 | } | ||||
303 | | ||||
304 | int WindowSystem::viewportWindowToDesktop(const QRect &r) | ||||
305 | { | ||||
306 | Q_UNUSED(r) | ||||
307 | return 0; | ||||
308 | } | ||||
309 | | ||||
310 | QList< WId > WindowSystem::windows() | ||||
311 | { | ||||
312 | return {}; | ||||
313 | } | ||||
314 | | ||||
315 | QRect WindowSystem::workArea(const QList< WId > &excludes, int desktop) | ||||
316 | { | ||||
317 | Q_UNUSED(excludes) | ||||
318 | Q_UNUSED(desktop) | ||||
319 | return {}; | ||||
320 | } | ||||
321 | | ||||
322 | QRect WindowSystem::workArea(int desktop) | ||||
323 | { | ||||
324 | Q_UNUSED(desktop) | ||||
325 | return {}; | ||||
326 | } | ||||
327 | | ||||
328 | } |