Debian Codegraph @

xcb/libqt5xcbqpa-dev/5.7.0/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 class QDBusMenuConnection;
22
23 class Q_XCB_EXPORT QXcbNativeInterface : public QPlatformNativeInterface
24 {
25 Q_OBJECT
26 public:
27 enum ResourceType {
28 Display,
29 Connection,
30 Screen,
31 AppTime,
32 AppUserTime,
33 ScreenHintStyle,
34 StartupId,
35 TrayWindow,
36 GetTimestamp,
37 X11Screen,
38 RootWindow,
39 ScreenSubpixelType,
40 ScreenAntialiasingEnabled,
41 NoFontHinting,
42 AtspiBus,
43 CompositingEnabled
44 };
45
46 QXcbNativeInterface();
47
48 void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
49 void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) Q_DECL_OVERRIDE;
50 void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) Q_DECL_OVERRIDE;
51 void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) Q_DECL_OVERRIDE;
52 void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) Q_DECL_OVERRIDE;
53 #ifndef QT_NO_CURSOR
54 void *nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) Q_DECL_OVERRIDE;
55 #endif
56
57 NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
58 NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE;
59 NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) Q_DECL_OVERRIDE;
60 NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) Q_DECL_OVERRIDE;
61 NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource) Q_DECL_OVERRIDE;
62
63 QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE;
64
65 inline const QByteArray &genericEventFilterType() const { return m_genericEventFilterType; }
66
67 void *displayForWindow(QWindow *window);
68 void *connectionForWindow(QWindow *window);
69 void *screenForWindow(QWindow *window);
70 void *appTime(const QXcbScreen *screen);
71 void *appUserTime(const QXcbScreen *screen);
72 void *getTimestamp(const QXcbScreen *screen);
73 void *startupId();
74 void *x11Screen();
75 void *rootWindow();
76 void *display();
77 void *atspiBus();
78 void *connection();
79 static void setStartupId(const char *);
80 static void setAppTime(QScreen *screen, xcb_timestamp_t time);
81 static void setAppUserTime(QScreen *screen, xcb_timestamp_t time);
82
83 Q_INVOKABLE bool systemTrayAvailable(const QScreen *screen) const;
84 Q_INVOKABLE void setParentRelativeBackPixmap(QWindow *window);
85 Q_INVOKABLE bool systrayVisualHasAlphaChannel();
86 Q_INVOKABLE bool requestSystemTrayWindowDock(const QWindow *window);
87 Q_INVOKABLE QRect systemTrayWindowGlobalGeometry(const QWindow *window);
88
89 void addHandler(QXcbNativeInterfaceHandler *handler);
90 void removeHandler(QXcbNativeInterfaceHandler *handler);
91 signals:
92 void systemTrayWindowChanged(QScreen *screen);
93
94 private:
95 xcb_window_t locateSystemTray(xcb_connection_t *conn, const QXcbScreen *screen);
96
97 const QByteArray m_genericEventFilterType;
98
99 xcb_atom_t m_sysTraySelectionAtom;
100
101 static QXcbScreen *qPlatformScreenForWindow(QWindow *window);
102
103 QList<QXcbNativeInterfaceHandler *> m_handlers;
104 NativeResourceForIntegrationFunction handlerNativeResourceFunctionForIntegration(const QByteArray &resource) const;
105 NativeResourceForContextFunction handlerNativeResourceFunctionForContext(const QByteArray &resource) const;
106 NativeResourceForScreenFunction handlerNativeResourceFunctionForScreen(const QByteArray &resource) const;
107 NativeResourceForWindowFunction handlerNativeResourceFunctionForWindow(const QByteArray &resource) const;
108 NativeResourceForBackingStoreFunction handlerNativeResourceFunctionForBackingStore(const QByteArray &resource) const;
109 QFunctionPointer handlerPlatformFunction(const QByteArray &function) const;
110 void *handlerNativeResourceForIntegration(const QByteArray &resource) const;
111 void *handlerNativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) const;
112 void *handlerNativeResourceForScreen(const QByteArray &resource, QScreen *screen) const;
113 void *handlerNativeResourceForWindow(const QByteArray &resource, QWindow *window) const;
114 void *handlerNativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) const;
115 };
116
117 QT_END_NAMESPACE
118
119 #endif // QXCBNATIVEINTERFACE_H