Merge branch 'wip-compositor-api' into dev

This introduces the new compositor API, removing the
old API (which was never officially supported).

Change-Id: I1dc01f0fb4edc749e34ed8356e56ad87d7d64913
This commit is contained in:
Paul Olav Tvete 2015-12-02 14:00:44 +01:00
commit a1c0b7e148
9 changed files with 104 additions and 115 deletions

View File

@ -129,7 +129,7 @@ void QWaylandAbstractDecoration::setMouseButtons(Qt::MouseButtons mb)
void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons) void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons)
{ {
Q_D(QWaylandAbstractDecoration); Q_D(QWaylandAbstractDecoration);
if (isLeftClicked(buttons)) { if (isLeftClicked(buttons) && d->m_wayland_window->shellSurface()) {
d->m_wayland_window->shellSurface()->resize(inputDevice, resize); d->m_wayland_window->shellSurface()->resize(inputDevice, resize);
inputDevice->removeMouseButtonFromState(Qt::LeftButton); inputDevice->removeMouseButtonFromState(Qt::LeftButton);
} }
@ -138,7 +138,7 @@ void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, e
void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons) void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons)
{ {
Q_D(QWaylandAbstractDecoration); Q_D(QWaylandAbstractDecoration);
if (isLeftClicked(buttons)) { if (isLeftClicked(buttons) && d->m_wayland_window->shellSurface()) {
d->m_wayland_window->shellSurface()->move(inputDevice); d->m_wayland_window->shellSurface()->move(inputDevice);
inputDevice->removeMouseButtonFromState(Qt::LeftButton); inputDevice->removeMouseButtonFromState(Qt::LeftButton);
} }

View File

@ -3,41 +3,35 @@
** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt.io/licensing/ ** Contact: http://www.qt.io/licensing/
** **
** This file is part of the Qt Compositor. ** This file is part of the QtWaylandClient module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:BSD$ ** $QT_BEGIN_LICENSE:LGPL21$
** You may use this file under the terms of the BSD license as follows: ** 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 The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** **
** "Redistribution and use in source and binary forms, with or without ** GNU Lesser General Public License Usage
** modification, are permitted provided that the following conditions are ** Alternatively, this file may be used under the terms of the GNU Lesser
** met: ** General Public License version 2.1 or version 3 as published by the Free
** * Redistributions of source code must retain the above copyright ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** notice, this list of conditions and the following disclaimer. ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** * Redistributions in binary form must reproduce the above copyright ** following information to ensure the GNU Lesser General Public License
** notice, this list of conditions and the following disclaimer in ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** the documentation and/or other materials provided with the ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
** **
** ** As a special exception, The Qt Company gives you certain additional
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** rights. These rights are described in The Qt Company LGPL Exception
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
#include "qwaylanddatadevice_p.h" #include "qwaylanddatadevice_p.h"
#include "qwaylanddatadevicemanager_p.h" #include "qwaylanddatadevicemanager_p.h"

View File

@ -3,41 +3,35 @@
** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt.io/licensing/ ** Contact: http://www.qt.io/licensing/
** **
** This file is part of the Qt Compositor. ** This file is part of the QtWaylandClient module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:BSD$ ** $QT_BEGIN_LICENSE:LGPL21$
** You may use this file under the terms of the BSD license as follows: ** 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 The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** **
** "Redistribution and use in source and binary forms, with or without ** GNU Lesser General Public License Usage
** modification, are permitted provided that the following conditions are ** Alternatively, this file may be used under the terms of the GNU Lesser
** met: ** General Public License version 2.1 or version 3 as published by the Free
** * Redistributions of source code must retain the above copyright ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** notice, this list of conditions and the following disclaimer. ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** * Redistributions in binary form must reproduce the above copyright ** following information to ensure the GNU Lesser General Public License
** notice, this list of conditions and the following disclaimer in ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** the documentation and/or other materials provided with the ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
** **
** ** As a special exception, The Qt Company gives you certain additional
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** rights. These rights are described in The Qt Company LGPL Exception
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
#ifndef QWAYLANDDATADEVICE_H #ifndef QWAYLANDDATADEVICE_H
#define QWAYLANDDATADEVICE_H #define QWAYLANDDATADEVICE_H

View File

@ -67,7 +67,6 @@ class QSocketNotifier;
class QPlatformScreen; class QPlatformScreen;
namespace QtWayland { namespace QtWayland {
class qt_output_extension;
class qt_shell; class qt_shell;
class qt_sub_surface_extension; class qt_sub_surface_extension;
class qt_surface_extension; class qt_surface_extension;

View File

@ -75,7 +75,7 @@ protected:
void startDrag() Q_DECL_OVERRIDE; void startDrag() Q_DECL_OVERRIDE;
void cancel() Q_DECL_OVERRIDE; void cancel() Q_DECL_OVERRIDE;
void move(const QPoint &globalPos) Q_DECL_OVERRIDE; void move(const QPoint &globalPos) Q_DECL_OVERRIDE;
void drop(const QPoint &globalpos) Q_DECL_OVERRIDE; void drop(const QPoint &globalPos) Q_DECL_OVERRIDE;
void endDrag() Q_DECL_OVERRIDE; void endDrag() Q_DECL_OVERRIDE;

View File

@ -3,41 +3,35 @@
** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt.io/licensing/ ** Contact: http://www.qt.io/licensing/
** **
** This file is part of the Qt Compositor. ** This file is part of the QtWaylandClient module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:BSD$ ** $QT_BEGIN_LICENSE:LGPL21$
** You may use this file under the terms of the BSD license as follows: ** 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 The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** **
** "Redistribution and use in source and binary forms, with or without ** GNU Lesser General Public License Usage
** modification, are permitted provided that the following conditions are ** Alternatively, this file may be used under the terms of the GNU Lesser
** met: ** General Public License version 2.1 or version 3 as published by the Free
** * Redistributions of source code must retain the above copyright ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** notice, this list of conditions and the following disclaimer. ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** * Redistributions in binary form must reproduce the above copyright ** following information to ensure the GNU Lesser General Public License
** notice, this list of conditions and the following disclaimer in ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** the documentation and/or other materials provided with the ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
** **
** ** As a special exception, The Qt Company gives you certain additional
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** rights. These rights are described in The Qt Company LGPL Exception
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
#include "qwaylandinputcontext_p.h" #include "qwaylandinputcontext_p.h"
#include <QGuiApplication> #include <QGuiApplication>

View File

@ -3,41 +3,35 @@
** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt.io/licensing/ ** Contact: http://www.qt.io/licensing/
** **
** This file is part of the Qt Compositor. ** This file is part of the QtWaylandClient module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:BSD$ ** $QT_BEGIN_LICENSE:LGPL21$
** You may use this file under the terms of the BSD license as follows: ** 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 The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** **
** "Redistribution and use in source and binary forms, with or without ** GNU Lesser General Public License Usage
** modification, are permitted provided that the following conditions are ** Alternatively, this file may be used under the terms of the GNU Lesser
** met: ** General Public License version 2.1 or version 3 as published by the Free
** * Redistributions of source code must retain the above copyright ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** notice, this list of conditions and the following disclaimer. ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** * Redistributions in binary form must reproduce the above copyright ** following information to ensure the GNU Lesser General Public License
** notice, this list of conditions and the following disclaimer in ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** the documentation and/or other materials provided with the ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
** **
** ** As a special exception, The Qt Company gives you certain additional
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** rights. These rights are described in The Qt Company LGPL Exception
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
#ifndef QWAYLANDINPUTCONTEXT_H #ifndef QWAYLANDINPUTCONTEXT_H
#define QWAYLANDINPUTCONTEXT_H #define QWAYLANDINPUTCONTEXT_H

View File

@ -170,7 +170,10 @@ void QWaylandWindow::initWindow()
if (QScreen *s = window()->screen()) if (QScreen *s = window()->screen())
setOrientationMask(s->orientationUpdateMask()); setOrientationMask(s->orientationUpdateMask());
setWindowFlags(window()->flags()); setWindowFlags(window()->flags());
setGeometry_helper(window()->geometry()); if (window()->geometry().isEmpty())
setGeometry_helper(QRect(QPoint(), QSize(500,500)));
else
setGeometry_helper(window()->geometry());
setMask(window()->mask()); setMask(window()->mask());
setWindowStateInternal(window()->windowState()); setWindowStateInternal(window()->windowState());
handleContentOrientationChange(window()->contentOrientation()); handleContentOrientationChange(window()->contentOrientation());
@ -389,8 +392,8 @@ void QWaylandWindow::setCanResize(bool canResize)
doResize(); doResize();
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
} else if (mResizeDirty) { } else if (mResizeDirty) {
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
mResizeDirty = false; mResizeDirty = false;
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
} }
} }
} }

