KWindowSystem

kwindowsystem_p_x11.h
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 
7 #ifndef KWINDOWSYSTEM_P_X11_H
8 #define KWINDOWSYSTEM_P_X11_H
9 
10 #include "kwindowsystem_p.h"
11 #include "netwm.h"
12 
13 #include <QAbstractNativeEventFilter>
14 
15 class NETEventFilter;
16 
17 class KWindowSystemPrivateX11 : public KWindowSystemPrivate
18 {
19 public:
20  QList<WId> windows() override;
21  QList<WId> stackingOrder() override;
22  WId activeWindow() override;
23  void activateWindow(WId win, long time) override;
24  void forceActiveWindow(WId win, long time) override;
25  void demandAttention(WId win, bool set) override;
26  bool compositingActive() override;
27  int currentDesktop() override;
28  int numberOfDesktops() override;
29  void setCurrentDesktop(int desktop) override;
30  void setOnAllDesktops(WId win, bool b) override;
31  void setOnDesktop(WId win, int desktop) override;
32  void setOnActivities(WId win, const QStringList &activities) override;
33 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0)
34  WId transientFor(WId window) override;
35  WId groupLeader(WId window) override;
36 #endif
37  QPixmap icon(WId win, int width, int height, bool scale, int flags) override;
38  QPixmap iconFromNetWinInfo(int width, int height, bool scale, int flags, NETWinInfo *info) override;
39  void setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon) override;
40  void setType(WId win, NET::WindowType windowType) override;
41  void setState(WId win, NET::States state) override;
42  void clearState(WId win, NET::States state) override;
43  void minimizeWindow(WId win) override;
44  void unminimizeWindow(WId win) override;
45  void raiseWindow(WId win) override;
46  void lowerWindow(WId win) override;
47  bool icccmCompliantMappingState() override;
48  QRect workArea(int desktop) override;
49  QRect workArea(const QList<WId> &excludes, int desktop) override;
50  QString desktopName(int desktop) override;
51  void setDesktopName(int desktop, const QString &name) override;
52  bool showingDesktop() override;
53  void setShowingDesktop(bool showing) override;
54  void setUserTime(WId win, long time) override;
55  void setExtendedStrut(WId win,
56  int left_width,
57  int left_start,
58  int left_end,
59  int right_width,
60  int right_start,
61  int right_end,
62  int top_width,
63  int top_start,
64  int top_end,
65  int bottom_width,
66  int bottom_start,
67  int bottom_end) override;
68  void setStrut(WId win, int left, int right, int top, int bottom) override;
69  bool allowedActionsSupported() override;
70  QString readNameProperty(WId window, unsigned long atom) override;
71  void allowExternalProcessWindowActivation(int pid) override;
72  void setBlockingCompositing(WId window, bool active) override;
73  bool mapViewport() override;
74  int viewportToDesktop(const QPoint &pos) override;
75  int viewportWindowToDesktop(const QRect &r) override;
76  QPoint desktopToViewport(int desktop, bool absolute) override;
77  QPoint constrainViewportRelativePosition(const QPoint &pos) override;
78 
79  void connectNotify(const QMetaMethod &signal) override;
80 
81  enum FilterInfo {
82  INFO_BASIC = 1, // desktop info, not per-window
83  INFO_WINDOWS = 2, // also per-window info
84  };
85 
86 private:
87  void init(FilterInfo info);
88  NETEventFilter *s_d_func()
89  {
90  return d.data();
91  }
93 };
94 
95 class MainThreadInstantiator : public QObject
96 {
97  Q_OBJECT
98 
99 public:
100  MainThreadInstantiator(KWindowSystemPrivateX11::FilterInfo _what);
101  Q_INVOKABLE NETEventFilter *createNETEventFilter();
102 
103 private:
104  KWindowSystemPrivateX11::FilterInfo m_what;
105 };
106 
107 class NETEventFilter : public NETRootInfo, public QAbstractNativeEventFilter
108 {
109 public:
110  NETEventFilter(KWindowSystemPrivateX11::FilterInfo _what);
111  ~NETEventFilter() override;
112  void activate();
113  QList<WId> windows;
114  QList<WId> stackingOrder;
115 
116  struct StrutData {
117  StrutData(WId window_, const NETStrut &strut_, int desktop_)
118  : window(window_)
119  , strut(strut_)
120  , desktop(desktop_)
121  {
122  }
123  WId window;
124  NETStrut strut;
125  int desktop;
126  };
127  QList<StrutData> strutWindows;
128  QList<WId> possibleStrutWindows;
129  bool strutSignalConnected;
130  bool compositingEnabled;
131  bool haveXfixes;
132  KWindowSystemPrivateX11::FilterInfo what;
133  int xfixesEventBase;
134  bool mapViewport();
135 
136  bool nativeEventFilter(const QByteArray &eventType, void *message, long int *result) override;
137 
138  void updateStackingOrder();
139  bool removeStrutWindow(WId);
140 
141 protected:
142  void addClient(xcb_window_t) override;
143  void removeClient(xcb_window_t) override;
144 
145 private:
146  bool nativeEventFilter(xcb_generic_event_t *event);
147  xcb_window_t winId;
148  xcb_window_t m_appRootWindow;
149 };
150 
151 #endif
KJOBWIDGETS_EXPORT QWidget * window(KJob *job)
Common API for root window properties/protocols.
Definition: netwm.h:40
WindowType
Window type.
Definition: netwm_def.h:357
QCA_EXPORT void init()
void activateWindow()
Common API for application window properties/protocols.
Definition: netwm.h:944
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Oct 15 2021 22:41:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.