Debian Codegraph @

xcb/libqt5xcbqpa-dev/5.9.2/qxcbnativeinterface.h

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5 #ifndef QXCBNATIVEINTERFACE_H
6 #define QXCBNATIVEINTERFACE_H
7
8 #include <qpa/qplatformnativeinterface.h>
9 #include <xcb/xcb.h>
10
11 #include <QtCore/QRect>
12
13 #include "qxcbexport.h"
14
15 QT_BEGIN_NAMESPACE
16
17 class QWidget;
18 class QXcbScreen;
19 class QXcbConnection;
20 class QXcbNativeInterfaceHandler;
21
22 class Q_XCB_EXPORT QXcbNativeInterface : public QPlatformNativeInterface
23 {
24 Q_OBJECT
25 public:
26 enum ResourceType {
27 Display,
28 Connection,
29 Screen,
30 AppTime,
31 AppUserTime,
32 ScreenHintStyle,
33 StartupId,
34 TrayWindow,
35 GetTimestamp,
36 X11Screen,
37 RootWindow,
38 ScreenSubpixelType,
39 ScreenAntialiasingEnabled,
40 AtspiBus,
41 CompositingEnabled
42 };
43
44 QXcbNativeInterface();
45
46 void *nativeResourceForIntegration(const QByteArray &resource) override;
47 void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) override;
48 void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override;
49 void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) override;
50 void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) override;
51 #ifndef QT_NO_CURSOR
52 void *nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) override;
53 #endif
54
55 NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) override;
56 NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) override;
57 NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) override;
58 NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) override;
59 NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource) override;
60
61 QFunctionPointer platformFunction(const QByteArray &function) const override;
62
63 inline const QByteArray &genericEventFilterType() const { return m_genericEventFilterType; }
64
65 void *displayForWindow(QWindow *window);
66 void *connectionForWindow(QWindow *window);
67 void *screenForWindow(QWindow *window);
68 void *appTime(const QXcbScreen *screen);
69 void *appUserTime(const QXcbScreen *screen);
70 void *getTimestamp(const QXcbScreen *screen);
71 void *startupId();
72 void *x11Screen();
73 void *rootWindow();
74 void *display();
75 void *atspiBus();
76 void *connection();
77 static void setStartupId(const char *);
78 static void setAppTime(QScreen *screen, xcb_timestamp_t time);
79 static void setAppUserTime(QScreen *screen, xcb_timestamp_t time);
80
81 Q_INVOKABLE bool systemTrayAvailable(const QScreen *screen) const;
82 Q_INVOKABLE void setParentRelativeBackPixmap(QWindow *window);
83 Q_INVOKABLE bool systrayVisualHasAlphaChannel();
84 Q_INVOKABLE bool requestSystemTrayWindowDock(const QWindow *window);
85 Q_INVOKABLE QRect systemTrayWindowGlobalGeometry(const QWindow *window);
86
87 void addHandler(QXcbNativeInterfaceHandler *handler);
88 void removeHandler(QXcbNativeInterfaceHandler *handler);
89 signals:
90 void systemTrayWindowChanged(QScreen *screen);
91
92 private:
93 xcb_window_t locateSystemTray(xcb_connection_t *conn, const QXcbScreen *screen);
94
95 const QByteArray m_genericEventFilterType;
96
97 xcb_atom_t m_sysTraySelectionAtom = XCB_ATOM_NONE;
98
99 static QXcbScreen *qPlatformScreenForWindow(QWindow *window);
100
101 QList<QXcbNativeInterfaceHandler *> m_handlers;
102 NativeResourceForIntegrationFunction handlerNativeResourceFunctionForIntegration(const QByteArray &resource) const;
103 NativeResourceForContextFunction handlerNativeResourceFunctionForContext(const QByteArray &resource) const;
104 NativeResourceForScreenFunction handlerNativeResourceFunctionForScreen(const QByteArray &resource) const;
105 NativeResourceForWindowFunction handlerNativeResourceFunctionForWindow(const QByteArray &resource) const;
106 NativeResourceForBackingStoreFunction handlerNativeResourceFunctionForBackingStore(const QByteArray &resource) const;
107 QFunctionPointer handlerPlatformFunction(const QByteArray &function) const;
108 void *handlerNativeResourceForIntegration(const QByteArray &resource) const;
109 void *handlerNativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) const;
110 void *handlerNativeResourceForScreen(const QByteArray &resource, QScreen *screen) const;
111 void *handlerNativeResourceForWindow(const QByteArray &resource, QWindow *window) const;
112 void *handlerNativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) const;
113 };
114
115 QT_END_NAMESPACE
116
117 #endif // QXCBNATIVEINTERFACE_H