View File

@ -386,7 +386,6 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
printf("\n"); printf("\n");
printf("QT_BEGIN_NAMESPACE\n"); printf("QT_BEGIN_NAMESPACE\n");
QByteArray serverExport; QByteArray serverExport;
if (headerPath.size()) { if (headerPath.size()) {
serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT"; serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT";
@ -451,6 +450,11 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
printf("\n"); printf("\n");
printf(" bool isGlobal() const { return m_global != 0; }\n"); printf(" bool isGlobal() const { return m_global != 0; }\n");
printf(" bool isResource() const { return m_resource != 0; }\n"); printf(" bool isResource() const { return m_resource != 0; }\n");
printf("\n");
printf(" static const struct ::wl_interface *interface();\n");
printf(" static QByteArray interfaceName() { return interface()->name; }\n");
printf(" static int interfaceVersion() { return interface()->version; }\n");
printf("\n");
printEnums(interface.enums); printEnums(interface.enums);
@ -612,6 +616,12 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
printf(" }\n"); printf(" }\n");
printf("\n"); printf("\n");
printf(" const struct wl_interface *%s::interface()\n", interfaceName);
printf(" {\n");
printf(" return &::%s_interface;\n", interfaceName);
printf(" }\n");
printf("\n");
printf(" %s::Resource *%s::%s_allocate()\n", interfaceName, interfaceName, interfaceNameStripped); printf(" %s::Resource *%s::%s_allocate()\n", interfaceName, interfaceName, interfaceNameStripped);
printf(" {\n"); printf(" {\n");
printf(" return new Resource;\n"); printf(" return new Resource;\n");
@ -656,6 +666,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
//and use function overloading instead. Jan do you have a lot of code dependent on this behavior? //and use function overloading instead. Jan do you have a lot of code dependent on this behavior?
printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName); printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName);
printf(" {\n"); printf(" {\n");
printf(" Q_ASSERT_X(!wl_client_get_object(client, id), \"QWaylandObject bind\", QStringLiteral(\"binding to object %%1 more than once\").arg(id).toLocal8Bit().constData());\n");
printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped);
printf(" resource->%s_object = this;\n", interfaceNameStripped); printf(" resource->%s_object = this;\n", interfaceNameStripped);
printf("\n"); printf("\n");