31void EventReader::run()
33 xcb_generic_event_t *event =
nullptr;
34 while (running.loadRelaxed() && (event = xcb_wait_for_event(m_integration->connection()))) {
35 uint response_type = event->response_type & ~0x80;
36 switch (response_type) {
37 case XCB_CLIENT_MESSAGE: {
38 xcb_client_message_event_t *client = (xcb_client_message_event_t *) event;
39 const xcb_atom_t *atoms = m_integration
->atoms();
40 if (client->format == 32
43 QWindow *window = m_integration->platformWindow() ? m_integration->platformWindow()->window() :
nullptr;
45 QWindowSystemInterface::handleCloseEvent(window);
66 xcb_send_event(m_connection,
false, m_connectionEventListener, XCB_EVENT_MASK_NO_EVENT, (
const char *)&event);
74 m_display = XOpenDisplay(
nullptr);
75 if (Q_UNLIKELY(!m_display))
76 qFatal(
"Could not open display");
78 XSetEventQueueOwner(
DISPLAY, XCBOwnsEventQueue);
79 m_connection = XGetXCBConnection(
DISPLAY);
83 xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));
85 m_connectionEventListener = xcb_generate_id(m_connection);
86 xcb_create_window(m_connection, XCB_COPY_FROM_PARENT,
87 m_connectionEventListener, it.data->root,
88 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY,
89 it.data->root_visual, 0,
nullptr);
91 m_eventReader =
new EventReader(
this);
92 m_eventReader->start();
132 const QSurfaceFormat &format)
136 m_platformWindow = platformWindow;
138 xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));
139 m_window = xcb_generate_id(m_connection);
140 xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_window, it.data->root,
141 0, 0, size.width(), size.height(), 0,
142 XCB_WINDOW_CLASS_INPUT_OUTPUT, it.data->root_visual,
152 "_NET_WM_STATE_FULLSCREEN"
156 cookies[i] = xcb_intern_atom(m_connection,
false, strlen(atomNames[i]), atomNames[i]);
157 xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(m_connection, cookies[i],
nullptr);
158 m_atoms[i] = reply->atom;
163 xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window,
167 xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window,
171 xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window,
174 xcb_map_window(m_connection, m_window);
176 xcb_flush(m_connection);
178 return qt_egl_cast<EGLNativeWindowType>(m_window);