backends/x11: Simplify backend initialization
This commit is contained in:
parent
b18a3b3625
commit
28baea1c29
1 changed files with 29 additions and 34 deletions
|
@ -176,18 +176,16 @@ X11WindowedBackend::~X11WindowedBackend()
|
||||||
|
|
||||||
bool X11WindowedBackend::initialize()
|
bool X11WindowedBackend::initialize()
|
||||||
{
|
{
|
||||||
int screen = 0;
|
m_display = XOpenDisplay(m_options.display.toLatin1().constData());
|
||||||
xcb_connection_t *c = nullptr;
|
if (!m_display) {
|
||||||
Display *xDisplay = XOpenDisplay(m_options.display.toLatin1().constData());
|
return false;
|
||||||
if (xDisplay) {
|
|
||||||
c = XGetXCBConnection(xDisplay);
|
|
||||||
XSetEventQueueOwner(xDisplay, XCBOwnsEventQueue);
|
|
||||||
screen = XDefaultScreen(xDisplay);
|
|
||||||
}
|
}
|
||||||
if (c && !xcb_connection_has_error(c)) {
|
|
||||||
m_connection = c;
|
m_connection = XGetXCBConnection(m_display);
|
||||||
m_screenNumber = screen;
|
m_screenNumber = XDefaultScreen(m_display);
|
||||||
m_display = xDisplay;
|
XSetEventQueueOwner(m_display, XCBOwnsEventQueue);
|
||||||
|
|
||||||
|
int screen = m_screenNumber;
|
||||||
for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));
|
for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));
|
||||||
it.rem;
|
it.rem;
|
||||||
--screen, xcb_screen_next(&it)) {
|
--screen, xcb_screen_next(&it)) {
|
||||||
|
@ -209,9 +207,6 @@ bool X11WindowedBackend::initialize()
|
||||||
}
|
}
|
||||||
Q_EMIT outputsQueried();
|
Q_EMIT outputsQueried();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void X11WindowedBackend::initXInput()
|
void X11WindowedBackend::initXInput()
|
||||||
|
|
Loading…
Reference in a new issue