diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-06-10 11:59:01 +0200 |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-10 14:27:32 +0200 |
commit | 440f69906db3f4c9947a13186a91e842e56d0c7c (patch) | |
tree | 16f503d8fdf517008cdac8564c1e13f7a060e258 /src | |
parent | d23d51d915f417316393a125b42cff2fbddd0132 (diff) |
Handle really global selection offers in wayland clipboard.
Handle selection offer globals properly even if they arrive during the
initial blocking read. If such a global arrives so early, the platform
integration is not yet available from QApplicationPrivate (as it is
just being constructed). Therefore the handling of the selection
offer has to be delayed. At the moment selection offers are typically
posted as globals and not added to the global list, but that is likely
to change in the future.
Change-Id: Ib4ae804ad7f19e05978ee08828b88e028a3bf7b2
Reviewed-on: http://codereview.qt.nokia.com/446
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.cpp | 21 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.h | 4 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 83516e9..e6d3968 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -129,6 +129,8 @@ const struct wl_shell_listener QWaylandDisplay::shellListener = { QWaylandDisplay::QWaylandDisplay(void) : argb_visual(0), premultiplied_argb_visual(0), rgb_visual(0) { + qRegisterMetaType<uint32_t>("uint32_t"); + mDisplay = wl_display_connect(NULL); if (mDisplay == NULL) { qErrnoWarning(errno, "Failed to create display"); @@ -147,8 +149,6 @@ QWaylandDisplay::QWaylandDisplay(void) blockingReadEvents(); - qRegisterMetaType<uint32_t>("uint32_t"); - #ifdef QT_WAYLAND_GL_SUPPORT mEglIntegration->initialize(); #endif @@ -291,11 +291,24 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, mInputDevices.append(inputDevice); } else if (interface == "wl_selection_offer") { QPlatformIntegration *plat = QApplicationPrivate::platformIntegration(); - QWaylandClipboard *clipboard = static_cast<QWaylandClipboard *>(plat->clipboard()); - clipboard->createSelectionOffer(id); + mSelectionOfferId = id; + if (plat) + handleSelectionOffer(id); + else + QMetaObject::invokeMethod(this, "handleSelectionOffer", + Qt::QueuedConnection, Q_ARG(uint32_t, id)); } } +void QWaylandDisplay::handleSelectionOffer(uint32_t id) +{ + if (mSelectionOfferId != id) + return; + QPlatformIntegration *plat = QApplicationPrivate::platformIntegration(); + QWaylandClipboard *clipboard = static_cast<QWaylandClipboard *>(plat->clipboard()); + clipboard->createSelectionOffer(id); +} + void QWaylandDisplay::handleVisual(void *data, struct wl_compositor *compositor, uint32_t id, uint32_t token) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 765be62..ff8c760 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -97,6 +97,9 @@ public slots: void blockingReadEvents(); void flushRequests(); +private slots: + void handleSelectionOffer(uint32_t id); + private: void waitForScreens(); void displayHandleGlobal(uint32_t id, @@ -115,6 +118,7 @@ private: bool mScreensInitialized; uint32_t mSocketMask; + uint32_t mSelectionOfferId; struct wl_visual *argb_visual, *premultiplied_argb_visual, *rgb_visual; |