1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QEGLFSX11INTEGRATION_H
5#define QEGLFSX11INTEGRATION_H
6
7#include "private/qeglfsdeviceintegration_p.h"
8
9#include <qpa/qwindowsysteminterface.h>
10#include <qpa/qplatformwindow.h>
11
12#include <xcb/xcb.h>
13
14QT_BEGIN_NAMESPACE
15
16namespace Atoms {
17 enum {
18 _NET_WM_NAME = 0,
19 UTF8_STRING,
20 WM_PROTOCOLS,
21 WM_DELETE_WINDOW,
22 _NET_WM_STATE,
23 _NET_WM_STATE_FULLSCREEN,
24
25 N_ATOMS
26 };
27}
28
29class EventReader;
30
31class QEglFSX11Integration : public QEglFSDeviceIntegration
32{
33public:
34 QEglFSX11Integration() : m_connection(nullptr), m_window(0), m_eventReader(nullptr) {}
35
36 void platformInit() override;
37 void platformDestroy() override;
38 EGLNativeDisplayType platformDisplay() const override;
39 QSize screenSize() const override;
40 EGLNativeWindowType createNativeWindow(QPlatformWindow *window,
41 const QSize &size,
42 const QSurfaceFormat &format) override;
43 void destroyNativeWindow(EGLNativeWindowType window) override;
44 bool hasCapability(QPlatformIntegration::Capability cap) const override;
45
46 xcb_connection_t *connection() { return m_connection; }
47 const xcb_atom_t *atoms() const { return m_atoms; }
48 QPlatformWindow *platformWindow() { return m_platformWindow; }
49
50private:
51 void sendConnectionEvent(xcb_atom_t a);
52
53 void *m_display;
54 xcb_connection_t *m_connection;
55 xcb_atom_t m_atoms[Atoms::N_ATOMS];
56 xcb_window_t m_window;
57 EventReader *m_eventReader;
58 xcb_window_t m_connectionEventListener;
59 QPlatformWindow *m_platformWindow;
60 mutable QSize m_screenSize;
61};
62
63QT_END_NAMESPACE
64
65#endif
66

source code of qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h