KWindowSystem

kwindowsystem.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1999 Matthias Ettrich <[email protected]>
4  SPDX-FileCopyrightText: 2007 Lubos Lunak <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8 /*
9  * kwindowsystem.h. Part of the KDE project.
10  */
11 
12 #ifndef KWINDOWSYSTEM_H
13 #define KWINDOWSYSTEM_H
14 
15 #include <kwindowsystem_export.h>
16 #include <QObject>
17 #include <QWidgetList> //For WId
18 #include <netwm_def.h>
19 #include <kwindowinfo.h>
20 
21 class KWindowSystemPrivate;
22 class NETWinInfo;
23 
44 class KWINDOWSYSTEM_EXPORT KWindowSystem : public QObject, public NET
45 {
46  Q_OBJECT
47 
48 public:
52  static KWindowSystem *self();
53 
71  static QList<WId> windows();
72 
78  static bool hasWId(WId id);
79 
80 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
81 
92  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowInfo(WId, NET::Properties, NET::Properties2")
93  static KWindowInfo windowInfo(WId win, NET::Properties properties, NET::Properties2 properties2 = NET::Properties2());
94 #endif
95 
102  static QList<WId> stackingOrder();
103 
109  static WId activeWindow();
110 
137  static void activateWindow(WId win, long time = 0);
138 
151  static void forceActiveWindow(WId win, long time = 0);
152 
162  static void demandAttention(WId win, bool set = true);
163 
168  static bool compositingActive();
169 
174  static int currentDesktop();
175 
180  static int numberOfDesktops();
181 
187  static void setCurrentDesktop(int desktop);
188 
197  static void setOnAllDesktops(WId win, bool b);
198 
205  static void setOnDesktop(WId win, int desktop);
206 
216  static void setOnActivities(WId win, const QStringList &activities);
217 
229  static void setMainWindow(QWindow *subwindow, WId mainwindow);
230 
231 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 62)
232 
246  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 62, "Use KWindowSystem::setMainWindow(QWindow *)")
247  static void setMainWindow(QWidget *subwindow, WId mainwindow);
248 #endif
249 
250 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
251 
258  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowInfo::transientFor()")
259  static WId transientFor(WId window);
260 
266  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowInfo::groupLeader()")
267  static WId groupLeader(WId window);
268 #endif
269 
285  static QPixmap icon(WId win, int width = -1, int height = -1, bool scale = false);
286 
295  enum IconSource { NETWM = 1,
296  WMHints = 2,
297  ClassHint = 4,
298  XApp = 8
299  };
314  static QPixmap icon(WId win, int width, int height, bool scale, int flags);
315 
339  static QPixmap icon(WId win, int width, int height, bool scale, int flags, NETWinInfo *info);
340 
347  static void setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon);
354  static void setType(WId win, NET::WindowType windowType);
367  static void setState(WId win, NET::States state);
368 
381  static void clearState(WId win, NET::States state);
382 
390  static void minimizeWindow(WId win);
398  static void unminimizeWindow(WId win);
399 
400 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
401 
404  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowSystem::minimizeWindow(WId)")
405  static void minimizeWindow(WId win, bool animation);
406 #endif
407 
408 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
409 
412  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowSystem::unminimizeWindow(WId)")
413  static void unminimizeWindow(WId win, bool animation);
414 #endif
415 
422  static void raiseWindow(WId win);
423 
430  static void lowerWindow(WId win);
431 
437  static bool icccmCompliantMappingState();
438 
446  static QRect workArea(int desktop = - 1);
447 
458  static QRect workArea(const QList<WId> &excludes, int desktop = -1);
459 
465  static QString desktopName(int desktop);
466 
472  static void setDesktopName(int desktop, const QString &name);
473 
477  static bool showingDesktop();
478 
488  static void setShowingDesktop(bool showing);
489 
498  static void setUserTime(WId win, long time);
520  static void setExtendedStrut(WId win, int left_width, int left_start, int left_end,
521  int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
522  int bottom_width, int bottom_start, int bottom_end);
523 
535  static void setStrut(WId win, int left, int right, int top, int bottom);
539  static bool allowedActionsSupported();
544  static QString readNameProperty(WId window, unsigned long atom);
545 
563  static void allowExternalProcessWindowActivation(int pid = -1);
564 
569  static void setBlockingCompositing(WId window, bool active);
570 
575  static bool mapViewport();
580  static int viewportToDesktop(const QPoint &pos);
585  static int viewportWindowToDesktop(const QRect &r);
590  static QPoint desktopToViewport(int desktop, bool absolute);
597  static QPoint constrainViewportRelativePosition(const QPoint &pos);
598 
604  enum class Platform {
608  Unknown,
612  X11,
616  Wayland
617  };
626  static Platform platform();
627 
634  static bool isPlatformX11();
635 
642  static bool isPlatformWayland();
643 
644 Q_SIGNALS:
645 
650  void currentDesktopChanged(int desktop);
651 
656  void windowAdded(WId id);
657 
662  void windowRemoved(WId id);
663 
668  void activeWindowChanged(WId id);
669 
673  void desktopNamesChanged();
674 
679  void numberOfDesktopsChanged(int num);
680 
684  void workAreaChanged();
685 
691  void strutChanged();
692 
697  void stackingOrderChanged();
698 
710  void windowChanged(WId id, NET::Properties properties, NET::Properties2 properties2);
711 
712 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
713 
725  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowSystem::windowChanged(WId, NET::Properties, NET::Properties2)")
726  QT_MOC_COMPAT void windowChanged(WId id, const unsigned long *properties);
727 #endif
728 
729 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
730 
739  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowSystem::windowChanged(WId, NET::Properties, NET::Properties2)")
740  QT_MOC_COMPAT void windowChanged(WId id, unsigned int properties);
741 #endif
742 
747  void windowChanged(WId id);
748 
752  void showingDesktopChanged(bool showing);
753 
766  void compositingChanged(bool enabled);
767 
768 protected:
769  void connectNotify(const QMetaMethod &signal) override;
770 
771 private:
772  friend class KWindowSystemStaticContainer;
773 
774  KWindowSystem() {}
775  static KWindowSystemPrivate *d_func();
776 };
777 
778 #endif
Convenience access to certain properties and features of the window manager.
Definition: kwindowsystem.h:44
This class provides information about a given window in the platform specific windowing system...
Definition: kwindowinfo.h:62
IconSource
Masks specifying from which sources to read an icon.
WindowType
Window type.
Definition: netwm_def.h:286
Platform
Enum describing the windowing system platform used by the QGuiApplication.
Base namespace class.
Definition: netwm_def.h:263
Common API for application window properties/protocols.
Definition: netwm.h:935
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jul 4 2020 22:40:44 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.