void QWaylandEventThread::readWaylandEvents() { if (wl_display_dispatch(m_display) < 0) { checkError(); m_readNotifier->setEnabled(false); emit fatalError(); return; } emit newEventsRead(); }
QWaylandDisplay::QWaylandDisplay() : mLastKeyboardFocusInputDevice(0) , mDndSelectionHandler(0) , mWindowExtension(0) , mSubSurfaceExtension(0) , mOutputExtension(0) , mTouchExtension(0) , mQtKeyExtension(0) { display = this; qRegisterMetaType<uint32_t>("uint32_t"); mEventThreadObject = new QWaylandEventThread(0); mEventThread = new QThread(this); mEventThreadObject->moveToThread(mEventThread); mEventThread->start(); mEventThreadObject->displayConnect(); mDisplay = mEventThreadObject->display(); //blocks until display is available //Create a new even queue for the QtGui thread mEventQueue = wl_display_create_queue(mDisplay); struct ::wl_registry *registry = wl_display_get_registry(mDisplay); wl_proxy_set_queue((struct wl_proxy *)registry, mEventQueue); init(registry); QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); #ifdef QT_WAYLAND_GL_SUPPORT mEglIntegration = QWaylandGLIntegration::createGLIntegration(this); #endif mWindowManagerIntegration = new QWaylandWindowManagerIntegration(this); blockingReadEvents(); #ifdef QT_WAYLAND_GL_SUPPORT mEglIntegration->initialize(); flushRequests(); while (mEglIntegration->waitingForEvents()) blockingReadEvents(); #endif waitForScreens(); }