diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index 6e3abe913f4..5bac689293a 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qwaylandserverbufferintegration_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index d309f7bb234..c6ac42bba8f 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qwaylandeventthread_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandeventthread_p.h b/src/plugins/platforms/wayland/qwaylandeventthread_p.h index 4174c96cfab..0d2758c4c67 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread_p.h +++ b/src/plugins/platforms/wayland/qwaylandeventthread_p.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QWAYLANDEVENTTHREAD_H #define QWAYLANDEVENTTHREAD_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 85300a13062..88eeed842ad 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -194,6 +194,7 @@ void QWaylandIntegration::initialize() { QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay, SLOT(flushRequests())); + QObject::connect(dispatcher, SIGNAL(awake()), mDisplay, SLOT(flushRequests())); } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a3e9b53cf28..11d29045535 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -335,9 +335,9 @@ void QWaylandWindow::setCanResize(bool canResize) } if (!mConfigure.isEmpty()) { doResize(); - QWindowSystemInterface::handleExposeEvent(window(), geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } else if (mResizeDirty) { - QWindowSystemInterface::handleExposeEvent(window(), geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); mResizeDirty = false; } } @@ -353,7 +353,7 @@ void QWaylandWindow::requestResize() mRequestResizeSent = false; lock.unlock(); - QWindowSystemInterface::handleExposeEvent(window(), geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); QWindowSystemInterface::flushWindowSystemEvents(); } diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index e51f3ed577a..bb4f10fd942 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -189,6 +189,11 @@ void *MockCompositor::run(void *data) return 0; } +void MockCompositor::discardSurfaces() +{ + m_compositor->discardSurfaces(); +} + namespace Impl { Compositor::Compositor() @@ -286,12 +291,17 @@ void Compositor::addSurface(Surface *surface) void Compositor::removeSurface(Surface *surface) { - m_surfaces.remove(m_surfaces.indexOf(surface)); + m_surfaces.removeOne(surface); if (m_keyboard->focus() == surface) m_keyboard->setFocus(0); if (m_pointer->focus() == surface) m_pointer->setFocus(0, QPoint()); } +void Compositor::discardSurfaces() +{ + m_surfaces.clear(); +} + } diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 7f3e2268312..68e55d3562c 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -81,6 +81,7 @@ public: void addSurface(Surface *surface); void removeSurface(Surface *surface); + void discardSurfaces(); static void setKeyboardFocus(void *data, const QList ¶meters); static void sendMousePress(void *data, const QList ¶meters); @@ -154,6 +155,7 @@ public: void sendKeyRelease(const QSharedPointer &surface, uint code); QSharedPointer surface(); + void discardSurfaces(); void lock(); void unlock(); diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 40b01317f9a..7dbb735ed22 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -164,6 +164,13 @@ void Keyboard::sendKey(uint32_t key, uint32_t state) } } + +void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource) +{ + if (m_focusResource == resource) + m_focusResource = 0; +} + Pointer::Pointer(Compositor *compositor) : wl_pointer() , m_compositor(compositor) @@ -210,4 +217,10 @@ void Pointer::sendButton(uint32_t button, uint32_t state) } } +void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource) +{ + if (m_focusResource == resource) + m_focusResource = 0; +} + } diff --git a/tests/auto/wayland/mockinput.h b/tests/auto/wayland/mockinput.h index 669bfaed608..128758cad93 100644 --- a/tests/auto/wayland/mockinput.h +++ b/tests/auto/wayland/mockinput.h @@ -88,6 +88,9 @@ public: void sendKey(uint32_t key, uint32_t state); +protected: + void keyboard_destroy_resource(wl_keyboard::Resource *resource) Q_DECL_OVERRIDE; + private: Compositor *m_compositor; @@ -107,6 +110,9 @@ public: void sendMotion(const QPoint &pos); void sendButton(uint32_t button, uint32_t state); +protected: + void pointer_destroy_resource(wl_pointer::Resource *resource) Q_DECL_OVERRIDE; + private: Compositor *m_compositor; diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index b43f531161e..9c3138bcb09 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -119,6 +119,9 @@ public: { QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); connect(notifier, SIGNAL(activated(int)), this, SLOT(processWaylandEvents())); + // connect to the event dispatcher to make sure to flush out the outgoing message queue + connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClient::processWaylandEvents); + connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClient::processWaylandEvents); } public slots: @@ -146,7 +149,11 @@ private: void tst_WaylandClient::screen() { + QCoreApplication::processEvents(QEventLoop::AllEvents); + QTRY_COMPARE(QGuiApplication::primaryScreen()->size(), screenSize); + // discard the cursor surface created by the QWaylandInputDevice + compositor->discardSurfaces(); } void tst_WaylandClient::createDestroyWindow()