| 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 |
QT_BEGIN_NAMESPACE |
| 14 |
|
| 15 |
class QWidget; |
| 16 |
class QXcbScreen; |
| 17 |
class QXcbConnection; |
| 18 |
|
| 19 |
class QXcbNativeInterface : public QPlatformNativeInterface |
| 20 |
{ |
| 21 |
Q_OBJECT |
| 22 |
public: |
| 23 |
enum ResourceType { |
| 24 |
Display, |
| 25 |
EglDisplay, |
| 26 |
Connection, |
| 27 |
Screen, |
| 28 |
EglContext, |
| 29 |
GLXContext, |
| 30 |
AppTime, |
| 31 |
AppUserTime, |
| 32 |
ScreenHintStyle, |
| 33 |
StartupId, |
| 34 |
TrayWindow, |
| 35 |
GetTimestamp, |
| 36 |
X11Screen, |
| 37 |
RootWindow |
| 38 |
}; |
| 39 |
|
| 40 |
QXcbNativeInterface(); |
| 41 |
|
| 42 |
void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE; |
| 43 |
void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context); |
| 44 |
void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen); |
| 45 |
void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); |
| 46 |
|
| 47 |
NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource); |
| 48 |
NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) Q_DECL_OVERRIDE; |
| 49 |
|
| 50 |
inline const QByteArray &genericEventFilterType() const { return m_genericEventFilterType; } |
| 51 |
|
| 52 |
void *displayForWindow(QWindow *window); |
| 53 |
void *eglDisplayForWindow(QWindow *window); |
| 54 |
void *connectionForWindow(QWindow *window); |
| 55 |
void *screenForWindow(QWindow *window); |
| 56 |
void *appTime(const QXcbScreen *screen); |
| 57 |
void *appUserTime(const QXcbScreen *screen); |
| 58 |
void *getTimestamp(const QXcbScreen *screen); |
| 59 |
void *startupId(); |
| 60 |
void *x11Screen(); |
| 61 |
void *rootWindow(); |
| 62 |
static void setAppTime(QScreen *screen, xcb_timestamp_t time); |
| 63 |
static void setAppUserTime(QScreen *screen, xcb_timestamp_t time); |
| 64 |
static void *eglContextForContext(QOpenGLContext *context); |
| 65 |
static void *glxContextForContext(QOpenGLContext *context); |
| 66 |
|
| 67 |
Q_INVOKABLE void beep(); |
| 68 |
Q_INVOKABLE bool systemTrayAvailable(const QScreen *screen) const; |
| 69 |
Q_INVOKABLE bool requestSystemTrayWindowDock(const QWindow *window); |
| 70 |
Q_INVOKABLE QRect systemTrayWindowGlobalGeometry(const QWindow *window); |
| 71 |
|
| 72 |
signals: |
| 73 |
void systemTrayWindowChanged(QScreen *screen); |
| 74 |
|
| 75 |
private: |
| 76 |
const QByteArray m_genericEventFilterType; |
| 77 |
|
| 78 |
static QXcbScreen *qPlatformScreenForWindow(QWindow *window); |
| 79 |
}; |
| 80 |
|
| 81 |
QT_END_NAMESPACE |
| 82 |
|
| 83 |
#endif // QXCBNATIVEINTERFACE_H |