30void EventReader::run()
32 xcb_generic_event_t *event =
nullptr;
33 while (running.loadRelaxed() && (event = xcb_wait_for_event(m_integration->connection()))) {
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
42 QWindow *window = m_integration->platformWindow() ? m_integration->platformWindow()->window() :
nullptr;
44 QWindowSystemInterface::handleCloseEvent(window);
65 xcb_send_event(m_connection,
false, m_connectionEventListener, XCB_EVENT_MASK_NO_EVENT, (
const char *)&event);
73 m_display = XOpenDisplay(
nullptr);
74 if (Q_UNLIKELY(!m_display))
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);
90 m_eventReader =
new EventReader(
this);
91 m_eventReader->start();
131 const QSurfaceFormat &format)
135 m_platformWindow = platformWindow;
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);
157 m_atoms[i] = reply->atom;
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);