Commit fff2bfe7 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Clean up X11 connection setup code

This method removes a code path that we can never hit and fixes some
minor coding style issues.
parent 707a0207
......@@ -185,26 +185,17 @@ void Xwayland::prepareDestroy()
void Xwayland::createX11Connection()
{
int screenNumber = 0;
xcb_connection_t *c = nullptr;
if (m_xcbConnectionFd == -1) {
c = xcb_connect(nullptr, &screenNumber);
} else {
c = xcb_connect_to_fd(m_xcbConnectionFd, nullptr);
}
if (int error = xcb_connection_has_error(c)) {
std::cerr << "FATAL ERROR: Creating connection to XServer failed: " << error << std::endl;
Q_EMIT criticalError(1);
xcb_connection_t *connection = xcb_connect_to_fd(m_xcbConnectionFd, nullptr);
if (!connection) {
return;
}
xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(c));
xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(connection));
m_xcbScreen = iter.data;
Q_ASSERT(m_xcbScreen);
m_app->setX11Connection(c);
// we don't support X11 multi-head in Wayland
m_app->setX11ScreenNumber(screenNumber);
m_app->setX11Connection(connection);
m_app->setX11ScreenNumber(0);
m_app->setX11RootWindow(defaultScreen()->root);
m_app->createAtoms();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment