Debian Codegraph @

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