8#include <X11/Xlib-xcb.h>
20 : m_integration(integration) { }
32 xcb_generic_event_t *
event =
nullptr;
34 uint response_type =
event->response_type & ~0x80;
35 switch (response_type) {
36 case XCB_CLIENT_MESSAGE: {
37 xcb_client_message_event_t *client = (xcb_client_message_event_t *)
event;
38 const xcb_atom_t *atoms = m_integration->
atoms();
39 if (client->format == 32
54void QEglFSX11Integration::sendConnectionEvent(xcb_atom_t
a)
56 xcb_client_message_event_t
event;
59 event.response_type = XCB_CLIENT_MESSAGE;
62 event.window = m_connectionEventListener;
65 xcb_send_event(m_connection,
false, m_connectionEventListener, XCB_EVENT_MASK_NO_EVENT, (
const char *)&
event);
66 xcb_flush(m_connection);
69#define DISPLAY ((Display *) m_display)
73 m_display = XOpenDisplay(
nullptr);
75 qFatal(
"Could not open display");
77 XSetEventQueueOwner(
DISPLAY, XCBOwnsEventQueue);
78 m_connection = XGetXCBConnection(
DISPLAY);
82 xcb_screen_iterator_t
it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));
84 m_connectionEventListener = xcb_generate_id(m_connection);
85 xcb_create_window(m_connection, XCB_COPY_FROM_PARENT,
86 m_connectionEventListener,
it.data->root,
87 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY,
88 it.data->root_visual, 0,
nullptr);
91 m_eventReader->
start();
98 sendConnectionEvent(XCB_ATOM_NONE);
100 m_eventReader->
wait();
101 delete m_eventReader;
102 m_eventReader =
nullptr;
106 m_connection =
nullptr;
118 if (env.
size() == 2) {
119 m_screenSize =
QSize(env.
at(0).toInt(), env.
at(1).toInt());
123 m_screenSize =
QSize(
a.width,
a.height);
137 xcb_screen_iterator_t
it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));
138 m_window = xcb_generate_id(m_connection);
139 xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_window,
it.data->root,
140 0, 0,
size.width(),
size.height(), 0,
141 XCB_WINDOW_CLASS_INPUT_OUTPUT,
it.data->root_visual,
151 "_NET_WM_STATE_FULLSCREEN"
155 cookies[
i] = xcb_intern_atom(m_connection,
false, strlen(atomNames[
i]), atomNames[
i]);
156 xcb_intern_atom_reply_t *
reply = xcb_intern_atom_reply(m_connection, cookies[
i],
nullptr);
162 xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window,
166 xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window,
170 xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window,
173 xcb_map_window(m_connection, m_window);
175 xcb_flush(m_connection);
177 return qt_egl_cast<EGLNativeWindowType>(m_window);
182 xcb_destroy_window(m_connection, qt_egl_cast<xcb_window_t>(
window));
EventReader(QEglFSX11Integration *integration)
T loadRelaxed() const noexcept
QList< QByteArray > split(char sep) const
Splits the byte array into subarrays wherever sep occurs, and returns the list of those arrays.
xcb_connection_t * connection()
const xcb_atom_t * atoms() const
QPlatformWindow * platformWindow()
EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) override
void platformInit() override
void platformDestroy() override
EGLNativeDisplayType platformDisplay() const override
QSize screenSize() const override
bool hasCapability(QPlatformIntegration::Capability cap) const override
void destroyNativeWindow(EGLNativeWindowType window) override
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
void start(Priority=InheritPriority)
bool wait(QDeadlineTimer deadline=QDeadlineTimer(QDeadlineTimer::Forever))
static bool handleCloseEvent(QWindow *window)
QSet< QString >::iterator it
@ _NET_WM_STATE_FULLSCREEN
Combined button and popup list for selecting options.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
static Q_CONSTINIT QBasicAtomicInt running
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum format
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)