diff options
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.cpp | 26 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 |
3 files changed, 27 insertions, 2 deletions
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a6fdd46..eb9e791 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -176,6 +176,30 @@ void QWaylandDisplay::flushRequests() void QWaylandDisplay::readEvents() { +// verify that there is still data on the socket + fd_set fds; + FD_ZERO(&fds); + FD_SET(mFd, &fds); + fd_set nds; + FD_ZERO(&nds); + fd_set rs = fds; + fd_set ws = nds; + fd_set es = nds; + timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 0; + int ret = ::select(mFd+1, &rs, &ws, &es, &timeout ); + + if (ret <= 0) { + //qDebug("QWaylandDisplay::readEvents() No data... blocking avoided"); + return; + } + + wl_display_iterate(mDisplay, WL_DISPLAY_READABLE); +} + +void QWaylandDisplay::blockingReadEvents() +{ wl_display_iterate(mDisplay, WL_DISPLAY_READABLE); } @@ -208,7 +232,7 @@ void QWaylandDisplay::waitForScreens() { flushRequests(); while (mScreens.isEmpty()) - readEvents(); + blockingReadEvents(); } void QWaylandDisplay::displayHandleGlobal(struct wl_display *display, diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index e02767d..3ddbfb2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -86,6 +86,7 @@ public: public slots: void createNewScreen(struct wl_output *output, QRect geometry); void readEvents(); + void blockingReadEvents(); void flushRequests(); private: diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d58b39d..7e94fb9 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -154,5 +154,5 @@ void QWaylandWindow::waitForFrameSync() { mDisplay->flushRequests(); while (mWaitingForFrameSync) - mDisplay->readEvents(); + mDisplay->blockingReadEvents(); } |