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 | bdda694e86a791b76a5acee0712f5e470700542d (patch) | |
tree | 97f943ecf1cf4778d01903c3b599c9342a4b42f1 /src/plugins/platforms/wayland/qwaylanddisplay.cpp | |
parent | fc74b4e56430ac6aa6c26a10eaa552df3aa34380 (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/plugins/platforms/wayland/qwaylanddisplay.cpp')
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 83516e9b4e..e6d39683fe 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) |