Debian Codegraph @

xcb/libqt5xcbqpa-dev/5.6.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 };
44
45 QXcbNativeInterface();
46
47 void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
48 void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) Q_DECL_OVERRIDE;
49 void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) Q_DECL_OVERRIDE;
50 void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) Q_DECL_OVERRIDE;
51 void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) Q_DECL_OVERRIDE;
52
53 NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
54 NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE;
55 NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) Q_DECL_OVERRIDE;
56 NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) Q_DECL_OVERRIDE;
57 NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource) Q_DECL_OVERRIDE;
58
59 QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE;
60
61 inline const QByteArray &genericEventFilterType() const { return m_genericEventFilterType; }
62
63 void *displayForWindow(QWindow *window);
64 void *connectionForWindow(QWindow *window);
65 void *screenForWindow(QWindow *window);
66 void *appTime(const QXcbScreen *screen);
67 void *appUserTime(const QXcbScreen *screen);
68 void *getTimestamp(const QXcbScreen *screen);
69 void *startupId();
70 void *x11Screen();
71 void *rootWindow();
72 void *display();
73 void *atspiBus();
74 void *connection();
75 static void setStartupId(const char *);
76 static void setAppTime(QScreen *screen, xcb_timestamp_t time);
77 static void setAppUserTime(QScreen *screen, xcb_timestamp_t time);
78
79 Q_INVOKABLE void beep();
80 Q_INVOKABLE bool systemTrayAvailable(const QScreen *screen) const;
81 Q_INVOKABLE void setParentRelativeBackPixmap(QWindow *window);
82 Q_INVOKABLE bool systrayVisualHasAlphaChannel();
83 Q_INVOKABLE bool requestSystemTrayWindowDock(const QWindow *window);
84 Q_INVOKABLE QRect systemTrayWindowGlobalGeometry(const QWindow *window);
85
86 void addHandler(QXcbNativeInterfaceHandler *handler);
87 void removeHandler(QXcbNativeInterfaceHandler *handler);
88 signals:
89 void systemTrayWindowChanged(QScreen *screen);
90
91 private:
92 xcb_window_t locateSystemTray(xcb_connection_t *conn, const QXcbScreen *screen);
93
94 const QByteArray m_genericEventFilterType;
95
96 xcb_atom_t m_sysTraySelectionAtom;
97
98 static QXcbScreen *qPlatformScreenForWindow(QWindow *window);
99
100 QList<QXcbNativeInterfaceHandler *> m_handlers;
101 NativeResourceForIntegrationFunction handlerNativeResourceFunctionForIntegration(const QByteArray &resource) const;
102 NativeResourceForContextFunction handlerNativeResourceFunctionForContext(const QByteArray &resource) const;
103 NativeResourceForScreenFunction handlerNativeResourceFunctionForScreen(const QByteArray &resource) const;
104 NativeResourceForWindowFunction handlerNativeResourceFunctionForWindow(const QByteArray &resource) const;
105 NativeResourceForBackingStoreFunction handlerNativeResourceFunctionForBackingStore(const QByteArray &resource) const;
106 QFunctionPointer handlerPlatformFunction(const QByteArray &function) const;
107 void *handlerNativeResourceForIntegration(const QByteArray &resource) const;
108 void *handlerNativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) const;
109 void *handlerNativeResourceForScreen(const QByteArray &resource, QScreen *screen) const;
110 void *handlerNativeResourceForWindow(const QByteArray &resource, QWindow *window) const;
111 void *handlerNativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) const;
112 };
113
114 QT_END_NAMESPACE
115
116 #endif // QXCBNATIVEINTERFACE_H