Merge remote-tracking branch 'origin/5.4' into dev

Change-Id: Ie82592f160ebf545fac7b864db5e38c9ce9bb41f
This commit is contained in:
Oswald Buddenhagen 2014-08-15 23:38:47 +02:00
commit a34017d157
10 changed files with 166 additions and 4 deletions

View File

@ -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" #include "qwaylandserverbufferintegration_p.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -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 "qwaylandeventthread_p.h"
#include <QtCore/QSocketNotifier> #include <QtCore/QSocketNotifier>
#include <QCoreApplication> #include <QCoreApplication>

View File

@ -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 #ifndef QWAYLANDEVENTTHREAD_H
#define QWAYLANDEVENTTHREAD_H #define QWAYLANDEVENTTHREAD_H

View File

@ -194,6 +194,7 @@ void QWaylandIntegration::initialize()
{ {
QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay, SLOT(flushRequests())); QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay, SLOT(flushRequests()));
QObject::connect(dispatcher, SIGNAL(awake()), mDisplay, SLOT(flushRequests()));
} }
QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const

View File

@ -335,9 +335,9 @@ void QWaylandWindow::setCanResize(bool canResize)
} }
if (!mConfigure.isEmpty()) { if (!mConfigure.isEmpty()) {
doResize(); doResize();
QWindowSystemInterface::handleExposeEvent(window(), geometry()); QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
} else if (mResizeDirty) { } else if (mResizeDirty) {
QWindowSystemInterface::handleExposeEvent(window(), geometry()); QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
mResizeDirty = false; mResizeDirty = false;
} }
} }
@ -353,7 +353,7 @@ void QWaylandWindow::requestResize()
mRequestResizeSent = false; mRequestResizeSent = false;
lock.unlock(); lock.unlock();
QWindowSystemInterface::handleExposeEvent(window(), geometry()); QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
QWindowSystemInterface::flushWindowSystemEvents(); QWindowSystemInterface::flushWindowSystemEvents();
} }

View File

@ -189,6 +189,11 @@ void *MockCompositor::run(void *data)
return 0; return 0;
} }
void MockCompositor::discardSurfaces()
{
m_compositor->discardSurfaces();
}
namespace Impl { namespace Impl {
Compositor::Compositor() Compositor::Compositor()
@ -286,12 +291,17 @@ void Compositor::addSurface(Surface *surface)
void Compositor::removeSurface(Surface *surface) void Compositor::removeSurface(Surface *surface)
{ {
m_surfaces.remove(m_surfaces.indexOf(surface)); m_surfaces.removeOne(surface);
if (m_keyboard->focus() == surface) if (m_keyboard->focus() == surface)
m_keyboard->setFocus(0); m_keyboard->setFocus(0);
if (m_pointer->focus() == surface) if (m_pointer->focus() == surface)
m_pointer->setFocus(0, QPoint()); m_pointer->setFocus(0, QPoint());
} }
void Compositor::discardSurfaces()
{
m_surfaces.clear();
}
} }

View File

@ -81,6 +81,7 @@ public:
void addSurface(Surface *surface); void addSurface(Surface *surface);
void removeSurface(Surface *surface); void removeSurface(Surface *surface);
void discardSurfaces();
static void setKeyboardFocus(void *data, const QList<QVariant> &parameters); static void setKeyboardFocus(void *data, const QList<QVariant> &parameters);
static void sendMousePress(void *data, const QList<QVariant> &parameters); static void sendMousePress(void *data, const QList<QVariant> &parameters);
@ -154,6 +155,7 @@ public:
void sendKeyRelease(const QSharedPointer<MockSurface> &surface, uint code); void sendKeyRelease(const QSharedPointer<MockSurface> &surface, uint code);
QSharedPointer<MockSurface> surface(); QSharedPointer<MockSurface> surface();
void discardSurfaces();
void lock(); void lock();
void unlock(); void unlock();

View File

@ -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) Pointer::Pointer(Compositor *compositor)
: wl_pointer() : wl_pointer()
, m_compositor(compositor) , 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;
}
} }

View File

@ -88,6 +88,9 @@ public:
void sendKey(uint32_t key, uint32_t state); void sendKey(uint32_t key, uint32_t state);
protected:
void keyboard_destroy_resource(wl_keyboard::Resource *resource) Q_DECL_OVERRIDE;
private: private:
Compositor *m_compositor; Compositor *m_compositor;
@ -107,6 +110,9 @@ public:
void sendMotion(const QPoint &pos); void sendMotion(const QPoint &pos);
void sendButton(uint32_t button, uint32_t state); void sendButton(uint32_t button, uint32_t state);
protected:
void pointer_destroy_resource(wl_pointer::Resource *resource) Q_DECL_OVERRIDE;
private: private:
Compositor *m_compositor; Compositor *m_compositor;

View File

@ -119,6 +119,9 @@ public:
{ {
QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this);
connect(notifier, SIGNAL(activated(int)), this, SLOT(processWaylandEvents())); 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: public slots:
@ -146,7 +149,11 @@ private:
void tst_WaylandClient::screen() void tst_WaylandClient::screen()
{ {
QCoreApplication::processEvents(QEventLoop::AllEvents);
QTRY_COMPARE(QGuiApplication::primaryScreen()->size(), screenSize); QTRY_COMPARE(QGuiApplication::primaryScreen()->size(), screenSize);
// discard the cursor surface created by the QWaylandInputDevice
compositor->discardSurfaces();
} }
void tst_WaylandClient::createDestroyWindow() void tst_WaylandClient::createDestroyWindow()