Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/windowed/x11windowed_backend.cpp
Show First 20 Lines • Show All 534 Lines • ▼ Show 20 Line(s) | 534 | { | |||
---|---|---|---|---|---|
535 | return m_outputs; | 535 | return m_outputs; | ||
536 | } | 536 | } | ||
537 | 537 | | |||
538 | Outputs X11WindowedBackend::enabledOutputs() const | 538 | Outputs X11WindowedBackend::enabledOutputs() const | ||
539 | { | 539 | { | ||
540 | return m_outputs; | 540 | return m_outputs; | ||
541 | } | 541 | } | ||
542 | 542 | | |||
543 | bool X11WindowedBackend::canLoad() | ||||
544 | { | ||||
545 | // test X11 connection, almost like in init() | ||||
546 | const QByteArray x11display = qgetenv("DISPLAY"); | ||||
547 | if (x11display.isEmpty()) { | ||||
548 | return false; | ||||
549 | } | ||||
550 | xcb_connection_t *conn = nullptr; | ||||
551 | Display *xDisplay = XOpenDisplay(x11display.constData()); | ||||
552 | if (!xDisplay) { | ||||
553 | return false; | ||||
554 | } | ||||
555 | conn = XGetXCBConnection(xDisplay); | ||||
556 | if (!conn || xcb_connection_has_error(conn)) { | ||||
557 | return false; | ||||
558 | } | ||||
559 | xcb_disconnect(conn); | ||||
560 | XCloseDisplay(xDisplay); | ||||
561 | return true; | ||||
562 | } | ||||
563 | | ||||
543 | } | 564 | } |