diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-07 00:08:06 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-07 00:13:39 +0100 |
commit | 8ab1765b0f9640eb410864971cb4336adc7b30ab (patch) | |
tree | bb0ecae07f0110cabde8e38ab69b326fa1118a24 | |
parent | 8bd8815fd629e34c54924a2ada41007464da22ec (diff) | |
parent | ec029b1a4c104c2400da23d4f5f04d7f03731beb (diff) | |
download | qtwayland-8ab1765b0f9640eb410864971cb4336adc7b30ab.tar.gz |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
.qmake.conf
src/compositor/compositor_api/qwaylandquickitem.cpp
Change-Id: Id2f49e8703a67daedcee66db83f006df828d9da0
16 files changed, 145 insertions, 97 deletions
diff --git a/src/compositor/compositor_api/qwaylandclient.cpp b/src/compositor/compositor_api/qwaylandclient.cpp index f6b5564b..2b73c06c 100644 --- a/src/compositor/compositor_api/qwaylandclient.cpp +++ b/src/compositor/compositor_api/qwaylandclient.cpp @@ -221,7 +221,7 @@ qint64 QWaylandClient::userId() const */ /*! - * \property int QWaylandClient::groupId + * \property QWaylandClient::groupId * * This property holds the group id of this QWaylandClient. */ diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 99b484e2..4e704088 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -283,39 +283,6 @@ void QWaylandCompositorPrivate::addPolishObject(QObject *object) } } -/*! - \qmlsignal void QtWaylandCompositor::WaylandCompositor::createSurface(object client, int id, int version) - - This signal is emitted when a client has created a surface. - The slot connecting to this signal may create and initialize - a WaylandSurface instance in the scope of the slot. - Otherwise a default surface is created. -*/ - -/*! - \fn void QWaylandCompositor::createSurface(QWaylandClient *client, uint id, int version) - - This signal is emitted when a client has created a surface. - The slot connecting to this signal may create and initialize - a QWaylandSurface instance in the scope of the slot. - Otherwise a default surface is created. - - Connections to this signal must be of Qt::DirectConnection connection type. -*/ - -/* - \qmlsignal void surfaceCreated(QWaylandSurface *surface) - - This signal is emitted when a new WaylandSurface instance has been created. -*/ - -/* - \fn void surfaceCreated(QWaylandSurface *surface) - - This signal is emitted when a new QWaylandSurface instance has been created. -*/ - - void QWaylandCompositorPrivate::compositor_create_surface(wl_compositor::Resource *resource, uint32_t id) { Q_Q(QWaylandCompositor); @@ -465,6 +432,38 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration() */ /*! + \qmlsignal void QtWaylandCompositor::WaylandCompositor::surfaceRequested(WaylandClient client, int id, int version) + + This signal is emitted when a client has created a surface. + The slot connecting to this signal may create and initialize + a WaylandSurface instance in the scope of the slot. + Otherwise a default surface is created. +*/ + +/*! + \fn void QWaylandCompositor::surfaceRequested(QWaylandClient *client, uint id, int version) + + This signal is emitted when a client has created a surface. + The slot connecting to this signal may create and initialize + a QWaylandSurface instance in the scope of the slot. + Otherwise a default surface is created. + + Connections to this signal must be of Qt::DirectConnection connection type. +*/ + +/*! + \qmlsignal void QtWaylandCompositor::WaylandCompositor::surfaceCreated(QWaylandSurface *surface) + + This signal is emitted when a new WaylandSurface instance has been created. +*/ + +/*! + \fn void QWaylandCompositor::surfaceCreated(QWaylandSurface *surface) + + This signal is emitted when a new QWaylandSurface instance has been created. +*/ + +/*! * Constructs a QWaylandCompositor with the given \a parent. */ QWaylandCompositor::QWaylandCompositor(QObject *parent) diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp index 77d3dc1a..c369bb26 100644 --- a/src/compositor/compositor_api/qwaylandoutput.cpp +++ b/src/compositor/compositor_api/qwaylandoutput.cpp @@ -838,7 +838,7 @@ void QWaylandOutput::setSizeFollowsWindow(bool follow) } /*! - * \qmlproperty object QtWaylandCompositor::WaylandOutput::window + * \qmlproperty Window QtWaylandCompositor::WaylandOutput::window * * This property holds the Window for this WaylandOutput. * diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index a993467a..5414d06a 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -221,15 +221,15 @@ void QWaylandBufferMaterial::bind() switch (m_textures.size()) { case 3: if (m_textures[2]) - m_textures[2]->bind(GL_TEXTURE2); + m_textures[2]->bind(2); Q_FALLTHROUGH(); case 2: if (m_textures[1]) - m_textures[1]->bind(GL_TEXTURE1); + m_textures[1]->bind(1); Q_FALLTHROUGH(); case 1: if (m_textures[0]) - m_textures[0]->bind(GL_TEXTURE0); + m_textures[0]->bind(0); } } @@ -388,15 +388,7 @@ QWaylandCompositor *QWaylandQuickItem::compositor() const } /*! - * \qmlproperty WaylandView QtWaylandCompositor::WaylandQuickItem::view - * - * This property holds the view rendered by this WaylandQuickItem. - */ - -/*! - * \property QWaylandQuickItem::view - * - * This property holds the view rendered by this QWaylandQuickItem. + * Returns the view rendered by this QWaylandQuickItem. */ QWaylandView *QWaylandQuickItem::view() const { @@ -817,7 +809,7 @@ void QWaylandQuickItem::setBufferLocked(bool locked) } /*! - * \property bool QWaylandQuickItem::allowDiscardFrontBuffer + * \property QWaylandQuickItem::allowDiscardFrontBuffer * * By default, the item locks the current buffer until a new buffer is available * and updatePaintNode() is called. Set this property to true to allow Qt to release the buffer @@ -1158,6 +1150,32 @@ void QWaylandQuickItem::updateInputMethod(Qt::InputMethodQueries queries) } #endif +/*! + * \qmlsignal void QtWaylandCompositor::WaylandQuickItem::surfaceDestroyed() + * + * This signal is emitted when the client has destroyed the \c wl_surface associated + * with the WaylandQuickItem. The handler for this signal is expected to either destroy the + * WaylandQuickItem immediately or start a close animation and then destroy the Item. + * + * If an animation is started, bufferLocked should be set to ensure the item keeps its content + * until the animation finishes + * + * \sa bufferLocked + */ + +/*! + * \fn void QWaylandQuickItem::surfaceDestroyed() + * + * This signal is emitted when the client has destroyed the \c wl_surface associated + * with the QWaylandQuickItem. The handler for this signal is expected to either destroy the + * QWaylandQuickItem immediately or start a close animation and then destroy the Item. + * + * If an animation is started, bufferLocked should be set to ensure the item keeps its content + * until the animation finishes + * + * \sa QWaylandQuickkItem::bufferLocked + */ + QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { Q_D(QWaylandQuickItem); diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index 945d6882..05113c41 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -410,7 +410,7 @@ QWaylandSurface::~QWaylandSurface() } /*! - * \qmlmethod void QtWaylandCompositor::WaylandSurface::initialize(object compositor, object client, int id, int version) + * \qmlmethod void QtWaylandCompositor::WaylandSurface::initialize(WaylandCompositor compositor, WaylandClient client, int id, int version) * * Initializes the WaylandSurface with the given \a compositor and \a client, and with the given \a id * and \a version. @@ -888,7 +888,7 @@ void QWaylandSurfacePrivate::Subsurface::subsurface_set_desync(wl_subsurface::Re } /*! - * \qmlsignal void QtWaylandCompositor::WaylandSurface::dragStarted(object drag) + * \qmlsignal void QtWaylandCompositor::WaylandSurface::dragStarted(WaylandDrag drag) * * This signal is emitted when a \a drag has started from this surface. */ diff --git a/src/compositor/extensions/qwaylandiviapplication.cpp b/src/compositor/extensions/qwaylandiviapplication.cpp index d0466244..8295d2a1 100644 --- a/src/compositor/extensions/qwaylandiviapplication.cpp +++ b/src/compositor/extensions/qwaylandiviapplication.cpp @@ -137,7 +137,7 @@ QByteArray QWaylandIviApplication::interfaceName() } /*! - * \qmlsignal void QtWaylandCompositor::IviApplication::iviSurfaceRequested(object surface, int iviId, object resource) + * \qmlsignal void QtWaylandCompositor::IviApplication::iviSurfaceRequested(WaylandSurface surface, int iviId, WaylandResource resource) * * This signal is emitted when the client has requested an \c ivi_surface to be associated * with \a surface, which is identified by \a id. The handler for this signal is @@ -146,7 +146,7 @@ QByteArray QWaylandIviApplication::interfaceName() */ /*! - * \fn void QWaylandWlShell::iviSurfaceRequested(QWaylandSurface *surface, uint iviId, const QWaylandResource &resource) + * \fn void QWaylandIviApplication::iviSurfaceRequested(QWaylandSurface *surface, uint iviId, const QWaylandResource &resource) * * This signal is emitted when the client has requested an \c ivi_surface to be associated * with \a surface, which is identified by \a id. The handler for this signal is @@ -155,16 +155,16 @@ QByteArray QWaylandIviApplication::interfaceName() */ /*! - * \qmlsignal void QtWaylandCompositor::IviApplication::iviSurfaceCreated(object *iviSurface) + * \qmlsignal void QtWaylandCompositor::IviApplication::iviSurfaceCreated(IviSurface *iviSurface) * * This signal is emitted when an IviSurface has been created. The supplied \a iviSurface is * most commonly used to instantiate a ShellSurfaceItem. */ /*! - * \fn void QtWaylandCompositor::IviApplication::iviSurfaceCreated(QWaylandIviSurface *iviSurface) + * \fn void QWaylandIviApplication::iviSurfaceCreated(QWaylandIviSurface *iviSurface) * - * This signal is emitted when an IviSurface has been created. + * This signal is emitted when an IviSurface, \a iviSurface, has been created. */ QWaylandIviApplicationPrivate::QWaylandIviApplicationPrivate() diff --git a/src/compositor/extensions/qwaylandivisurface.cpp b/src/compositor/extensions/qwaylandivisurface.cpp index 08b95b3b..2bdd4a14 100644 --- a/src/compositor/extensions/qwaylandivisurface.cpp +++ b/src/compositor/extensions/qwaylandivisurface.cpp @@ -93,10 +93,10 @@ QWaylandIviSurface::QWaylandIviSurface(QWaylandIviApplication *application, QWay } /*! - * \qmlmethod void QtWaylandCompositor::IviSurface::initialize(object iviApplication, object surface, int iviId, object resource) + * \qmlmethod void QtWaylandCompositor::IviSurface::initialize(IviApplication iviApplication, WaylandSurface surface, int iviId, WaylandResource resource) * * Initializes the IviSurface, associating it with the given \a iviApplication, \a surface, - * \a client, \a iviId, and \a resource. + * \a iviId, and \a resource. */ /*! diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp index 96dbd3dc..4cdbb0a3 100644 --- a/src/compositor/extensions/qwaylandwlshell.cpp +++ b/src/compositor/extensions/qwaylandwlshell.cpp @@ -475,9 +475,9 @@ QWaylandWlShellSurface::~QWaylandWlShellSurface() } /*! - * \qmlmethod void QtWaylandCompositor::WlShellSurface::initialize(object shell, object surface, object client, int id) + * \qmlmethod void QtWaylandCompositor::WlShellSurface::initialize(WlShell shell, WaylandSurface surface, WaylandResource resource) * - * Initializes the WlShellSurface with \a id and associates it with the given \a shell, \a surface, and \a client. + * Initializes the WlShellSurface and associates it with the given \a shell, \a surface, and \a resource. */ /*! @@ -633,11 +633,6 @@ QWaylandWlShell *QWaylandWlShellSurface::shell() const * This property holds the window type of the WlShellSurface. */ -/*! - * \property QWaylandWlShellSurface::windowType - * - * This property holds the window type of the QWaylandWlShellSurface. - */ Qt::WindowType QWaylandWlShellSurface::windowType() const { Q_D(const QWaylandWlShellSurface); diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp index c0cb4f8e..b5db226c 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5.cpp @@ -825,10 +825,10 @@ QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *xdgShell, QWaylan } /*! - * \qmlmethod void QtWaylandCompositor::XdgSurfaceV5::initialize(object surface, object client, int id) + * \qmlmethod void QtWaylandCompositor::XdgSurfaceV5::initialize(XdgShellV5 xdgShell, WaylandSurface surface, WaylandResource resource) * - * Initializes the XdgSurfaceV5, associating it with the given \a surface, - * \a client, and \a id. + * Initializes the XdgSurfaceV5, associating it with the given \a xdgShell, \a surface, + * and \a resource. */ /*! @@ -888,11 +888,11 @@ void QWaylandXdgSurfaceV5::initialize(QWaylandXdgShellV5 *xdgShell, QWaylandSurf * typically in response to the window decorations being dragged by \a seat on the window borders * given by \a edges. * - * \sa QWaylandXdgSurfaceV5::ResizeEdges + * \sa QWaylandXdgSurfaceV5::ResizeEdge */ /*! - * \fn void QWaylandXdgSurfaceV5::startResize(QWaylandSeat *seat, ResizeEdges edges) + * \fn void QWaylandXdgSurfaceV5::startResize(QWaylandSeat *seat, ResizeEdge edges) * * This signal is emitted when the client wants to start an interactive resize of the * QWaylandXdgSurfaceV5, typically in response to the window decorations being dragged by @@ -1048,11 +1048,6 @@ QWaylandSurface *QWaylandXdgSurfaceV5::surface() const * This property holds the window type of the XdgSurfaceV5. */ -/*! - * \property QWaylandXdgSurfaceV5::windowType - * - * This property holds the window type of the QWaylandXdgSurfaceV5. - */ Qt::WindowType QWaylandXdgSurfaceV5::windowType() const { Q_D(const QWaylandXdgSurfaceV5); @@ -1367,10 +1362,10 @@ QWaylandXdgPopupV5::QWaylandXdgPopupV5(QWaylandXdgShellV5 *xdgShell, QWaylandSur } /*! - * \qmlmethod void QtWaylandCompositor::XdgPopupV5::initialize(object surface, object parentSurface, object resource) + * \qmlmethod void QtWaylandCompositor::XdgPopupV5::initialize(XdgShellV5 shell, WaylandSurface surface, WaylandSurface parentSurface, point position, WaylandResource resource) * * Initializes the xdg popup, associating it with the given \a shell, \a surface, - * \a parentSurface and \a resource. + * \a parentSurface, \a position and \a resource. */ /*! diff --git a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri index df3aead3..e20c6802 100644 --- a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri +++ b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri @@ -1,6 +1,6 @@ INCLUDEPATH += $$PWD -QMAKE_USE_PRIVATE += wayland-server wayland-egl +QMAKE_USE_PRIVATE += egl wayland-server wayland-egl QT += egl_support-private diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp index 453800c1..f5e63aec 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp @@ -198,10 +198,14 @@ public: QEGLStreamConvenience *funcs; static WaylandEglClientBufferIntegrationPrivate *get(WaylandEglClientBufferIntegration *integration) { - return integration->d_ptr.data(); + return shuttingDown ? nullptr : integration->d_ptr.data(); } + + static bool shuttingDown; }; +bool WaylandEglClientBufferIntegrationPrivate::shuttingDown = false; + BufferState::BufferState() : egl_format(EGL_TEXTURE_RGBA) , egl_stream(EGL_NO_STREAM_KHR) @@ -395,6 +399,11 @@ WaylandEglClientBufferIntegration::WaylandEglClientBufferIntegration() { } +WaylandEglClientBufferIntegration::~WaylandEglClientBufferIntegration() +{ + WaylandEglClientBufferIntegrationPrivate::shuttingDown = true; +} + void WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *display) { Q_D(WaylandEglClientBufferIntegration); @@ -480,6 +489,24 @@ WaylandEglClientBuffer::WaylandEglClientBuffer(WaylandEglClientBufferIntegration } } + +WaylandEglClientBuffer::~WaylandEglClientBuffer() +{ + auto *p = WaylandEglClientBufferIntegrationPrivate::get(m_integration); + + if (p) { + for (auto image : d->egl_images) + p->egl_destroy_image(p->egl_display, image); + + if (d->egl_stream) + p->funcs->destroy_stream(p->egl_display, d->egl_stream); + + for (auto *texture : d->textures) + delete texture; + } + delete d; +} + static QWaylandBufferRef::BufferFormatEgl formatFromEglFormat(EGLint format) { switch (format) { case EGL_TEXTURE_RGB: diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h index 5217039d..60ce814d 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h @@ -53,6 +53,7 @@ class WaylandEglClientBufferIntegration : public QtWayland::ClientBufferIntegrat Q_DECLARE_PRIVATE(WaylandEglClientBufferIntegration) public: WaylandEglClientBufferIntegration(); + ~WaylandEglClientBufferIntegration(); void initializeHardware(struct ::wl_display *display) override; @@ -68,6 +69,8 @@ struct BufferState; class WaylandEglClientBuffer : public QtWayland::ClientBuffer { public: + ~WaylandEglClientBuffer(); + QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override; QSize size() const override; QWaylandSurface::Origin origin() const override; diff --git a/tests/auto/client/client/client.pro b/tests/auto/client/client/client.pro index 34fc6747..e6e607c3 100644 --- a/tests/auto/client/client/client.pro +++ b/tests/auto/client/client/client.pro @@ -2,7 +2,7 @@ CONFIG += testcase link_pkgconfig TARGET = tst_client QT += testlib -QT += core-private gui-private +QT += core-private gui-private waylandclient-private QMAKE_USE += wayland-client wayland-server diff --git a/tests/auto/client/client/mockinput.cpp b/tests/auto/client/client/mockinput.cpp index 99acdd43..b2bcdf2e 100644 --- a/tests/auto/client/client/mockinput.cpp +++ b/tests/auto/client/client/mockinput.cpp @@ -365,7 +365,9 @@ void Touch::sendDown(Surface *surface, const QPoint &position, int id) Q_ASSERT(surface); Resource *resource = resourceMap().value(surface->resource()->client()); Q_ASSERT(resource); - wl_touch_send_down(resource->handle, serial, time, surface->resource()->handle, id, position.x(), position.y()); + auto x = wl_fixed_from_int(position.x()); + auto y = wl_fixed_from_int(position.y()); + wl_touch_send_down(resource->handle, serial, time, surface->resource()->handle, id, x, y); } void Touch::sendUp(Surface *surface, int id) @@ -378,7 +380,9 @@ void Touch::sendMotion(Surface *surface, const QPoint &position, int id) { Resource *resource = resourceMap().value(surface->resource()->client()); uint32_t time = m_compositor->time(); - wl_touch_send_motion(resource->handle, time, id, position.x(), position.y()); + auto x = wl_fixed_from_int(position.x()); + auto y = wl_fixed_from_int(position.y()); + wl_touch_send_motion(resource->handle, time, id, x, y); } void Touch::sendFrame(Surface *surface) diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp index 1eee90f4..3897bd3b 100644 --- a/tests/auto/client/client/tst_client.cpp +++ b/tests/auto/client/client/tst_client.cpp @@ -37,6 +37,8 @@ #include <QDrag> #include <QtTest/QtTest> +#include <QtWaylandClient/private/qwaylandintegration_p.h> +#include <QtGui/private/qguiapplication_p.h> static const QSize screenSize(1600, 1200); @@ -96,6 +98,8 @@ public: ++touchEventCount; } + QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } + int focusInEventCount; int focusOutEventCount; int keyPressEventCount; @@ -201,7 +205,7 @@ void tst_WaylandClient::events() QPoint mousePressPos(16, 16); QCOMPARE(window.mousePressEventCount, 0); - compositor->sendMousePress(surface, mousePressPos); + compositor->sendMousePress(surface, window.frameOffset() + mousePressPos); QTRY_COMPARE(window.mousePressEventCount, 1); QTRY_COMPARE(window.mousePressPos, mousePressPos); @@ -210,7 +214,7 @@ void tst_WaylandClient::events() QTRY_COMPARE(window.mouseReleaseEventCount, 1); const int touchId = 0; - compositor->sendTouchDown(surface, QPoint(10, 10), touchId); + compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), touchId); compositor->sendTouchFrame(surface); QTRY_COMPARE(window.touchEventCount, 1); @@ -269,6 +273,7 @@ public: m_dragIcon = QPixmap::fromImage(cursorImage); } ~DndWindow(){} + QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } bool dragStarted; protected: @@ -302,14 +307,14 @@ void tst_WaylandClient::touchDrag() QTRY_COMPARE(QGuiApplication::focusWindow(), &window); const int id = 0; - compositor->sendTouchDown(surface, QPoint(10, 10), id); + compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), id); compositor->sendTouchFrame(surface); - compositor->sendTouchMotion(surface, QPoint(20, 20), id); + compositor->sendTouchMotion(surface, window.frameOffset() + QPoint(20, 20), id); compositor->sendTouchFrame(surface); compositor->waitForStartDrag(); compositor->sendDataDeviceDataOffer(surface); - compositor->sendDataDeviceEnter(surface, QPoint(20, 20)); - compositor->sendDataDeviceMotion( QPoint(21, 21)); + compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20)); + compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21)); compositor->sendDataDeviceDrop(surface); compositor->sendDataDeviceLeave(surface); QTRY_VERIFY(window.dragStarted); @@ -326,10 +331,10 @@ void tst_WaylandClient::mouseDrag() compositor->setKeyboardFocus(surface); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); - compositor->sendMousePress(surface, QPoint(10, 10)); + compositor->sendMousePress(surface, window.frameOffset() + QPoint(10, 10)); compositor->sendDataDeviceDataOffer(surface); - compositor->sendDataDeviceEnter(surface, QPoint(20, 20)); - compositor->sendDataDeviceMotion( QPoint(21, 21)); + compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20)); + compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21)); compositor->waitForStartDrag(); compositor->sendDataDeviceDrop(surface); compositor->sendDataDeviceLeave(surface); @@ -390,7 +395,7 @@ void tst_WaylandClient::hiddenPopupParent() QTRY_VERIFY(surface = compositor->surface()); QPoint mousePressPos(16, 16); QCOMPARE(toplevel.mousePressEventCount, 0); - compositor->sendMousePress(surface, mousePressPos); + compositor->sendMousePress(surface, toplevel.frameOffset() + mousePressPos); QTRY_COMPARE(toplevel.mousePressEventCount, 1); QWindow popup; @@ -409,15 +414,17 @@ int main(int argc, char **argv) setenv("XDG_RUNTIME_DIR", ".", 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin - // wayland-egl hangs in the test setup when we try to initialize. Until it gets - // figured out, avoid clientBufferIntegration() from being called in - // QWaylandWindow::createDecorations(). - setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); - MockCompositor compositor; compositor.setOutputGeometry(QRect(QPoint(), screenSize)); QGuiApplication app(argc, argv); + + // Initializing some client buffer integrations (i.e. eglInitialize) may block while waiting + // for a wayland sync. So we call clientBufferIntegration prior to applicationInitialized + // (while the compositor processes events without waiting) in order to avoid hanging later. + auto *waylandIntegration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration()); + waylandIntegration->clientBufferIntegration(); + compositor.applicationInitialized(); tst_WaylandClient tc(&compositor); diff --git a/tests/auto/compositor/compositor/compositor.pro b/tests/auto/compositor/compositor/compositor.pro index 112e2e74..2919fa4b 100644 --- a/tests/auto/compositor/compositor/compositor.pro +++ b/tests/auto/compositor/compositor/compositor.pro @@ -7,7 +7,7 @@ QT += core-private gui-private waylandcompositor waylandcompositor-private QMAKE_USE += wayland-client wayland-server -qtConfig(xkbcommon-evdev) +qtConfig(xkbcommon-evdev): \ QMAKE_USE += xkbcommon_evdev WAYLANDCLIENTSOURCES += \ |