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 #endif
23 
24 // QPoint and QSize all have handy / operators which are useful for scaling, positions and sizes for high DPI support
25 // QRect does not, so we create one for internal purposes within this class
26 inline QRect operator/(const QRect &rectangle, qreal factor)
27 {
28  return QRect(rectangle.topLeft() / factor, rectangle.size() / factor);
29 }
30 
31 class KWindowSystemStaticContainer
32 {
33 public:
34  KWindowSystemStaticContainer()
35  {
36  d.reset(KWindowSystemPluginWrapper::self().createWindowSystem());
37 
39  kwm.moveToThread(QCoreApplication::instance()->thread());
40  }
41  }
42  KWindowSystemPrivate *xcbPlugin()
43  {
44  if (xcbPrivate.isNull()) {
45  QPluginLoader loader(QStringLiteral(XCB_PLUGIN_PATH));
46  QScopedPointer<KWindowSystemPluginInterface> xcbPlugin(qobject_cast<KWindowSystemPluginInterface *>(loader.instance()));
47  if (!xcbPlugin.isNull()) {
48  xcbPrivate.reset(xcbPlugin->createWindowSystem());
49  }
50  }
51  return xcbPrivate.data();
52  }
53  KWindowSystem kwm;
56 };
57 
58 Q_GLOBAL_STATIC(KWindowSystemStaticContainer, g_kwmInstanceContainer)
59 
60 KWindowSystemPrivate::~KWindowSystemPrivate()
61 {
62 }
63 
64 QPixmap KWindowSystemPrivate::iconFromNetWinInfo(int width, int height, bool scale, int flags, NETWinInfo *info)
65 {
66  Q_UNUSED(width)
67  Q_UNUSED(height)
68  Q_UNUSED(scale)
69  Q_UNUSED(flags)
70  Q_UNUSED(info)
71  return QPixmap();
72 }
73 
74 QList<WId> KWindowSystemPrivateDummy::windows()
75 {
76  return QList<WId>();
77 }
78 
79 QList<WId> KWindowSystemPrivateDummy::stackingOrder()
80 {
81  return QList<WId>();
82 }
83 
84 WId KWindowSystemPrivateDummy::activeWindow()
85 {
86  return 0;
87 }
88 
89 void KWindowSystemPrivateDummy::activateWindow(WId win, long time)
90 {
91  Q_UNUSED(win)
92  Q_UNUSED(time)
93 }
94 
95 void KWindowSystemPrivateDummy::forceActiveWindow(WId win, long time)
96 {
97  Q_UNUSED(win)
98  Q_UNUSED(time)
99 }
100 
101 void KWindowSystemPrivateDummy::demandAttention(WId win, bool set)
102 {
103  Q_UNUSED(win)
104  Q_UNUSED(set)
105 }
106 
107 bool KWindowSystemPrivateDummy::compositingActive()
108 {
109  return false;
110 }
111 
112 int KWindowSystemPrivateDummy::currentDesktop()
113 {
114  return 0;
115 }
116 
117 int KWindowSystemPrivateDummy::numberOfDesktops()
118 {
119  return 0;
120 }
121 
122 void KWindowSystemPrivateDummy::setCurrentDesktop(int desktop)
123 {
124  Q_UNUSED(desktop)
125 }
126 
127 void KWindowSystemPrivateDummy::setOnAllDesktops(WId win, bool b)
128 {
129  Q_UNUSED(win)
130  Q_UNUSED(b)
131 }
132 
133 void KWindowSystemPrivateDummy::setOnDesktop(WId win, int desktop)
134 {
135  Q_UNUSED(win)
136  Q_UNUSED(desktop)
137 }
138 
139 void KWindowSystemPrivateDummy::setOnActivities(WId win, const QStringList &activities)
140 {
141  Q_UNUSED(win)
142  Q_UNUSED(activities)
143 }
144 
145 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
146 WId KWindowSystemPrivateDummy::transientFor(WId window)
147 {
148  Q_UNUSED(window)
149  return 0;
150 }
151 
152 WId KWindowSystemPrivateDummy::groupLeader(WId window)
153 {
154  Q_UNUSED(window)
155  return 0;
156 }
157 #endif
158 
159 QPixmap KWindowSystemPrivateDummy::icon(WId win, int width, int height, bool scale, int flags)
160 {
161  Q_UNUSED(win)
162  Q_UNUSED(width)
163  Q_UNUSED(height)
164  Q_UNUSED(scale)
165  Q_UNUSED(flags)
166  return QPixmap();
167 }
168 
169 void KWindowSystemPrivateDummy::setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon)
170 {
171  Q_UNUSED(win)
172  Q_UNUSED(icon)
173  Q_UNUSED(miniIcon)
174 }
175 
176 void KWindowSystemPrivateDummy::setType(WId win, NET::WindowType windowType)
177 {
178  Q_UNUSED(win)
179  Q_UNUSED(windowType)
180 }
181 
182 void KWindowSystemPrivateDummy::setState(WId win, NET::States state)
183 {
184  Q_UNUSED(win)
185  Q_UNUSED(state)
186 }
187 
188 void KWindowSystemPrivateDummy::clearState(WId win, NET::States state)
189 {
190  Q_UNUSED(win)
191  Q_UNUSED(state)
192 }
193 
194 void KWindowSystemPrivateDummy::minimizeWindow(WId win)
195 {
196  Q_UNUSED(win)
197 }
198 
199 void KWindowSystemPrivateDummy::unminimizeWindow(WId win)
200 {
201  Q_UNUSED(win)
202 }
203 
204 void KWindowSystemPrivateDummy::raiseWindow(WId win)
205 {
206  Q_UNUSED(win)
207 }
208 
209 void KWindowSystemPrivateDummy::lowerWindow(WId win)
210 {
211  Q_UNUSED(win)
212 }
213 
214 bool KWindowSystemPrivateDummy::icccmCompliantMappingState()
215 {
216  return false;
217 }
218 
219 QRect KWindowSystemPrivateDummy::workArea(int desktop)
220 {
221  Q_UNUSED(desktop)
222  return QRect();
223 }
224 
225 QRect KWindowSystemPrivateDummy::workArea(const QList<WId> &excludes, int desktop)
226 {
227  Q_UNUSED(excludes)
228  Q_UNUSED(desktop)
229  return QRect();
230 }
231 
232 QString KWindowSystemPrivateDummy::desktopName(int desktop)
233 {
234  Q_UNUSED(desktop)
235  return QString();
236 }
237 
238 void KWindowSystemPrivateDummy::setDesktopName(int desktop, const QString &name)
239 {
240  Q_UNUSED(desktop)
241  Q_UNUSED(name)
242 }
243 
244 bool KWindowSystemPrivateDummy::showingDesktop()
245 {
246  return false;
247 }
248 
249 void KWindowSystemPrivateDummy::setShowingDesktop(bool showing)
250 {
251  Q_UNUSED(showing);
252 }
253 
254 void KWindowSystemPrivateDummy::setUserTime(WId win, long time)
255 {
256  Q_UNUSED(win)
257  Q_UNUSED(time)
258 }
259 
260 void KWindowSystemPrivateDummy::setExtendedStrut(WId win,
261  int left_width,
262  int left_start,
263  int left_end,
264  int right_width,
265  int right_start,
266  int right_end,
267  int top_width,
268  int top_start,
269  int top_end,
270  int bottom_width,
271  int bottom_start,
272  int bottom_end)
273 {
274  Q_UNUSED(win)
275  Q_UNUSED(left_width)
276  Q_UNUSED(left_start)
277  Q_UNUSED(left_end)
278  Q_UNUSED(right_width)
279  Q_UNUSED(right_start)
280  Q_UNUSED(right_end)
281  Q_UNUSED(top_width)
282  Q_UNUSED(top_start)
283  Q_UNUSED(top_end)
284  Q_UNUSED(bottom_width)
285  Q_UNUSED(bottom_start)
286  Q_UNUSED(bottom_end)
287 }
288 
289 void KWindowSystemPrivateDummy::setStrut(WId win, int left, int right, int top, int bottom)
290 {
291  Q_UNUSED(win)
292  Q_UNUSED(left)
293  Q_UNUSED(right)
294  Q_UNUSED(top)
295  Q_UNUSED(bottom)
296 }
297 
298 bool KWindowSystemPrivateDummy::allowedActionsSupported()
299 {
300  return false;
301 }
302 
303 QString KWindowSystemPrivateDummy::readNameProperty(WId window, unsigned long atom)
304 {
305  Q_UNUSED(window)
306  Q_UNUSED(atom)
307  return QString();
308 }
309 
310 void KWindowSystemPrivateDummy::allowExternalProcessWindowActivation(int pid)
311 {
312  Q_UNUSED(pid)
313 }
314 
315 void KWindowSystemPrivateDummy::setBlockingCompositing(WId window, bool active)
316 {
317  Q_UNUSED(window)
318  Q_UNUSED(active)
319 }
320 
321 bool KWindowSystemPrivateDummy::mapViewport()
322 {
323  return false;
324 }
325 
326 int KWindowSystemPrivateDummy::viewportToDesktop(const QPoint &pos)
327 {
328  Q_UNUSED(pos)
329  return 0;
330 }
331 
332 int KWindowSystemPrivateDummy::viewportWindowToDesktop(const QRect &r)
333 {
334  Q_UNUSED(r)
335  return 0;
336 }
337 
338 QPoint KWindowSystemPrivateDummy::desktopToViewport(int desktop, bool absolute)
339 {
340  Q_UNUSED(desktop)
341  Q_UNUSED(absolute)
342  return QPoint();
343 }
344 
345 QPoint KWindowSystemPrivateDummy::constrainViewportRelativePosition(const QPoint &pos)
346 {
347  Q_UNUSED(pos)
348  return QPoint();
349 }
350 
351 void KWindowSystemPrivateDummy::connectNotify(const QMetaMethod &signal)
352 {
353  Q_UNUSED(signal)
354 }
355 
357 {
358  return &(g_kwmInstanceContainer()->kwm);
359 }
360 
361 KWindowSystemPrivate *KWindowSystem::d_func()
362 {
363  return g_kwmInstanceContainer()->d.data();
364 }
365 
366 void KWindowSystem::connectNotify(const QMetaMethod &signal)
367 {
368  Q_D(KWindowSystem);
369  d->connectNotify(signal);
370  QObject::connectNotify(signal);
371 }
372 
374 {
375  Q_D(KWindowSystem);
376  return d->windows();
377 }
378 
379 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
381 {
382  return KWindowInfo(win, properties, properties2);
383 }
384 #endif
385 
387 {
388  return windows().contains(w);
389 }
390 
392 {
393  Q_D(KWindowSystem);
394  return d->stackingOrder();
395 }
396 
398 {
399  Q_D(KWindowSystem);
400  return d->currentDesktop();
401 }
402 
404 {
405  Q_D(KWindowSystem);
406  return d->numberOfDesktops();
407 }
408 
410 {
411  Q_D(KWindowSystem);
412  d->setCurrentDesktop(desktop);
413 }
414 
415 void KWindowSystem::setOnAllDesktops(WId win, bool b)
416 {
417  Q_D(KWindowSystem);
418  d->setOnAllDesktops(win, b);
419 }
420 
421 void KWindowSystem::setOnDesktop(WId win, int desktop)
422 {
423  Q_D(KWindowSystem);
424  d->setOnDesktop(win, desktop);
425 }
426 
427 void KWindowSystem::setOnActivities(WId win, const QStringList &activities)
428 {
429  Q_D(KWindowSystem);
430  d->setOnActivities(win, activities);
431 }
432 
434 {
435  Q_D(KWindowSystem);
436  return d->activeWindow();
437 }
438 
439 void KWindowSystem::activateWindow(WId win, long time)
440 {
441  Q_D(KWindowSystem);
442  d->activateWindow(win, time);
443 }
444 
445 void KWindowSystem::forceActiveWindow(WId win, long time)
446 {
447  Q_D(KWindowSystem);
448  d->forceActiveWindow(win, time);
449 }
450 
451 void KWindowSystem::demandAttention(WId win, bool set)
452 {
453  Q_D(KWindowSystem);
454  d->demandAttention(win, set);
455 }
456 
457 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
459 {
460  Q_D(KWindowSystem);
461  return d->transientFor(win);
462 }
463 
464 void KWindowSystem::setMainWindow(QWidget *subWidget, WId mainWindowId)
465 {
466  // Set the WA_NativeWindow attribute to force the creation of the QWindow.
467  // Without this QWidget::windowHandle() returns 0.
468  subWidget->setAttribute(Qt::WA_NativeWindow, true);
469  QWindow *subWindow = subWidget->windowHandle();
470  Q_ASSERT(subWindow);
471  setMainWindow(subWindow, mainWindowId);
472 }
473 #endif
474 
475 void KWindowSystem::setMainWindow(QWindow *subWindow, WId mainWindowId)
476 {
477  QWindow *mainWindow = QWindow::fromWinId(mainWindowId);
478  if (mainWindow) { // foreign windows not supported on all platforms
479  subWindow->setTransientParent(mainWindow);
480 
481  // mainWindow is not the child of any object, so make sure it gets deleted at some point
482  connect(subWindow, &QObject::destroyed, mainWindow, &QObject::deleteLater);
483  }
484 }
485 
486 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
488 {
489  Q_D(KWindowSystem);
490  return d->groupLeader(win);
491 }
492 #endif
493 
494 QPixmap KWindowSystem::icon(WId win, int width, int height, bool scale)
495 {
496  return icon(win, width, height, scale, NETWM | WMHints | ClassHint | XApp);
497 }
498 
499 QPixmap KWindowSystem::icon(WId win, int width, int height, bool scale, int flags)
500 {
501  Q_D(KWindowSystem);
502  return d->icon(win, width, height, scale, flags);
503 }
504 
505 QPixmap KWindowSystem::icon(WId win, int width, int height, bool scale, int flags, NETWinInfo *info)
506 {
507  Q_D(KWindowSystem);
508  width *= qApp->devicePixelRatio();
509  height *= qApp->devicePixelRatio();
510 #if KWINDOWSYSTEM_HAVE_X11
511  if (info) {
512  if (isPlatformX11()) {
513  // this is the xcb plugin, we can just delegate
514  return d->iconFromNetWinInfo(width, height, scale, flags, info);
515  } else {
516  // other platform plugin, load xcb plugin to delegate to it
517  if (KWindowSystemPrivate *p = g_kwmInstanceContainer()->xcbPlugin()) {
518  return p->iconFromNetWinInfo(width, height, scale, flags, info);
519  }
520  }
521  }
522 #else
523  Q_UNUSED(info)
524 #endif
525  return d->icon(win, width, height, scale, flags);
526 }
527 
528 void KWindowSystem::setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon)
529 {
530  Q_D(KWindowSystem);
531  d->setIcons(win, icon, miniIcon);
532 }
533 
534 void KWindowSystem::setType(WId win, NET::WindowType windowType)
535 {
536  Q_D(KWindowSystem);
537  d->setType(win, windowType);
538 }
539 
541 {
542  Q_D(KWindowSystem);
543  d->setState(win, state);
544 }
545 
547 {
548  Q_D(KWindowSystem);
549  d->clearState(win, state);
550 }
551 
553 {
554  Q_D(KWindowSystem);
555  d->minimizeWindow(win);
556 }
557 
559 {
560  Q_D(KWindowSystem);
561  d->unminimizeWindow(win);
562 }
563 
564 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
565 void KWindowSystem::minimizeWindow(WId win, bool animation)
566 {
567  Q_UNUSED(animation)
568  minimizeWindow(win);
569 }
570 #endif
571 
572 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
573 void KWindowSystem::unminimizeWindow(WId win, bool animation)
574 {
575  Q_UNUSED(animation)
576  unminimizeWindow(win);
577 }
578 #endif
579 
581 {
582  Q_D(KWindowSystem);
583  d->raiseWindow(win);
584 }
585 
587 {
588  Q_D(KWindowSystem);
589  d->lowerWindow(win);
590 }
591 
593 {
594  Q_D(KWindowSystem);
595  return d->compositingActive();
596 }
597 
598 QRect KWindowSystem::workArea(int desktop)
599 {
600  Q_D(KWindowSystem);
601  return d->workArea(desktop) / qApp->devicePixelRatio();
602 }
603 
604 QRect KWindowSystem::workArea(const QList<WId> &exclude, int desktop)
605 {
606  Q_D(KWindowSystem);
607  return d->workArea(exclude, desktop) / qApp->devicePixelRatio();
608 }
609 
610 QString KWindowSystem::desktopName(int desktop)
611 {
612  Q_D(KWindowSystem);
613  return d->desktopName(desktop);
614 }
615 
616 void KWindowSystem::setDesktopName(int desktop, const QString &name)
617 {
618  Q_D(KWindowSystem);
619  d->setDesktopName(desktop, name);
620 }
621 
623 {
624  Q_D(KWindowSystem);
625  return d->showingDesktop();
626 }
627 
629 {
630  Q_D(KWindowSystem);
631  return d->setShowingDesktop(showing);
632 }
633 
634 void KWindowSystem::setUserTime(WId win, long time)
635 {
636  Q_D(KWindowSystem);
637  d->setUserTime(win, time);
638 }
639 
641  int left_width,
642  int left_start,
643  int left_end,
644  int right_width,
645  int right_start,
646  int right_end,
647  int top_width,
648  int top_start,
649  int top_end,
650  int bottom_width,
651  int bottom_start,
652  int bottom_end)
653 {
654  Q_D(KWindowSystem);
655  const qreal dpr = qApp->devicePixelRatio();
656  d->setExtendedStrut(win,
657  left_width * dpr,
658  left_start * dpr,
659  left_end * dpr,
660  right_width * dpr,
661  right_start * dpr,
662  right_end * dpr,
663  top_width * dpr,
664  top_start * dpr,
665  top_end * dpr,
666  bottom_width * dpr,
667  bottom_start * dpr,
668  bottom_end * dpr);
669 }
670 
671 void KWindowSystem::setStrut(WId win, int left, int right, int top, int bottom)
672 {
673  Q_D(KWindowSystem);
674  const qreal dpr = qApp->devicePixelRatio();
675  d->setStrut(win, left * dpr, right * dpr, top * dpr, bottom * dpr);
676 }
677 
679 {
680  Q_D(KWindowSystem);
681  return d->icccmCompliantMappingState();
682 }
683 
685 {
686  Q_D(KWindowSystem);
687  return d->allowedActionsSupported();
688 }
689 
690 QString KWindowSystem::readNameProperty(WId win, unsigned long atom)
691 {
692  Q_D(KWindowSystem);
693  return d->readNameProperty(win, atom);
694 }
695 
697 {
698  Q_D(KWindowSystem);
699  d->allowExternalProcessWindowActivation(pid);
700 }
701 
702 void KWindowSystem::setBlockingCompositing(WId window, bool active)
703 {
704  Q_D(KWindowSystem);
705  d->setBlockingCompositing(window, active);
706 }
707 
709 {
710  Q_D(KWindowSystem);
711  return d->mapViewport();
712 }
713 
715 {
716  Q_D(KWindowSystem);
717  return d->viewportToDesktop(p / qApp->devicePixelRatio());
718 }
719 
721 {
722  Q_D(KWindowSystem);
723  return d->viewportWindowToDesktop(r / qApp->devicePixelRatio());
724 }
725 
726 QPoint KWindowSystem::desktopToViewport(int desktop, bool absolute)
727 {
728  Q_D(KWindowSystem);
729  return d->desktopToViewport(desktop, absolute);
730 }
731 
733 {
734  Q_D(KWindowSystem);
735  return d->constrainViewportRelativePosition(pos / qApp->devicePixelRatio());
736 }
737 
738 static inline KWindowSystem::Platform initPlatform()
739 {
740  auto platformName = QGuiApplication::platformName();
741  if (platformName == QLatin1String("flatpak")) {
742  // here we cannot know what is the actual windowing system, let's try it's env variable
743  const auto flatpakPlatform = QString::fromLocal8Bit(qgetenv("QT_QPA_FLATPAK_PLATFORM"));
744  if (!flatpakPlatform.isEmpty()) {
745  platformName = flatpakPlatform;
746  }
747  }
748 #if KWINDOWSYSTEM_HAVE_X11
749  if (platformName == QLatin1String("xcb")) {
751  }
752 #endif
753  if (platformName.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
755  }
757 }
758 
760 {
761  static Platform s_platform = initPlatform();
762  return s_platform;
763 }
764 
766 {
767  return platform() == Platform::X11;
768 }
769 
771 {
772  return platform() == Platform::Wayland;
773 }
774 
775 void KWindowSystem::requestXdgActivationToken(QWindow *win, uint32_t serial, const QString &app_id)
776 {
777  Q_D(KWindowSystem);
778  auto dv2 = dynamic_cast<KWindowSystemPrivateV2 *>(d);
779  if (!dv2) {
780  Q_EMIT KWindowSystem::self()->xdgActivationTokenArrived(serial, {});
781  return;
782  }
783  dv2->requestToken(win, serial, app_id);
784 }
785 
787 {
788  Q_D(KWindowSystem);
789  auto dv2 = dynamic_cast<KWindowSystemPrivateV2 *>(d);
790  if (!dv2) {
791  return;
792  }
793  dv2->setCurrentToken(token);
794 }
795 
797 {
798  Q_D(KWindowSystem);
799  auto dv2 = dynamic_cast<KWindowSystemPrivateV2 *>(d);
800  if (!dv2) {
801  return 0;
802  }
803  return dv2->lastInputSerial(window);
804 }
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)
void xdgActivationTokenArrived(int serial, const QString &token)
Activation token to pass to the client.
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 setCurrentXdgActivationToken(const QString &token)
Sets the token that will be used when activateWindow is called next.
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:320
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 requestXdgActivationToken(QWindow *win, uint32_t serial, const QString &app_id)
Requests an xdg_activation_v1 token for a specific window.
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:297
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:944
static quint32 lastInputSerial(QWindow *window)
Offers the seat&#39;s current serial.
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-2021 The KDE developers.
Generated on Thu Jul 29 2021 22:40:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.