KWindowSystem

kwindowsystem.cpp
1 /*
2  SPDX-FileCopyrightText: 2014 Martin Gräßlin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #include "kwindowsystem.h"
7 #include "kwindowsystem_dummy_p.h"
8 #include "kwindowsystemplugininterface_p.h"
9 #include "pluginwrapper_p.h"
10 
11 #include <config-kwindowsystem.h>
12 
13 #include <QGuiApplication>
14 #include <QMetaMethod>
15 #include <QPixmap>
16 #include <QPluginLoader>
17 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62)
18 #include <QWidget>
19 #endif
20 #include <QWindow>
21 #if KWINDOWSYSTEM_HAVE_X11
22 #include <QX11Info>
23 #endif
24 
25 //QPoint and QSize all have handy / operators which are useful for scaling, positions and sizes for high DPI support
26 //QRect does not, so we create one for internal purposes within this class
27 inline QRect operator/(const QRect &rectangle, qreal factor)
28 {
29  return QRect(rectangle.topLeft() / factor, rectangle.size() / factor);
30 }
31 
32 class KWindowSystemStaticContainer
33 {
34 public:
35  KWindowSystemStaticContainer() {
36  d.reset(KWindowSystemPluginWrapper::self().createWindowSystem());
37 
39  kwm.moveToThread(QCoreApplication::instance()->thread());
40  }
41  }
42  KWindowSystemPrivate *xcbPlugin() {
43  if (xcbPrivate.isNull()) {
44  QPluginLoader loader(QStringLiteral(XCB_PLUGIN_PATH));
45  QScopedPointer<KWindowSystemPluginInterface> xcbPlugin(qobject_cast< KWindowSystemPluginInterface* >(loader.instance()));
46  if (!xcbPlugin.isNull()) {
47  xcbPrivate.reset(xcbPlugin->createWindowSystem());
48  }
49  }
50  return xcbPrivate.data();
51  }
52  KWindowSystem kwm;
55 };
56 
57 Q_GLOBAL_STATIC(KWindowSystemStaticContainer, g_kwmInstanceContainer)
58 
59 KWindowSystemPrivate::~KWindowSystemPrivate()
60 {
61 }
62 
63 QPixmap KWindowSystemPrivate::iconFromNetWinInfo(int width, int height, bool scale, int flags, NETWinInfo *info)
64 {
65  Q_UNUSED(width)
66  Q_UNUSED(height)
67  Q_UNUSED(scale)
68  Q_UNUSED(flags)
69  Q_UNUSED(info)
70  return QPixmap();
71 }
72 
73 QList<WId> KWindowSystemPrivateDummy::windows()
74 {
75  return QList<WId>();
76 }
77 
78 QList<WId> KWindowSystemPrivateDummy::stackingOrder()
79 {
80  return QList<WId>();
81 }
82 
83 WId KWindowSystemPrivateDummy::activeWindow()
84 {
85  return 0;
86 }
87 
88 void KWindowSystemPrivateDummy::activateWindow(WId win, long time)
89 {
90  Q_UNUSED(win)
91  Q_UNUSED(time)
92 }
93 
94 void KWindowSystemPrivateDummy::forceActiveWindow(WId win, long time)
95 {
96  Q_UNUSED(win)
97  Q_UNUSED(time)
98 }
99 
100 void KWindowSystemPrivateDummy::demandAttention(WId win, bool set)
101 {
102  Q_UNUSED(win)
103  Q_UNUSED(set)
104 }
105 
106 bool KWindowSystemPrivateDummy::compositingActive()
107 {
108  return false;
109 }
110 
111 int KWindowSystemPrivateDummy::currentDesktop()
112 {
113  return 0;
114 }
115 
116 int KWindowSystemPrivateDummy::numberOfDesktops()
117 {
118  return 0;
119 }
120 
121 void KWindowSystemPrivateDummy::setCurrentDesktop(int desktop)
122 {
123  Q_UNUSED(desktop)
124 }
125 
126 void KWindowSystemPrivateDummy::setOnAllDesktops(WId win, bool b)
127 {
128  Q_UNUSED(win)
129  Q_UNUSED(b)
130 }
131 
132 void KWindowSystemPrivateDummy::setOnDesktop(WId win, int desktop)
133 {
134  Q_UNUSED(win)
135  Q_UNUSED(desktop)
136 }
137 
138 void KWindowSystemPrivateDummy::setOnActivities(WId win, const QStringList &activities)
139 {
140  Q_UNUSED(win)
141  Q_UNUSED(activities)
142 }
143 
144 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
145 WId KWindowSystemPrivateDummy::transientFor(WId window)
146 {
147  Q_UNUSED(window)
148  return 0;
149 }
150 
151 WId KWindowSystemPrivateDummy::groupLeader(WId window)
152 {
153  Q_UNUSED(window)
154  return 0;
155 }
156 #endif
157 
158 QPixmap KWindowSystemPrivateDummy::icon(WId win, int width, int height, bool scale, int flags)
159 {
160  Q_UNUSED(win)
161  Q_UNUSED(width)
162  Q_UNUSED(height)
163  Q_UNUSED(scale)
164  Q_UNUSED(flags)
165  return QPixmap();
166 }
167 
168 void KWindowSystemPrivateDummy::setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon)
169 {
170  Q_UNUSED(win)
171  Q_UNUSED(icon)
172  Q_UNUSED(miniIcon)
173 }
174 
175 void KWindowSystemPrivateDummy::setType(WId win, NET::WindowType windowType)
176 {
177  Q_UNUSED(win)
178  Q_UNUSED(windowType)
179 }
180 
181 void KWindowSystemPrivateDummy::setState(WId win, NET::States state)
182 {
183  Q_UNUSED(win)
184  Q_UNUSED(state)
185 }
186 
187 void KWindowSystemPrivateDummy::clearState(WId win, NET::States state)
188 {
189  Q_UNUSED(win)
190  Q_UNUSED(state)
191 }
192 
193 void KWindowSystemPrivateDummy::minimizeWindow(WId win)
194 {
195  Q_UNUSED(win)
196 }
197 
198 void KWindowSystemPrivateDummy::unminimizeWindow(WId win)
199 {
200  Q_UNUSED(win)
201 }
202 
203 void KWindowSystemPrivateDummy::raiseWindow(WId win)
204 {
205  Q_UNUSED(win)
206 }
207 
208 void KWindowSystemPrivateDummy::lowerWindow(WId win)
209 {
210  Q_UNUSED(win)
211 }
212 
213 bool KWindowSystemPrivateDummy::icccmCompliantMappingState()
214 {
215  return false;
216 }
217 
218 QRect KWindowSystemPrivateDummy::workArea(int desktop)
219 {
220  Q_UNUSED(desktop)
221  return QRect();
222 }
223 
224 QRect KWindowSystemPrivateDummy::workArea(const QList<WId> &excludes, int desktop)
225 {
226  Q_UNUSED(excludes)
227  Q_UNUSED(desktop)
228  return QRect();
229 }
230 
231 QString KWindowSystemPrivateDummy::desktopName(int desktop)
232 {
233  Q_UNUSED(desktop)
234  return QString();
235 }
236 
237 void KWindowSystemPrivateDummy::setDesktopName(int desktop, const QString &name)
238 {
239  Q_UNUSED(desktop)
240  Q_UNUSED(name)
241 }
242 
243 bool KWindowSystemPrivateDummy::showingDesktop()
244 {
245  return false;
246 }
247 
248 void KWindowSystemPrivateDummy::setShowingDesktop(bool showing)
249 {
250  Q_UNUSED(showing);
251 }
252 
253 void KWindowSystemPrivateDummy::setUserTime(WId win, long time)
254 {
255  Q_UNUSED(win)
256  Q_UNUSED(time)
257 }
258 
259 void KWindowSystemPrivateDummy::setExtendedStrut(WId win, int left_width, int left_start, int left_end,
260  int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
261  int bottom_width, int bottom_start, int bottom_end)
262 {
263  Q_UNUSED(win)
264  Q_UNUSED(left_width)
265  Q_UNUSED(left_start)
266  Q_UNUSED(left_end)
267  Q_UNUSED(right_width)
268  Q_UNUSED(right_start)
269  Q_UNUSED(right_end)
270  Q_UNUSED(top_width)
271  Q_UNUSED(top_start)
272  Q_UNUSED(top_end)
273  Q_UNUSED(bottom_width)
274  Q_UNUSED(bottom_start)
275  Q_UNUSED(bottom_end)
276 }
277 
278 void KWindowSystemPrivateDummy::setStrut(WId win, int left, int right, int top, int bottom)
279 {
280  Q_UNUSED(win)
281  Q_UNUSED(left)
282  Q_UNUSED(right)
283  Q_UNUSED(top)
284  Q_UNUSED(bottom)
285 }
286 
287 bool KWindowSystemPrivateDummy::allowedActionsSupported()
288 {
289  return false;
290 }
291 
292 QString KWindowSystemPrivateDummy::readNameProperty(WId window, unsigned long atom)
293 {
294  Q_UNUSED(window)
295  Q_UNUSED(atom)
296  return QString();
297 }
298 
299 void KWindowSystemPrivateDummy::allowExternalProcessWindowActivation(int pid)
300 {
301  Q_UNUSED(pid)
302 }
303 
304 void KWindowSystemPrivateDummy::setBlockingCompositing(WId window, bool active)
305 {
306  Q_UNUSED(window)
307  Q_UNUSED(active)
308 }
309 
310 bool KWindowSystemPrivateDummy::mapViewport()
311 {
312  return false;
313 }
314 
315 int KWindowSystemPrivateDummy::viewportToDesktop(const QPoint &pos)
316 {
317  Q_UNUSED(pos)
318  return 0;
319 }
320 
321 int KWindowSystemPrivateDummy::viewportWindowToDesktop(const QRect &r)
322 {
323  Q_UNUSED(r)
324  return 0;
325 }
326 
327 QPoint KWindowSystemPrivateDummy::desktopToViewport(int desktop, bool absolute)
328 {
329  Q_UNUSED(desktop)
330  Q_UNUSED(absolute)
331  return QPoint();
332 }
333 
334 QPoint KWindowSystemPrivateDummy::constrainViewportRelativePosition(const QPoint &pos)
335 {
336  Q_UNUSED(pos)
337  return QPoint();
338 }
339 
340 void KWindowSystemPrivateDummy::connectNotify(const QMetaMethod &signal)
341 {
342  Q_UNUSED(signal)
343 }
344 
346 {
347  return &(g_kwmInstanceContainer()->kwm);
348 }
349 
350 KWindowSystemPrivate *KWindowSystem::d_func()
351 {
352  return g_kwmInstanceContainer()->d.data();
353 }
354 
355 void KWindowSystem::connectNotify(const QMetaMethod &signal)
356 {
357  Q_D(KWindowSystem);
358  d->connectNotify(signal);
359  QObject::connectNotify(signal);
360 }
361 
363 {
364  Q_D(KWindowSystem);
365  return d->windows();
366 }
367 
368 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
370 {
371  return KWindowInfo(win, properties, properties2);
372 }
373 #endif
374 
376 {
377  return windows().contains(w);
378 }
379 
381 {
382  Q_D(KWindowSystem);
383  return d->stackingOrder();
384 }
385 
387 {
388  Q_D(KWindowSystem);
389  return d->currentDesktop();
390 }
391 
393 {
394  Q_D(KWindowSystem);
395  return d->numberOfDesktops();
396 }
397 
399 {
400  Q_D(KWindowSystem);
401  d->setCurrentDesktop(desktop);
402 }
403 
404 void KWindowSystem::setOnAllDesktops(WId win, bool b)
405 {
406  Q_D(KWindowSystem);
407  d->setOnAllDesktops(win, b);
408 }
409 
410 void KWindowSystem::setOnDesktop(WId win, int desktop)
411 {
412  Q_D(KWindowSystem);
413  d->setOnDesktop(win, desktop);
414 }
415 
416 void KWindowSystem::setOnActivities(WId win, const QStringList &activities)
417 {
418  Q_D(KWindowSystem);
419  d->setOnActivities(win, activities);
420 }
421 
423 {
424  Q_D(KWindowSystem);
425  return d->activeWindow();
426 }
427 
428 void KWindowSystem::activateWindow(WId win, long time)
429 {
430  Q_D(KWindowSystem);
431  d->activateWindow(win, time);
432 }
433 
434 void KWindowSystem::forceActiveWindow(WId win, long time)
435 {
436  Q_D(KWindowSystem);
437  d->forceActiveWindow(win, time);
438 }
439 
440 void KWindowSystem::demandAttention(WId win, bool set)
441 {
442  Q_D(KWindowSystem);
443  d->demandAttention(win, set);
444 }
445 
446 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
448 {
449  Q_D(KWindowSystem);
450  return d->transientFor(win);
451 }
452 
453 void KWindowSystem::setMainWindow(QWidget *subWidget, WId mainWindowId)
454 {
455  // Set the WA_NativeWindow attribute to force the creation of the QWindow.
456  // Without this QWidget::windowHandle() returns 0.
457  subWidget->setAttribute(Qt::WA_NativeWindow, true);
458  QWindow *subWindow = subWidget->windowHandle();
459  Q_ASSERT(subWindow);
460  setMainWindow(subWindow, mainWindowId);
461 }
462 #endif
463 
464 void KWindowSystem::setMainWindow(QWindow *subWindow, WId mainWindowId)
465 {
466  QWindow *mainWindow = QWindow::fromWinId(mainWindowId);
467  if (mainWindow) { // foreign windows not supported on all platforms
468  subWindow->setTransientParent(mainWindow);
469 
470  // mainWindow is not the child of any object, so make sure it gets deleted at some point
471  connect(subWindow, &QObject::destroyed, mainWindow, &QObject::deleteLater);
472  }
473 }
474 
475 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
477 {
478  Q_D(KWindowSystem);
479  return d->groupLeader(win);
480 }
481 #endif
482 
483 QPixmap KWindowSystem::icon(WId win, int width, int height, bool scale)
484 {
485  return icon(win, width, height, scale, NETWM | WMHints | ClassHint | XApp);
486 }
487 
488 QPixmap KWindowSystem::icon(WId win, int width, int height, bool scale, int flags)
489 {
490  Q_D(KWindowSystem);
491  return d->icon(win, width, height, scale, flags);
492 }
493 
494 QPixmap KWindowSystem::icon(WId win, int width, int height, bool scale, int flags, NETWinInfo *info)
495 {
496  Q_D(KWindowSystem);
497  width *= qApp->devicePixelRatio();
498  height *= qApp->devicePixelRatio();
499 #if KWINDOWSYSTEM_HAVE_X11
500  if (info) {
501  if (isPlatformX11()) {
502  // this is the xcb plugin, we can just delegate
503  return d->iconFromNetWinInfo(width, height, scale, flags, info);
504  } else {
505  // other platform plugin, load xcb plugin to delegate to it
506  if (KWindowSystemPrivate *p = g_kwmInstanceContainer()->xcbPlugin()) {
507  return p->iconFromNetWinInfo(width, height, scale, flags, info);
508  }
509  }
510  }
511 #else
512  Q_UNUSED(info)
513 #endif
514  return d->icon(win, width, height, scale, flags);
515 }
516 
517 void KWindowSystem::setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon)
518 {
519  Q_D(KWindowSystem);
520  d->setIcons(win, icon, miniIcon);
521 }
522 
523 void KWindowSystem::setType(WId win, NET::WindowType windowType)
524 {
525  Q_D(KWindowSystem);
526  d->setType(win, windowType);
527 }
528 
530 {
531  Q_D(KWindowSystem);
532  d->setState(win, state);
533 }
534 
536 {
537  Q_D(KWindowSystem);
538  d->clearState(win, state);
539 }
540 
542 {
543  Q_D(KWindowSystem);
544  d->minimizeWindow(win);
545 }
546 
548 {
549  Q_D(KWindowSystem);
550  d->unminimizeWindow(win);
551 }
552 
553 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
554 void KWindowSystem::minimizeWindow(WId win, bool animation)
555 {
556  Q_UNUSED(animation)
557  minimizeWindow(win);
558 }
559 #endif
560 
561 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
562 void KWindowSystem::unminimizeWindow(WId win, bool animation)
563 {
564  Q_UNUSED(animation)
565  unminimizeWindow(win);
566 }
567 #endif
568 
570 {
571  Q_D(KWindowSystem);
572  d->raiseWindow(win);
573 }
574 
576 {
577  Q_D(KWindowSystem);
578  d->lowerWindow(win);
579 }
580 
582 {
583  Q_D(KWindowSystem);
584  return d->compositingActive();
585 }
586 
587 QRect KWindowSystem::workArea(int desktop)
588 {
589  Q_D(KWindowSystem);
590  return d->workArea(desktop) / qApp->devicePixelRatio();
591 }
592 
593 QRect KWindowSystem::workArea(const QList<WId> &exclude, int desktop)
594 {
595  Q_D(KWindowSystem);
596  return d->workArea(exclude, desktop) / qApp->devicePixelRatio();
597 }
598 
599 QString KWindowSystem::desktopName(int desktop)
600 {
601  Q_D(KWindowSystem);
602  return d->desktopName(desktop);
603 }
604 
605 void KWindowSystem::setDesktopName(int desktop, const QString &name)
606 {
607  Q_D(KWindowSystem);
608  d->setDesktopName(desktop, name);
609 }
610 
612 {
613  Q_D(KWindowSystem);
614  return d->showingDesktop();
615 }
616 
618 {
619  Q_D(KWindowSystem);
620  return d->setShowingDesktop(showing);
621 }
622 
623 void KWindowSystem::setUserTime(WId win, long time)
624 {
625  Q_D(KWindowSystem);
626  d->setUserTime(win, time);
627 }
628 
629 void KWindowSystem::setExtendedStrut(WId win, int left_width, int left_start, int left_end,
630  int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
631  int bottom_width, int bottom_start, int bottom_end)
632 {
633  Q_D(KWindowSystem);
634  const qreal dpr = qApp->devicePixelRatio();
635  d->setExtendedStrut(win, left_width * dpr, left_start * dpr, left_end * dpr,
636  right_width * dpr, right_start * dpr, right_end * dpr, top_width * dpr, top_start * dpr, top_end * dpr,
637  bottom_width * dpr, bottom_start * dpr, bottom_end * dpr);
638 }
639 
640 void KWindowSystem::setStrut(WId win, int left, int right, int top, int bottom)
641 {
642  Q_D(KWindowSystem);
643  const qreal dpr = qApp->devicePixelRatio();
644  d->setStrut(win, left * dpr, right * dpr, top * dpr, bottom * dpr);
645 }
646 
648 {
649  Q_D(KWindowSystem);
650  return d->icccmCompliantMappingState();
651 }
652 
654 {
655  Q_D(KWindowSystem);
656  return d->allowedActionsSupported();
657 }
658 
659 QString KWindowSystem::readNameProperty(WId win, unsigned long atom)
660 {
661  Q_D(KWindowSystem);
662  return d->readNameProperty(win, atom);
663 }
664 
666 {
667  Q_D(KWindowSystem);
668  d->allowExternalProcessWindowActivation(pid);
669 }
670 
671 void KWindowSystem::setBlockingCompositing(WId window, bool active)
672 {
673  Q_D(KWindowSystem);
674  d->setBlockingCompositing(window, active);
675 }
676 
678 {
679  Q_D(KWindowSystem);
680  return d->mapViewport();
681 }
682 
684 {
685  Q_D(KWindowSystem);
686  return d->viewportToDesktop(p / qApp->devicePixelRatio());
687 }
688 
690 {
691  Q_D(KWindowSystem);
692  return d->viewportWindowToDesktop(r / qApp->devicePixelRatio());
693 }
694 
695 QPoint KWindowSystem::desktopToViewport(int desktop, bool absolute)
696 {
697  Q_D(KWindowSystem);
698  return d->desktopToViewport(desktop, absolute);
699 }
700 
702 {
703  Q_D(KWindowSystem);
704  return d->constrainViewportRelativePosition(pos / qApp->devicePixelRatio());
705 }
706 
707 static inline KWindowSystem::Platform initPlatform()
708 {
709  auto platformName = QGuiApplication::platformName();
710  if (platformName == QLatin1String("flatpak")) {
711  // here we cannot know what is the actual windowing system, let's try it's env variable
712  const auto flatpakPlatform = QString::fromLocal8Bit(qgetenv("QT_QPA_FLATPAK_PLATFORM"));
713  if (!flatpakPlatform.isEmpty()) {
714  platformName = flatpakPlatform;
715  }
716  }
717 #if KWINDOWSYSTEM_HAVE_X11
718  if (platformName == QLatin1String("xcb")) {
720  }
721 #endif
722  if (platformName.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
724  }
726 }
727 
729 {
730  static Platform s_platform = initPlatform();
731  return s_platform;
732 }
733 
735 {
736  return platform() == Platform::X11;
737 }
738 
740 {
741  return platform() == Platform::Wayland;
742 }
static QString readNameProperty(WId window, unsigned long atom)
Function that reads and returns the contents of the given text property (WM_NAME, WM_ICON_NAME...
QSize size() const const
static void lowerWindow(WId win)
Lowers the given window.
static WId transientFor(WId window)
Returns the WM_TRANSIENT_FOR property for the given window, i.e.
static void setMainWindow(QWindow *subwindow, WId mainwindow)
Sets the parent window of subwindow to be mainwindow.
static QString desktopName(int desktop)
Returns the name of the specified desktop.
Convenience access to certain properties and features of the window manager.
Definition: kwindowsystem.h:44
static void setOnDesktop(WId win, int desktop)
Moves window win to desktop desktop.
static int viewportToDesktop(const QPoint &pos)
A platform unknown to the application is used.
static int viewportWindowToDesktop(const QRect &r)
void setAttribute(Qt::WidgetAttribute attribute, bool on)
This class provides information about a given window in the platform specific windowing system...
Definition: kwindowinfo.h:62
static void setUserTime(WId win, long time)
Sets user timestamp time on window win.
static void raiseWindow(WId win)
Raises the given window.
static void forceActiveWindow(WId win, long time=0)
Sets window win to be the active window.
static void setType(WId win, NET::WindowType windowType)
Sets the type of window win to windowType.
static void setOnActivities(WId win, const QStringList &activities)
Moves window win to activities activities.
static void 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)
Sets the strut of window win to left_width ranging from left_start to left_end on the left edge...
static void clearState(WId win, NET::States state)
Clears the state of window win from state.
static void activateWindow(WId win, long time=0)
Requests that window win is activated.
static int currentDesktop()
Returns the current virtual desktop.
static KWindowInfo windowInfo(WId win, NET::Properties properties, NET::Properties2 properties2=NET::Properties2())
Returns information about window win.
QString fromLocal8Bit(const char *str, int size)
static WId activeWindow()
Returns the currently active window, or 0 if no window is active.
static bool isPlatformWayland()
Convenience method to check whether the Platform is Wayland.
WindowType
Window type.
Definition: netwm_def.h:286
static bool icccmCompliantMappingState()
static Platform platform()
Returns the Platform used by the QGuiApplication.
CaseInsensitive
static bool isPlatformX11()
Convenience method to check whether the Platform is X11.
static void setBlockingCompositing(WId window, bool active)
Sets whether the client wishes to block compositing (for better performance)
static void setStrut(WId win, int left, int right, int top, int bottom)
Convenience function for setExtendedStrut() that automatically makes struts as wide/high as the scree...
QCoreApplication * instance()
The Wayland windowing system platform.
void deleteLater()
static void unminimizeWindow(WId win)
Unminimizes the window with id win.
static QPoint desktopToViewport(int desktop, bool absolute)
static QPoint constrainViewportRelativePosition(const QPoint &pos)
static void setCurrentDesktop(int desktop)
Convenience function to set the current desktop to desktop.
static void setState(WId win, NET::States state)
Sets the state of window win to state.
The xcb/X11 windowing system platorm.
virtual void connectNotify(const QMetaMethod &signal)
static QRect workArea(int desktop=-1)
Returns the workarea for the specified desktop, or the current work area if no desktop has been speci...
static void setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon)
Sets an icon and a miniIcon on window win.
Platform
Enum describing the windowing system platform used by the QGuiApplication.
static KWindowSystem * self()
Access to the singleton instance.
QWindow * windowHandle() const const
static void allowExternalProcessWindowActivation(int pid=-1)
Allows a window from another process to raise and activate itself.
static void minimizeWindow(WId win)
Minimizes the window with id win.
WA_NativeWindow
static QList< WId > windows()
Returns the list of all toplevel windows currently managed by the window manager in the order of crea...
Base namespace class.
Definition: netwm_def.h:263
static bool hasWId(WId id)
Test to see if id still managed at present.
static bool mapViewport()
static bool showingDesktop()
Returns the state of showing the desktop.
static void setShowingDesktop(bool showing)
Sets the state of the "showing desktop" mode of the window manager.
static void demandAttention(WId win, bool set=true)
When application finishes some operation and wants to notify the user about it, it can call demandAtt...
static void setOnAllDesktops(WId win, bool b)
Sets window win to be present on all virtual desktops if is true.
static int numberOfDesktops()
Returns the number of virtual desktops.
static bool allowedActionsSupported()
Returns true if the WM announces which actions it allows for windows.
QPoint topLeft() const const
static bool compositingActive()
Returns true if a compositing manager is running (i.e.
static QPixmap icon(WId win, int width=-1, int height=-1, bool scale=false)
Returns an icon for window win.
Common API for application window properties/protocols.
Definition: netwm.h:935
static WId groupLeader(WId window)
Returns the leader window for the group the given window is in, if any.
QWindow * fromWinId(WId id)
static QList< WId > stackingOrder()
Returns the list of all toplevel windows currently managed by the window manager in the current stack...
QString platformName()
void destroyed(QObject *obj)
static void setDesktopName(int desktop, const QString &name)
Sets the name of the specified desktop.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 8 2020 22:39:15 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.