diff options
Diffstat (limited to 'src/compositor')
103 files changed, 2097 insertions, 1036 deletions
diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri index 2ef7231bf..ac356b8fa 100644 --- a/src/compositor/compositor_api/compositor_api.pri +++ b/src/compositor/compositor_api/compositor_api.pri @@ -2,10 +2,12 @@ INCLUDEPATH += compositor_api HEADERS += \ compositor_api/qwaylandcompositor.h \ + compositor_api/qwaylandclient.h \ compositor_api/qwaylandsurface.h \ compositor_api/qwaylandsurface_p.h \ compositor_api/qwaylandinput.h \ compositor_api/qwaylandinputpanel.h \ + compositor_api/qwaylandoutput.h \ compositor_api/qwaylanddrag.h \ compositor_api/qwaylandbufferref.h \ compositor_api/qwaylandsurfaceview.h \ @@ -14,9 +16,11 @@ HEADERS += \ SOURCES += \ compositor_api/qwaylandcompositor.cpp \ + compositor_api/qwaylandclient.cpp \ compositor_api/qwaylandsurface.cpp \ compositor_api/qwaylandinput.cpp \ compositor_api/qwaylandinputpanel.cpp \ + compositor_api/qwaylandoutput.cpp \ compositor_api/qwaylanddrag.cpp \ compositor_api/qwaylandbufferref.cpp \ compositor_api/qwaylandsurfaceview.cpp \ @@ -29,11 +33,13 @@ qtHaveModule(quick) { SOURCES += \ compositor_api/qwaylandquickcompositor.cpp \ compositor_api/qwaylandquicksurface.cpp \ + compositor_api/qwaylandquickoutput.cpp \ compositor_api/qwaylandsurfaceitem.cpp HEADERS += \ compositor_api/qwaylandquickcompositor.h \ compositor_api/qwaylandquicksurface.h \ + compositor_api/qwaylandquickoutput.h \ compositor_api/qwaylandsurfaceitem.h QT += qml quick diff --git a/src/compositor/compositor_api/qwaylandbufferref.cpp b/src/compositor/compositor_api/qwaylandbufferref.cpp index e77b14be2..abea24afb 100644 --- a/src/compositor/compositor_api/qwaylandbufferref.cpp +++ b/src/compositor/compositor_api/qwaylandbufferref.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ @@ -126,6 +118,11 @@ void QWaylandBufferRef::destroyTexture() d->buffer->destroyTexture(); } } + +void *QWaylandBufferRef::nativeBuffer() const +{ + return d->buffer->handle(); +} #endif QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandbufferref.h b/src/compositor/compositor_api/qwaylandbufferref.h index ded1f1d35..213474fab 100644 --- a/src/compositor/compositor_api/qwaylandbufferref.h +++ b/src/compositor/compositor_api/qwaylandbufferref.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ @@ -77,6 +69,7 @@ public: */ GLuint createTexture(); void destroyTexture(); + void *nativeBuffer() const; #endif private: diff --git a/src/compositor/compositor_api/qwaylandclient.cpp b/src/compositor/compositor_api/qwaylandclient.cpp new file mode 100644 index 000000000..216abc4f8 --- /dev/null +++ b/src/compositor/compositor_api/qwaylandclient.cpp @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Compositor. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** 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. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** 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$ +** +****************************************************************************/ + +#include <private/qobject_p.h> + +#include "wayland_wrapper/qwlcompositor_p.h" +#include "qwaylandcompositor.h" +#include "qwaylandclient.h" + +#include <wayland-server.h> +#include <wayland-util.h> + +QT_BEGIN_NAMESPACE + +class QWaylandClientPrivate : public QObjectPrivate +{ +public: + QWaylandClientPrivate(wl_client *_client) + : client(_client) + { + // Save client credentials + wl_client_get_credentials(client, &pid, &uid, &gid); + } + + ~QWaylandClientPrivate() + { + } + + static void client_destroy_callback(wl_listener *listener, void *data) + { + Q_UNUSED(data); + + QWaylandClient *client = reinterpret_cast<Listener *>(listener)->parent; + Q_ASSERT(client != 0); + QtWayland::Compositor::instance()->m_clients.removeOne(client); + delete client; + } + + wl_client *client; + + uid_t uid; + gid_t gid; + pid_t pid; + + struct Listener { + wl_listener listener; + QWaylandClient *parent; + }; + Listener listener; +}; + +QWaylandClient::QWaylandClient(wl_client *client) + : QObject(*new QWaylandClientPrivate(client)) +{ + Q_D(QWaylandClient); + + // Destroy wrapper when the client goes away + d->listener.parent = this; + d->listener.listener.notify = QWaylandClientPrivate::client_destroy_callback; + wl_client_add_destroy_listener(client, &d->listener.listener); +} + +QWaylandClient::~QWaylandClient() +{ + Q_D(QWaylandClient); + + // Remove listener from signal + wl_list_remove(&d->listener.listener.link); +} + +QWaylandClient *QWaylandClient::fromWlClient(wl_client *wlClient) +{ + if (!wlClient) + return 0; + + QWaylandClient *client = Q_NULLPTR; + + wl_listener *l = wl_client_get_destroy_listener(wlClient, + QWaylandClientPrivate::client_destroy_callback); + if (l) + client = reinterpret_cast<QWaylandClientPrivate::Listener *>( + wl_container_of(l, (QWaylandClientPrivate::Listener *)0, listener))->parent; + + if (!client) { + // The original idea was to create QWaylandClient instances when + // a client bound wl_compositor, but it's legal for a client to + // bind several times resulting in multiple QWaylandClient + // instances for the same wl_client therefore we create it from + // here on demand + client = new QWaylandClient(wlClient); + QtWayland::Compositor::instance()->m_clients.append(client); + } + + return client; +} + +wl_client *QWaylandClient::client() const +{ + Q_D(const QWaylandClient); + + return d->client; +} + +qint64 QWaylandClient::userId() const +{ + Q_D(const QWaylandClient); + + return d->uid; +} + +qint64 QWaylandClient::groupId() const +{ + Q_D(const QWaylandClient); + + return d->gid; +} + +qint64 QWaylandClient::processId() const +{ + Q_D(const QWaylandClient); + + return d->pid; +} + +void QWaylandClient::kill(int sig) +{ + Q_D(QWaylandClient); + + ::kill(d->pid, sig); +} + +void QWaylandClient::close() +{ + QtWayland::Compositor::instance()->waylandCompositor()->destroyClient(this); +} + +QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandclient.h b/src/compositor/compositor_api/qwaylandclient.h new file mode 100644 index 000000000..9199406b3 --- /dev/null +++ b/src/compositor/compositor_api/qwaylandclient.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Compositor. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** 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. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** 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$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENT_H +#define QWAYLANDCLIENT_H + +#include <QtCompositor/qwaylandexport.h> + +#include <QObject> + +#include <signal.h> + +struct wl_client; + +QT_BEGIN_NAMESPACE + +class QWaylandClientPrivate; + +class Q_COMPOSITOR_EXPORT QWaylandClient : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWaylandClient) + + Q_PROPERTY(qint64 userId READ userId CONSTANT) + Q_PROPERTY(qint64 groupId READ groupId CONSTANT) + Q_PROPERTY(qint64 processId READ processId CONSTANT) +public: + ~QWaylandClient(); + + static QWaylandClient *fromWlClient(wl_client *wlClient); + + wl_client *client() const; + + qint64 userId() const; + qint64 groupId() const; + + qint64 processId() const; + + Q_INVOKABLE void kill(int sig = SIGTERM); + +public Q_SLOTS: + void close(); + +private: + explicit QWaylandClient(wl_client *client); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDCLIENT_H diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 3248e4b1c..041f3e9eb 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -41,6 +41,7 @@ #include "qwaylandcompositor.h" #include "qwaylandinput.h" +#include "qwaylandoutput.h" #include "qwaylandglobalinterface.h" #include "qwaylandsurfaceview.h" @@ -55,22 +56,21 @@ #include <QtCore/QStringList> #include <QtGui/QDesktopServices> +#include <QtGui/QScreen> #include <QDebug> QT_BEGIN_NAMESPACE -QWaylandCompositor::QWaylandCompositor(QWindow *window, const char *socketName, ExtensionFlags extensions) +QWaylandCompositor::QWaylandCompositor(const char *socketName, ExtensionFlags extensions) : m_compositor(new QtWayland::Compositor(this, extensions)) - , m_toplevel_window(window) { m_compositor->m_socket_name = socketName; m_compositor->init(); } -QWaylandCompositor::QWaylandCompositor(QWindow *window, const char *socketName, QtWayland::Compositor *dptr) +QWaylandCompositor::QWaylandCompositor(const char *socketName, QtWayland::Compositor *dptr) : m_compositor(dptr) - , m_toplevel_window(window) { m_compositor->m_socket_name = socketName; m_compositor->init(); @@ -114,21 +114,19 @@ void QWaylandCompositor::destroyClientForSurface(QWaylandSurface *surface) destroyClient(surface->client()); } -void QWaylandCompositor::destroyClient(WaylandClient *client) +void QWaylandCompositor::destroyClient(QWaylandClient *client) { m_compositor->destroyClient(client); } -QList<QWaylandSurface *> QWaylandCompositor::surfacesForClient(WaylandClient* c) const +QList<QWaylandSurface *> QWaylandCompositor::surfacesForClient(QWaylandClient* client) const { - wl_client *client = static_cast<wl_client *>(c); - QList<QtWayland::Surface *> surfaces = m_compositor->surfaces(); QList<QWaylandSurface *> result; for (int i = 0; i < surfaces.count(); ++i) { - if (surfaces.at(i)->resource()->client() == client) { + if (surfaces.at(i)->waylandSurface()->client() == client) { result.append(surfaces.at(i)->waylandSurface()); } } @@ -145,9 +143,24 @@ QList<QWaylandSurface *> QWaylandCompositor::surfaces() const return surfs; } -QWindow * QWaylandCompositor::window() const +QList<QWaylandOutput *> QWaylandCompositor::outputs() const +{ + return m_compositor->outputs(); +} + +QWaylandOutput *QWaylandCompositor::output(QWindow *window) +{ + return m_compositor->output(window); +} + +QWaylandOutput *QWaylandCompositor::primaryOutput() const +{ + return m_compositor->primaryOutput(); +} + +void QWaylandCompositor::setPrimaryOutput(QWaylandOutput *output) { - return m_toplevel_window; + m_compositor->setPrimaryOutput(output); } void QWaylandCompositor::cleanupGraphicsResources() @@ -181,7 +194,7 @@ QPointF QWaylandCompositor::mapToView(QWaylandSurfaceView *surface, const QPoint The default implementation simply forwards the request to QDesktopServices::openUrl(). */ -bool QWaylandCompositor::openUrl(WaylandClient *client, const QUrl &url) +bool QWaylandCompositor::openUrl(QWaylandClient *client, const QUrl &url) { Q_UNUSED(client); return QDesktopServices::openUrl(url); @@ -223,33 +236,66 @@ const char *QWaylandCompositor::socketName() const return m_compositor->m_socket_name.constData(); } +#if QT_DEPRECATED_SINCE(5, 5) /*! Set the screen orientation based on accelerometer data or similar. */ void QWaylandCompositor::setScreenOrientation(Qt::ScreenOrientation orientation) { - m_compositor->setScreenOrientation(orientation); + QWaylandOutput *output = primaryOutput(); + if (output) { + bool isPortrait = output->window()->screen()->primaryOrientation() == Qt::PortraitOrientation; + + switch (orientation) { + case Qt::PrimaryOrientation: + output->setTransform(QWaylandOutput::TransformNormal); + break; + case Qt::LandscapeOrientation: + output->setTransform(isPortrait ? QWaylandOutput::Transform270 : QWaylandOutput::TransformNormal); + break; + case Qt::PortraitOrientation: + output->setTransform(isPortrait ? QWaylandOutput::TransformNormal : QWaylandOutput::Transform90); + break; + case Qt::InvertedLandscapeOrientation: + output->setTransform(isPortrait ? QWaylandOutput::Transform90 : QWaylandOutput::Transform180); + break; + case Qt::InvertedPortraitOrientation: + output->setTransform(isPortrait ? QWaylandOutput::Transform180 : QWaylandOutput::Transform270); + break; + } + } } void QWaylandCompositor::setOutputGeometry(const QRect &geometry) { - m_compositor->setOutputGeometry(geometry); + QWaylandOutput *output = primaryOutput(); + if (output) + output->setGeometry(geometry); } QRect QWaylandCompositor::outputGeometry() const { - return m_compositor->outputGeometry(); + QWaylandOutput *output = primaryOutput(); + if (output) + return output->geometry(); + return QRect(); } void QWaylandCompositor::setOutputRefreshRate(int rate) { - m_compositor->setOutputRefreshRate(rate); + QWaylandOutput *output = primaryOutput(); + if (output) + output->setMode({output->mode().size, rate}); } int QWaylandCompositor::outputRefreshRate() const { - return m_compositor->outputRefreshRate(); + QWaylandOutput *output = primaryOutput(); + if (output) + return output->mode().refreshRate; + return 0; } +#endif QWaylandInputDevice *QWaylandCompositor::defaultInputDevice() const { @@ -299,4 +345,16 @@ QWaylandSurfaceView *QWaylandCompositor::createView(QWaylandSurface *surface) return new QWaylandSurfaceView(surface); } +QWaylandInputDevice *QWaylandCompositor::inputDeviceFor(QInputEvent *inputEvent) +{ + return m_compositor->inputDeviceFor(inputEvent); +} + +QWaylandOutput *QWaylandCompositor::createOutput(QWindow *window, + const QString &manufacturer, + const QString &model) +{ + return new QWaylandOutput(this, window, manufacturer, model); +} + QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h index 740f2553d..fe48db06d 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.h +++ b/src/compositor/compositor_api/qwaylandcompositor.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -51,15 +51,19 @@ struct wl_display; QT_BEGIN_NAMESPACE +class QInputEvent; + class QMimeData; class QUrl; class QOpenGLContext; +class QWaylandClient; class QWaylandSurface; class QWaylandInputDevice; class QWaylandInputPanel; class QWaylandDrag; class QWaylandGlobalInterface; class QWaylandSurfaceView; +class QWaylandOutput; namespace QtWayland { @@ -83,7 +87,7 @@ public: }; Q_DECLARE_FLAGS(ExtensionFlags, ExtensionFlag) - QWaylandCompositor(QWindow *window = 0, const char *socketName = 0, ExtensionFlags extensions = DefaultExtensions); + QWaylandCompositor(const char *socketName = 0, ExtensionFlags extensions = DefaultExtensions); virtual ~QWaylandCompositor(); void addGlobalInterface(QWaylandGlobalInterface *interface); @@ -94,12 +98,16 @@ public: void sendFrameCallbacks(QList<QWaylandSurface *> visibleSurfaces); void destroyClientForSurface(QWaylandSurface *surface); - void destroyClient(WaylandClient *client); + void destroyClient(QWaylandClient *client); - QList<QWaylandSurface *> surfacesForClient(WaylandClient* client) const; + QList<QWaylandSurface *> surfacesForClient(QWaylandClient* client) const; QList<QWaylandSurface *> surfaces() const; - QWindow *window()const; + QList<QWaylandOutput *> outputs() const; + QWaylandOutput *output(QWindow *window); + + QWaylandOutput *primaryOutput() const; + void setPrimaryOutput(QWaylandOutput *output); virtual void surfaceCreated(QWaylandSurface *surface) = 0; virtual void surfaceAboutToBeDestroyed(QWaylandSurface *surface); @@ -107,7 +115,7 @@ public: virtual QWaylandSurfaceView *pickView(const QPointF &globalPosition) const; virtual QPointF mapToView(QWaylandSurfaceView *view, const QPointF &surfacePosition) const; - virtual bool openUrl(WaylandClient *client, const QUrl &url); + virtual bool openUrl(QWaylandClient *client, const QUrl &url); QtWayland::Compositor *handle() const; @@ -119,6 +127,7 @@ public: const char *socketName() const; +#if QT_DEPRECATED_SINCE(5, 5) void setScreenOrientation(Qt::ScreenOrientation orientation); void setOutputGeometry(const QRect &outputGeometry); @@ -126,6 +135,7 @@ public: void setOutputRefreshRate(int refreshRate); int outputRefreshRate() const; +#endif QWaylandInputDevice *defaultInputDevice() const; @@ -148,15 +158,18 @@ public: virtual QWaylandSurfaceView *createView(QWaylandSurface *surface); + QWaylandInputDevice *inputDeviceFor(QInputEvent *inputEvent); + protected: - QWaylandCompositor(QWindow *window, const char *socketName, QtWayland::Compositor *dptr); + QWaylandCompositor(const char *socketName, QtWayland::Compositor *dptr); virtual void retainedSelectionReceived(QMimeData *mimeData); + virtual QWaylandOutput *createOutput(QWindow *window, + const QString &manufacturer, + const QString &model); + friend class QtWayland::Compositor; QtWayland::Compositor *m_compositor; - -private: - QWindow *m_toplevel_window; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandCompositor::ExtensionFlags) diff --git a/src/compositor/compositor_api/qwaylanddrag.cpp b/src/compositor/compositor_api/qwaylanddrag.cpp index 8916b0d71..b31df31b8 100644 --- a/src/compositor/compositor_api/qwaylanddrag.cpp +++ b/src/compositor/compositor_api/qwaylanddrag.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/compositor_api/qwaylanddrag.h b/src/compositor/compositor_api/qwaylanddrag.h index 329391bd8..c0b0aca36 100644 --- a/src/compositor/compositor_api/qwaylanddrag.h +++ b/src/compositor/compositor_api/qwaylanddrag.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/compositor_api/qwaylandglobalinterface.cpp b/src/compositor/compositor_api/qwaylandglobalinterface.cpp index 2de318862..791964863 100644 --- a/src/compositor/compositor_api/qwaylandglobalinterface.cpp +++ b/src/compositor/compositor_api/qwaylandglobalinterface.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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 +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/compositor_api/qwaylandglobalinterface.h b/src/compositor/compositor_api/qwaylandglobalinterface.h index a31ae7e57..6be3236fa 100644 --- a/src/compositor/compositor_api/qwaylandglobalinterface.h +++ b/src/compositor/compositor_api/qwaylandglobalinterface.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/compositor_api/qwaylandinput.cpp b/src/compositor/compositor_api/qwaylandinput.cpp index 97bbb23b3..4e106f5fe 100644 --- a/src/compositor/compositor_api/qwaylandinput.cpp +++ b/src/compositor/compositor_api/qwaylandinput.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -183,4 +183,10 @@ QWaylandInputDevice::CapabilityFlags QWaylandInputDevice::capabilities() return d->capabilities(); } +bool QWaylandInputDevice::isOwner(QInputEvent *inputEvent) +{ + Q_UNUSED(inputEvent); + return true; +} + QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandinput.h b/src/compositor/compositor_api/qwaylandinput.h index 2c0b9ee7c..ba28bbd67 100644 --- a/src/compositor/compositor_api/qwaylandinput.h +++ b/src/compositor/compositor_api/qwaylandinput.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -54,6 +54,7 @@ class QWaylandSurface; class QKeyEvent; class QTouchEvent; class QWaylandSurfaceView; +class QInputEvent; namespace QtWayland { class InputDevice; @@ -93,7 +94,7 @@ public: Q_DECLARE_FLAGS(CapabilityFlags, CapabilityFlag) QWaylandInputDevice(QWaylandCompositor *compositor, CapabilityFlags caps = DefaultCapabilities); - ~QWaylandInputDevice(); + virtual ~QWaylandInputDevice(); void sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF()); void sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF()); @@ -125,6 +126,8 @@ public: QWaylandInputDevice::CapabilityFlags capabilities(); + virtual bool isOwner(QInputEvent *inputEvent); + private: QtWayland::InputDevice *d; Q_DISABLE_COPY(QWaylandInputDevice) diff --git a/src/compositor/compositor_api/qwaylandinputpanel.cpp b/src/compositor/compositor_api/qwaylandinputpanel.cpp index 03084262c..db4cd3296 100644 --- a/src/compositor/compositor_api/qwaylandinputpanel.cpp +++ b/src/compositor/compositor_api/qwaylandinputpanel.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/compositor_api/qwaylandinputpanel.h b/src/compositor/compositor_api/qwaylandinputpanel.h index 735756ba1..22dc8b9f4 100644 --- a/src/compositor/compositor_api/qwaylandinputpanel.h +++ b/src/compositor/compositor_api/qwaylandinputpanel.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp new file mode 100644 index 000000000..8f6c5e2cc --- /dev/null +++ b/src/compositor/compositor_api/qwaylandoutput.cpp @@ -0,0 +1,246 @@ +/**************************************************************************** +** +** Copyright (C) 2014-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Compositor. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** 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. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** 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$ +** +****************************************************************************/ + +#include <QtCore/QCoreApplication> +#include <QtCore/QtMath> +#include <QtGui/QWindow> +#include <QtGui/QExposeEvent> +#include <private/qobject_p.h> + +#include "wayland_wrapper/qwlcompositor_p.h" +#include "wayland_wrapper/qwloutput_p.h" +#include "qwaylandcompositor.h" +#include "qwaylandoutput.h" + +QWaylandOutput::QWaylandOutput(QWaylandCompositor *compositor, QWindow *window, + const QString &manufacturer, const QString &model) + : QObject() + , d_ptr(new QtWayland::Output(compositor->handle(), window)) +{ + d_ptr->m_output = this; + d_ptr->setManufacturer(manufacturer); + d_ptr->setModel(model); + d_ptr->compositor()->addOutput(this); +} + +QWaylandOutput::~QWaylandOutput() +{ + d_ptr->compositor()->removeOutput(this); + delete d_ptr; +} + +QWaylandOutput *QWaylandOutput::fromResource(wl_resource *resource) +{ + QtWayland::OutputResource *outputResource = static_cast<QtWayland::OutputResource *>( + QtWayland::Output::Resource::fromResource(resource)); + if (!outputResource) + return Q_NULLPTR; + + QtWayland::Output *output = static_cast<QtWayland::Output *>(outputResource->output_object); + if (!output) + return Q_NULLPTR; + + return output->output(); +} + +void QWaylandOutput::update() +{ + QRect rect(QPoint(0, 0), window()->size()); + QRegion region(rect); + QExposeEvent *event = new QExposeEvent(region); + QCoreApplication::postEvent(window(), event); +} + +QWaylandCompositor *QWaylandOutput::compositor() const +{ + return d_ptr->compositor()->waylandCompositor(); +} + +QString QWaylandOutput::manufacturer() const +{ + return d_ptr->manufacturer(); +} + +QString QWaylandOutput::model() const +{ + return d_ptr->model(); +} + +QPoint QWaylandOutput::position() const +{ + return d_ptr->position(); +} + +void QWaylandOutput::setPosition(const QPoint &pt) +{ + if (d_ptr->position() == pt) + return; + + d_ptr->setPosition(pt); + Q_EMIT positionChanged(); + Q_EMIT geometryChanged(); +} + +QWaylandOutput::Mode QWaylandOutput::mode() const +{ + return d_ptr->mode(); +} + +void QWaylandOutput::setMode(const Mode &mode) +{ + if (d_ptr->mode().size == mode.size && d_ptr->mode().refreshRate == mode.refreshRate) + return; + + d_ptr->setMode(mode); + Q_EMIT modeChanged(); + Q_EMIT geometryChanged(); + + if (window()) { + window()->resize(mode.size); + window()->setMinimumSize(mode.size); + window()->setMaximumSize(mode.size); + } +} + +QRect QWaylandOutput::geometry() const +{ + return d_ptr->geometry(); +} + +void QWaylandOutput::setGeometry(const QRect &geometry) +{ + if (d_ptr->geometry() == geometry) + return; + + d_ptr->setGeometry(geometry); + Q_EMIT positionChanged(); + Q_EMIT modeChanged(); + + if (window()) { + window()->resize(geometry.size()); + window()->setMinimumSize(geometry.size()); + window()->setMaximumSize(geometry.size()); + } +} + +QRect QWaylandOutput::availableGeometry() const +{ + if (!d_ptr->availableGeometry().isValid()) + return QRect(d_ptr->position(), d_ptr->mode().size); + + return d_ptr->availableGeometry(); +} + +void QWaylandOutput::setAvailableGeometry(const QRect &availableGeometry) +{ + if (d_ptr->availableGeometry() == availableGeometry) + return; + + d_ptr->setAvailableGeometry(availableGeometry); + Q_EMIT availableGeometryChanged(); +} + +QSize QWaylandOutput::physicalSize() const +{ + return d_ptr->physicalSize(); +} + +void QWaylandOutput::setPhysicalSize(const QSize &size) +{ + if (d_ptr->physicalSize() == size) + return; + + d_ptr->setPhysicalSize(size); + Q_EMIT physicalSizeChanged(); +} + +QWaylandOutput::Subpixel QWaylandOutput::subpixel() const +{ + return d_ptr->subpixel(); +} + +void QWaylandOutput::setSubpixel(const Subpixel &subpixel) +{ + if (d_ptr->subpixel() == subpixel) + return; + + d_ptr->setSubpixel(subpixel); + Q_EMIT subpixelChanged(); +} + +QWaylandOutput::Transform QWaylandOutput::transform() const +{ + return d_ptr->transform(); +} + +void QWaylandOutput::setTransform(const Transform &transform) +{ + if (d_ptr->transform() == transform) + return; + + d_ptr->setTransform(transform); + Q_EMIT transformChanged(); +} + +int QWaylandOutput::scaleFactor() const +{ + return d_ptr->scaleFactor(); +} + +void QWaylandOutput::setScaleFactor(int scale) +{ + if (d_ptr->scaleFactor() == scale) + return; + + d_ptr->setScaleFactor(scale); + Q_EMIT scaleFactorChanged(); + +} + +QWindow *QWaylandOutput::window() const +{ + return d_ptr->window(); +} + +QtWayland::Output *QWaylandOutput::handle() +{ + return d_ptr; +} diff --git a/src/compositor/compositor_api/qwaylandoutput.h b/src/compositor/compositor_api/qwaylandoutput.h new file mode 100644 index 000000000..9efbd9598 --- /dev/null +++ b/src/compositor/compositor_api/qwaylandoutput.h @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2014-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Compositor. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** 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. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** 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$ +** +****************************************************************************/ + +#ifndef QWAYLANDOUTPUT_H +#define QWAYLANDOUTPUT_H + +#include <QtCompositor/qwaylandexport.h> + +#include <QObject> +#include <QRect> +#include <QSize> + +QT_BEGIN_NAMESPACE + +struct wl_resource; + +class QWaylandCompositor; +class QWindow; + +namespace QtWayland { + class Output; +} + +class Q_COMPOSITOR_EXPORT QWaylandOutput : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT) + Q_PROPERTY(QString model READ model CONSTANT) + Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged) + Q_PROPERTY(QWaylandOutput::Mode mode READ mode WRITE setMode NOTIFY modeChanged) + Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged) + Q_PROPERTY(QRect availableGeometry READ availableGeometry WRITE setAvailableGeometry NOTIFY availableGeometryChanged) + Q_PROPERTY(QSize physicalSize READ physicalSize WRITE setPhysicalSize NOTIFY physicalSizeChanged) + Q_PROPERTY(QWaylandOutput::Subpixel subpixel READ subpixel WRITE setSubpixel NOTIFY subpixelChanged) + Q_PROPERTY(QWaylandOutput::Transform transform READ transform WRITE setTransform NOTIFY transformChanged) + Q_PROPERTY(int scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged) + Q_PROPERTY(QWindow *window READ window CONSTANT) + Q_ENUMS(Subpixel Transform) +public: + enum Subpixel { + SubpixelUnknown = 0, + SubpixelNone, + SubpixelHorizontalRgb, + SubpixelHorizontalBgr, + SubpixelVerticalRgb, + SubpixelVerticalBgr + }; + + enum Transform { + TransformNormal = 0, + Transform90, + Transform180, + Transform270, + TransformFlipped, + TransformFlipped90, + TransformFlipped180, + TransformFlipped270 + }; + + struct Mode + { + QSize size; + int refreshRate; + }; + + QWaylandOutput(QWaylandCompositor *compositor, QWindow *window, + const QString &manufacturer, const QString &model); + ~QWaylandOutput(); + + static QWaylandOutput *fromResource(wl_resource *resource); + + virtual void update(); + + QWaylandCompositor *compositor() const; + + QString manufacturer() const; + + QString model() const; + + QPoint position() const; + void setPosition(const QPoint &pt); + + Mode mode() const; + void setMode(const Mode &mode); + + QRect geometry() const; + void setGeometry(const QRect &geometry); + + QRect availableGeometry() const; + void setAvailableGeometry(const QRect &availableGeometry); + + QSize physicalSize() const; + void setPhysicalSize(const QSize &size); + + Subpixel subpixel() const; + void setSubpixel(const Subpixel &subpixel); + + Transform transform() const; + void setTransform(const Transform &transform); + + int scaleFactor() const; + void setScaleFactor(int scale); + + QWindow *window() const; + + QtWayland::Output *handle(); + +Q_SIGNALS: + void positionChanged(); + void geometryChanged(); + void modeChanged(); + void availableGeometryChanged(); + void physicalSizeChanged(); + void scaleFactorChanged(); + void subpixelChanged(); + void transformChanged(); + +private: + QtWayland::Output *const d_ptr; +}; + +Q_DECLARE_METATYPE(QWaylandOutput::Mode) + +QT_END_NAMESPACE + +#endif // QWAYLANDOUTPUT_H diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp index ae472f219..36ee8e760 100644 --- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp @@ -1,51 +1,43 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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 <QQuickWindow> - #include <QtCompositor/private/qwlcompositor_p.h> +#include "qwaylandclient.h" #include "qwaylandquickcompositor.h" #include "qwaylandquicksurface.h" #include "qwaylandsurfaceitem.h" +#include "qwaylandquickoutput.h" QT_BEGIN_NAMESPACE @@ -77,31 +69,29 @@ public: }; -QWaylandQuickCompositor::QWaylandQuickCompositor(QQuickWindow *window, const char *socketName, ExtensionFlags extensions) - : QWaylandCompositor(window, socketName, new QWaylandQuickCompositorPrivate(this, extensions)) +QWaylandQuickCompositor::QWaylandQuickCompositor(const char *socketName, ExtensionFlags extensions) + : QWaylandCompositor(socketName, new QWaylandQuickCompositorPrivate(this, extensions)) { - window->connect(window, &QQuickWindow::beforeSynchronizing, d_ptr(), &QWaylandQuickCompositorPrivate::updateStarted, Qt::DirectConnection); - qmlRegisterUncreatableType<QWaylandSurfaceItem>("QtCompositor", 1, 0, "WaylandSurfaceItem", QObject::tr("Cannot create instance of WaylandSurfaceItem")); qmlRegisterUncreatableType<QWaylandQuickSurface>("QtCompositor", 1, 0, "WaylandQuickSurface", QObject::tr("Cannot create instance of WaylandQuickSurface")); + qmlRegisterUncreatableType<QWaylandClient>("QtCompositor", 1, 0, "WaylandClient", QObject::tr("Cannot create instance of WaylandClient")); + qmlRegisterUncreatableType<QWaylandOutput>("QtCompositor", 1, 0, "WaylandOutput", QObject::tr("Cannot create instance of WaylandOutput")); } -QWaylandQuickCompositorPrivate *QWaylandQuickCompositor::d_ptr() -{ - return static_cast<QWaylandQuickCompositorPrivate *>(m_compositor); -} - -void QWaylandQuickCompositor::update() +QWaylandSurfaceView *QWaylandQuickCompositor::createView(QWaylandSurface *surf) { - if (!d_ptr()->updateScheduled) { - static_cast<QQuickWindow *>(window())->update(); - d_ptr()->updateScheduled = true; - } + return new QWaylandSurfaceItem(static_cast<QWaylandQuickSurface *>(surf)); } -QWaylandSurfaceView *QWaylandQuickCompositor::createView(QWaylandSurface *surf) +QWaylandOutput *QWaylandQuickCompositor::createOutput(QWindow *window, + const QString &manufacturer, + const QString &model) { - return new QWaylandSurfaceItem(static_cast<QWaylandQuickSurface *>(surf)); + QQuickWindow *quickWindow = qobject_cast<QQuickWindow *>(window); + if (!quickWindow) + qFatal("%s: couldn't cast QWindow to QQuickWindow. All output windows must " + "be QQuickWindow derivates when using QWaylandQuickCompositor", Q_FUNC_INFO); + return new QWaylandQuickOutput(this, quickWindow, manufacturer, model); } QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.h b/src/compositor/compositor_api/qwaylandquickcompositor.h index 0e252ba0f..e54018901 100644 --- a/src/compositor/compositor_api/qwaylandquickcompositor.h +++ b/src/compositor/compositor_api/qwaylandquickcompositor.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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 +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ @@ -49,19 +41,17 @@ QT_BEGIN_NAMESPACE class QQuickWindow; class QWaylandQuickCompositorPrivate; class QWaylandSurfaceView; +class QWaylandOutput; class Q_COMPOSITOR_EXPORT QWaylandQuickCompositor : public QWaylandCompositor { public: - QWaylandQuickCompositor(QQuickWindow *window = 0, const char *socketName = 0, QWaylandCompositor::ExtensionFlags extensions = DefaultExtensions); - - void update(); + QWaylandQuickCompositor(const char *socketName = 0, QWaylandCompositor::ExtensionFlags extensions = DefaultExtensions); QWaylandSurfaceView *createView(QWaylandSurface *surf) Q_DECL_OVERRIDE; - -private: - friend class QWaylandQuickCompositorPrivate; - QWaylandQuickCompositorPrivate *d_ptr(); + QWaylandOutput *createOutput(QWindow *window, + const QString &manufacturer, + const QString &model) Q_DECL_OVERRIDE; }; QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandquickoutput.cpp b/src/compositor/compositor_api/qwaylandquickoutput.cpp new file mode 100644 index 000000000..9199ff84a --- /dev/null +++ b/src/compositor/compositor_api/qwaylandquickoutput.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandquickoutput.h" +#include "qwaylandquickcompositor.h" + +QT_BEGIN_NAMESPACE + +QWaylandQuickOutput::QWaylandQuickOutput(QWaylandCompositor *compositor, QQuickWindow *window, + const QString &manufacturer, const QString &model) + : QWaylandOutput(compositor, window, manufacturer, model) + , m_updateScheduled(false) +{ + connect(window, &QQuickWindow::beforeSynchronizing, + this, &QWaylandQuickOutput::updateStarted, + Qt::DirectConnection); +} + +QQuickWindow *QWaylandQuickOutput::quickWindow() const +{ + return static_cast<QQuickWindow *>(window()); +} + +void QWaylandQuickOutput::update() +{ + if (!m_updateScheduled) { + quickWindow()->update(); + m_updateScheduled = true; + } +} + +void QWaylandQuickOutput::updateStarted() +{ + m_updateScheduled = false; + compositor()->frameStarted(); + compositor()->cleanupGraphicsResources(); +} + +QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandquickoutput.h b/src/compositor/compositor_api/qwaylandquickoutput.h new file mode 100644 index 000000000..702867104 --- /dev/null +++ b/src/compositor/compositor_api/qwaylandquickoutput.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDQUICKOUTPUT_H +#define QWAYLANDQUICKOUTPUT_H + +#include <QtQuick/QQuickWindow> +#include <QtCompositor/qwaylandoutput.h> + +QT_BEGIN_NAMESPACE + +class QWaylandQuickCompositor; +class QQuickWindow; + +class Q_COMPOSITOR_EXPORT QWaylandQuickOutput : public QWaylandOutput +{ + Q_OBJECT +public: + QWaylandQuickOutput(QWaylandCompositor *compositor, QQuickWindow *window, + const QString &manufacturer, const QString &model); + + QQuickWindow *quickWindow() const; + + void update() Q_DECL_OVERRIDE; + +public Q_SLOTS: + void updateStarted(); + +private: + bool m_updateScheduled; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/compositor/compositor_api/qwaylandquicksurface.cpp b/src/compositor/compositor_api/qwaylandquicksurface.cpp index 40cd8b749..91237b879 100644 --- a/src/compositor/compositor_api/qwaylandquicksurface.cpp +++ b/src/compositor/compositor_api/qwaylandquicksurface.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ @@ -48,6 +40,7 @@ #include "qwaylandquicksurface.h" #include "qwaylandquickcompositor.h" #include "qwaylandsurfaceitem.h" +#include "qwaylandoutput.h" #include <QtCompositor/qwaylandbufferref.h> #include <QtCompositor/private/qwaylandsurface_p.h> @@ -84,7 +77,7 @@ public: bufferRef.destroyTexture(); bufferRef = nextBuffer; - QQuickWindow *window = static_cast<QQuickWindow *>(surface->compositor()->window()); + QQuickWindow *window = static_cast<QQuickWindow *>(surface->output()->window()); // If the next buffer is NULL do not delete the current texture. If the client called // attach(0) the surface is going to be unmapped anyway, if instead the client attached // a valid buffer but died before we got here we want to keep the old buffer around @@ -149,7 +142,7 @@ public: } QWaylandSurfacePrivate::surface_commit(resource); - compositor->update(); + output()->waylandOutput()->update(); } BufferAttacher *buffer; @@ -166,7 +159,7 @@ QWaylandQuickSurface::QWaylandQuickSurface(wl_client *client, quint32 id, int ve d->buffer->surface = this; setBufferAttacher(d->buffer); - QQuickWindow *window = static_cast<QQuickWindow *>(compositor->window()); + QQuickWindow *window = static_cast<QQuickWindow *>(output()->window()); connect(window, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickSurface::updateTexture, Qt::DirectConnection); connect(window, &QQuickWindow::sceneGraphInvalidated, this, &QWaylandQuickSurface::invalidateTexture, Qt::DirectConnection); connect(this, &QWaylandSurface::windowPropertyChanged, d->windowPropertyMap, &QQmlPropertyMap::insert); diff --git a/src/compositor/compositor_api/qwaylandquicksurface.h b/src/compositor/compositor_api/qwaylandquicksurface.h index d65a98273..1c7eea6c9 100644 --- a/src/compositor/compositor_api/qwaylandquicksurface.h +++ b/src/compositor/compositor_api/qwaylandquicksurface.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index 54b38109f..cbfe92055 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -1,7 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -52,6 +53,7 @@ #include "wayland_wrapper/qwldatadevicemanager_p.h" #include "qwaylandcompositor.h" +#include "qwaylandclient.h" #include "qwaylandsurface_p.h" #include "qwaylandbufferref.h" #include "qwaylandsurfaceinterface.h" @@ -61,10 +63,11 @@ QT_BEGIN_NAMESPACE -QWaylandSurfacePrivate::QWaylandSurfacePrivate(wl_client *client, quint32 id, int version, QWaylandCompositor *compositor, QWaylandSurface *surface) - : QtWayland::Surface(client, id, version, compositor, surface) +QWaylandSurfacePrivate::QWaylandSurfacePrivate(wl_client *wlClient, quint32 id, int version, QWaylandCompositor *compositor, QWaylandSurface *surface) + : QtWayland::Surface(wlClient, id, version, compositor, surface) , closing(false) , refCount(1) + , client(QWaylandClient::fromWlClient(wlClient)) , windowType(QWaylandSurface::WindowType::None) {} @@ -89,12 +92,12 @@ QWaylandSurface::~QWaylandSurface() delete d->m_attacher; } -WaylandClient *QWaylandSurface::client() const +QWaylandClient *QWaylandSurface::client() const { Q_D(const QWaylandSurface); - if (d->isDestroyed()) + if (d->isDestroyed() || !d->compositor()->clients().contains(d->client)) return Q_NULLPTR; - return d->resource()->client(); + return d->client; } QWaylandSurface *QWaylandSurface::parentSurface() const @@ -212,18 +215,6 @@ QtWayland::Surface * QWaylandSurface::handle() return d; } -qint64 QWaylandSurface::processId() const -{ - Q_D(const QWaylandSurface); - if (d->isDestroyed()) - return -1; - - struct wl_client *client = static_cast<struct wl_client *>(this->client()); - pid_t pid; - wl_client_get_credentials(client,&pid, 0,0); - return pid; -} - QVariantMap QWaylandSurface::windowProperties() const { Q_D(const QWaylandSurface); @@ -248,6 +239,14 @@ QWaylandCompositor *QWaylandSurface::compositor() const return d->compositor()->waylandCompositor(); } +QWaylandOutput *QWaylandSurface::output() const +{ + Q_D(const QWaylandSurface); + if (!d->output()) + return Q_NULLPTR; + return d->output()->waylandOutput(); +} + QWindow::Visibility QWaylandSurface::visibility() const { Q_D(const QWaylandSurface); @@ -321,6 +320,12 @@ bool QWaylandSurface::transientInactive() const return d->transientInactive(); } +bool QWaylandSurface::inputRegionContains(const QPoint &p) const +{ + Q_D(const QWaylandSurface); + return d->inputRegion().contains(p); +} + void QWaylandSurface::destroy() { Q_D(QWaylandSurface); diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h index 7c7ec4d76..e16bdb40a 100644 --- a/src/compositor/compositor_api/qwaylandsurface.h +++ b/src/compositor/compositor_api/qwaylandsurface.h @@ -1,7 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -54,12 +55,14 @@ struct wl_resource; QT_BEGIN_NAMESPACE class QTouchEvent; +class QWaylandClient; class QWaylandSurfacePrivate; class QWaylandCompositor; class QWaylandBufferRef; class QWaylandSurfaceView; class QWaylandSurfaceInterface; class QWaylandSurfaceOp; +class QWaylandOutput; namespace QtWayland { class Surface; @@ -82,6 +85,7 @@ class Q_COMPOSITOR_EXPORT QWaylandSurface : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandSurface) + Q_PROPERTY(QWaylandClient *client READ client CONSTANT) Q_PROPERTY(QSize size READ size NOTIFY sizeChanged) Q_PROPERTY(QWaylandSurface::WindowFlags windowFlags READ windowFlags NOTIFY windowFlagsChanged) Q_PROPERTY(QWaylandSurface::WindowType windowType READ windowType NOTIFY windowTypeChanged) @@ -120,7 +124,7 @@ public: QWaylandSurface(wl_client *client, quint32 id, int version, QWaylandCompositor *compositor); virtual ~QWaylandSurface(); - WaylandClient *client() const; + QWaylandClient *client() const; QWaylandSurface *parentSurface() const; QLinkedList<QWaylandSurface *> subSurfaces() const; @@ -153,13 +157,14 @@ public: QtWayland::Surface *handle(); - qint64 processId() const; QByteArray authenticationToken() const; QVariantMap windowProperties() const; void setWindowProperty(const QString &name, const QVariant &value); QWaylandCompositor *compositor() const; + QWaylandOutput *output() const; + QString className() const; QString title() const; @@ -168,6 +173,8 @@ public: bool transientInactive() const; + bool inputRegionContains(const QPoint &p) const; + Q_INVOKABLE void destroy(); Q_INVOKABLE void destroySurface(); Q_INVOKABLE void ping(); diff --git a/src/compositor/compositor_api/qwaylandsurface_p.h b/src/compositor/compositor_api/qwaylandsurface_p.h index 5e2188883..4444df7a9 100644 --- a/src/compositor/compositor_api/qwaylandsurface_p.h +++ b/src/compositor/compositor_api/qwaylandsurface_p.h @@ -1,40 +1,33 @@ /**************************************************************************** ** +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ @@ -58,13 +51,16 @@ class Q_COMPOSITOR_EXPORT QWaylandSurfacePrivate : public QObjectPrivate, public { Q_DECLARE_PUBLIC(QWaylandSurface) public: - QWaylandSurfacePrivate(wl_client *client, quint32 id, int version, QWaylandCompositor *compositor, QWaylandSurface *surface); + QWaylandSurfacePrivate(wl_client *wlClient, quint32 id, int version, QWaylandCompositor *compositor, QWaylandSurface *surface); void setType(QWaylandSurface::WindowType type); void setTitle(const QString &title); void setClassName(const QString &className); bool closing; int refCount; + + QWaylandClient *client; + QWaylandSurface::WindowType windowType; QList<QWaylandSurfaceView *> views; QList<QWaylandSurfaceInterface *> interfaces; diff --git a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp b/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp index e60977ae9..9fc7fd6ab 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/compositor_api/qwaylandsurfaceinterface.h b/src/compositor/compositor_api/qwaylandsurfaceinterface.h index 39902cc31..60d8ae5fa 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceinterface.h +++ b/src/compositor/compositor_api/qwaylandsurfaceinterface.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp index 35e0cd285..06ea3ad48 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -144,7 +144,12 @@ void QWaylandSurfaceItem::mousePressEvent(QMouseEvent *event) if (!surface()) return; - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + if (!surface()->inputRegionContains(event->pos())) { + event->ignore(); + return; + } + + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); if (inputDevice->mouseFocus() != this) inputDevice->setMouseFocus(this, event->localPos(), event->windowPos()); inputDevice->sendMousePressEvent(event->button(), event->localPos(), event->windowPos()); @@ -153,7 +158,7 @@ void QWaylandSurfaceItem::mousePressEvent(QMouseEvent *event) void QWaylandSurfaceItem::mouseMoveEvent(QMouseEvent *event) { if (surface()) { - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); inputDevice->sendMouseMoveEvent(this, event->localPos(), event->windowPos()); } } @@ -161,7 +166,7 @@ void QWaylandSurfaceItem::mouseMoveEvent(QMouseEvent *event) void QWaylandSurfaceItem::mouseReleaseEvent(QMouseEvent *event) { if (surface()) { - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); inputDevice->sendMouseReleaseEvent(event->button(), event->localPos(), event->windowPos()); } } @@ -169,7 +174,7 @@ void QWaylandSurfaceItem::mouseReleaseEvent(QMouseEvent *event) void QWaylandSurfaceItem::hoverEnterEvent(QHoverEvent *event) { if (surface()) { - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); inputDevice->sendMouseMoveEvent(this, event->pos()); } } @@ -177,7 +182,7 @@ void QWaylandSurfaceItem::hoverEnterEvent(QHoverEvent *event) void QWaylandSurfaceItem::hoverMoveEvent(QHoverEvent *event) { if (surface()) { - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); inputDevice->sendMouseMoveEvent(this, event->pos()); } } @@ -185,7 +190,7 @@ void QWaylandSurfaceItem::hoverMoveEvent(QHoverEvent *event) void QWaylandSurfaceItem::hoverLeaveEvent(QHoverEvent *event) { if (surface()) { - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); inputDevice->sendMouseMoveEvent(this, event->pos()); } } @@ -193,7 +198,12 @@ void QWaylandSurfaceItem::hoverLeaveEvent(QHoverEvent *event) void QWaylandSurfaceItem::wheelEvent(QWheelEvent *event) { if (surface()) { - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + if (!surface()->inputRegionContains(event->pos())) { + event->ignore(); + return; + } + + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); inputDevice->sendMouseWheelEvent(event->orientation(), event->delta()); } } @@ -201,7 +211,7 @@ void QWaylandSurfaceItem::wheelEvent(QWheelEvent *event) void QWaylandSurfaceItem::keyPressEvent(QKeyEvent *event) { if (surface()) { - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); inputDevice->sendFullKeyEvent(event); } } @@ -209,7 +219,7 @@ void QWaylandSurfaceItem::keyPressEvent(QKeyEvent *event) void QWaylandSurfaceItem::keyReleaseEvent(QKeyEvent *event) { if (surface() && hasFocus()) { - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); inputDevice->sendFullKeyEvent(event); } } @@ -217,19 +227,26 @@ void QWaylandSurfaceItem::keyReleaseEvent(QKeyEvent *event) void QWaylandSurfaceItem::touchEvent(QTouchEvent *event) { if (m_touchEventsEnabled) { + QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); + if (event->type() == QEvent::TouchBegin) { QQuickItem *grabber = window()->mouseGrabberItem(); if (grabber != this) grabMouse(); } - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); + QPoint pointPos; + const QList<QTouchEvent::TouchPoint> &points = event->touchPoints(); + if (!points.isEmpty()) + pointPos = points.at(0).pos().toPoint(); + + if (event->type() == QEvent::TouchBegin && !surface()->inputRegionContains(pointPos)) { + event->ignore(); + return; + } + event->accept(); if (inputDevice->mouseFocus() != this) { - QPoint pointPos; - QList<QTouchEvent::TouchPoint> points = event->touchPoints(); - if (!points.isEmpty()) - pointPos = points.at(0).pos().toPoint(); inputDevice->setMouseFocus(this, pointPos, pointPos); } inputDevice->sendFullTouchEvent(event); @@ -246,15 +263,18 @@ void QWaylandSurfaceItem::mouseUngrabEvent() } } -void QWaylandSurfaceItem::takeFocus() +void QWaylandSurfaceItem::takeFocus(QWaylandInputDevice *device) { setFocus(true); if (!surface()) return; - QWaylandInputDevice *inputDevice = compositor()->defaultInputDevice(); - inputDevice->setKeyboardFocus(surface()); + QWaylandInputDevice *target = device; + if (!target) { + target = compositor()->defaultInputDevice(); + } + target->setKeyboardFocus(surface()); } void QWaylandSurfaceItem::surfaceMapped() diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.h b/src/compositor/compositor_api/qwaylandsurfaceitem.h index 2805db52a..7a4054227 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.h +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE class QWaylandSurfaceTextureProvider; class QMutex; +class QWaylandInputDevice; class Q_COMPOSITOR_EXPORT QWaylandSurfaceItem : public QQuickItem, public QWaylandSurfaceView { @@ -103,7 +104,7 @@ protected: void mouseUngrabEvent() Q_DECL_OVERRIDE; public slots: - void takeFocus(); + virtual void takeFocus(QWaylandInputDevice *device = 0); void setPaintEnabled(bool paintEnabled); private slots: diff --git a/src/compositor/compositor_api/qwaylandsurfaceview.cpp b/src/compositor/compositor_api/qwaylandsurfaceview.cpp index 664ab9805..57e3501f2 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceview.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceview.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/compositor_api/qwaylandsurfaceview.h b/src/compositor/compositor_api/qwaylandsurfaceview.h index 6b45b6954..2da19c264 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceview.h +++ b/src/compositor/compositor_api/qwaylandsurfaceview.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/global/qwaylandexport.h b/src/compositor/global/qwaylandexport.h index 45ddc159d..579794afa 100644 --- a/src/compositor/global/qwaylandexport.h +++ b/src/compositor/global/qwaylandexport.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE # endif #endif -typedef void WaylandClient; - QT_END_NAMESPACE #endif //WAYLANDEXPORT_H diff --git a/src/compositor/hardware_integration/qwlclientbufferintegration.cpp b/src/compositor/hardware_integration/qwlclientbufferintegration.cpp index ee3bdeb84..36591a9dd 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegration.cpp +++ b/src/compositor/hardware_integration/qwlclientbufferintegration.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h index b660f600c..15712ea1e 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h +++ b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp index 489e2594d..f56b2ec23 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp +++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h index ccefba426..1ee972789 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h +++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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 +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp index 1f3f2d116..db22d8085 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp +++ b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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 +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h index 3ff26cd92..adb7440fc 100644 --- a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h +++ b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/hardware_integration/qwlhwintegration.cpp b/src/compositor/hardware_integration/qwlhwintegration.cpp index e71bb652b..d02e72371 100644 --- a/src/compositor/hardware_integration/qwlhwintegration.cpp +++ b/src/compositor/hardware_integration/qwlhwintegration.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/hardware_integration/qwlhwintegration_p.h b/src/compositor/hardware_integration/qwlhwintegration_p.h index 70128eb0e..b18b6eeb1 100644 --- a/src/compositor/hardware_integration/qwlhwintegration_p.h +++ b/src/compositor/hardware_integration/qwlhwintegration_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/hardware_integration/qwlserverbufferintegration.cpp b/src/compositor/hardware_integration/qwlserverbufferintegration.cpp index 3c9ceb645..2d99dc850 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegration.cpp +++ b/src/compositor/hardware_integration/qwlserverbufferintegration.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h index 7f08315ae..f8a15318c 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h +++ b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp index be647a0e1..12a7903d6 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp +++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h index 1fc81c950..02f15556d 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h +++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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 +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp index def78391e..f633c1c18 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp +++ b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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 +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h index cb18b34df..c074f1596 100644 --- a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h +++ b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp index faf32dc57..43c9475e4 100644 --- a/src/compositor/wayland_wrapper/qwlcompositor.cpp +++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp @@ -1,7 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -44,6 +45,7 @@ #include "qwldisplay_p.h" #include "qwloutput_p.h" #include "qwlsurface_p.h" +#include "qwaylandclient.h" #include "qwaylandcompositor.h" #include "qwldatadevicemanager_p.h" #include "qwldatadevice_p.h" @@ -60,6 +62,8 @@ #include "qwltextinputmanager_p.h" #include "qwaylandglobalinterface.h" #include "qwaylandsurfaceview.h" +#include "qwaylandshmformathelper.h" +#include "qwaylandoutput.h" #include <QWindow> #include <QSocketNotifier> @@ -107,7 +111,6 @@ Compositor *Compositor::instance() Compositor::Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::ExtensionFlags extensions) : m_extensions(extensions) , m_display(new Display) - , m_default_input_device(0) , m_current_frame(0) , m_last_queued_buf(-1) , m_qt_compositor(qt_compositor) @@ -144,8 +147,9 @@ void Compositor::init() m_data_device_manager = new DataDeviceManager(this); wl_display_init_shm(m_display->handle()); - - m_output_global = new OutputGlobal(m_display->handle()); + QVector<wl_shm_format> formats = QWaylandShmFormatHelper::supportedWaylandFormats(); + foreach (wl_shm_format format, formats) + wl_display_add_shm_format(m_display->handle(), format); if (wl_display_add_socket(m_display->handle(), m_qt_compositor->socketName())) { fprintf(stderr, "Fatal: Failed to open server socket\n"); @@ -163,6 +167,7 @@ void Compositor::init() connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(processWaylandEvents())); qRegisterMetaType<SurfaceBuffer*>("SurfaceBuffer*"); + qRegisterMetaType<QWaylandClient*>("WaylandClient*"); qRegisterMetaType<QWaylandSurface*>("WaylandSurface*"); qRegisterMetaType<QWaylandSurfaceView*>("WaylandSurfaceView*"); //initialize distancefieldglyphcache here @@ -176,6 +181,9 @@ Compositor::~Compositor() { if (!m_destroyed_surfaces.isEmpty()) qWarning("QWaylandCompositor::cleanupGraphicsResources() must be called manually"); + qDeleteAll(m_clients); + + qDeleteAll(m_outputs); delete m_outputExtension; delete m_surfaceExtension; @@ -183,10 +191,10 @@ Compositor::~Compositor() delete m_touchExtension; delete m_qtkeyExtension; + removeInputDevice(m_default_wayland_input_device); delete m_default_wayland_input_device; delete m_data_device_manager; - delete m_output_global; delete m_display; } @@ -203,6 +211,57 @@ uint Compositor::currentTimeMsecs() const return m_timer.elapsed(); } +QList<QWaylandOutput *> Compositor::outputs() const +{ + return m_outputs; +} + +QWaylandOutput *Compositor::output(QWindow *window) const +{ + Q_FOREACH (QWaylandOutput *output, m_outputs) { + if (output->window() == window) + return output; + } + + return Q_NULLPTR; +} + +void Compositor::addOutput(QWaylandOutput *output) +{ + Q_ASSERT(output->handle()); + + if (m_outputs.contains(output)) + return; + + m_outputs.append(output); +} + +void Compositor::removeOutput(QWaylandOutput *output) +{ + Q_ASSERT(output->handle()); + + m_outputs.removeOne(output); +} + +QWaylandOutput *Compositor::primaryOutput() const +{ + if (m_outputs.size() == 0) + return Q_NULLPTR; + return m_outputs.at(0); +} + +void Compositor::setPrimaryOutput(QWaylandOutput *output) +{ + Q_ASSERT(output->handle()); + + int i = m_outputs.indexOf(output); + if (i <= 0) + return; + + m_outputs.removeAt(i); + m_outputs.prepend(output); +} + void Compositor::processWaylandEvents() { int ret = wl_event_loop_dispatch(m_loop, 0); @@ -221,6 +280,16 @@ void Compositor::destroySurface(Surface *surface) m_destroyed_surfaces << surface->waylandSurface(); } +void Compositor::resetInputDevice(Surface *surface) +{ + foreach (QWaylandInputDevice *dev, m_inputDevices) { + if (dev->keyboardFocus() == surface->waylandSurface()) + dev->setKeyboardFocus(0); + if (dev->mouseFocus() && dev->mouseFocus()->surface() == surface->waylandSurface()) + dev->setMouseFocus(0, QPointF(), QPointF()); + } +} + void Compositor::cleanupGraphicsResources() { qDeleteAll(m_destroyed_surfaces); @@ -241,21 +310,15 @@ void Compositor::compositor_create_region(Resource *resource, uint32_t id) new Region(resource->client(), id); } -void Compositor::destroyClient(WaylandClient *c) +void Compositor::destroyClient(QWaylandClient *client) { - wl_client *client = static_cast<wl_client *>(c); if (!client) return; if (m_windowManagerIntegration) - m_windowManagerIntegration->sendQuitMessage(client); + m_windowManagerIntegration->sendQuitMessage(client->client()); - wl_client_destroy(client); -} - -QWindow *Compositor::window() const -{ - return m_qt_compositor->window(); + wl_client_destroy(client->client()); } ClientBufferIntegration * Compositor::clientBufferIntegration() const @@ -281,11 +344,9 @@ void Compositor::initializeHardwareIntegration() #ifdef QT_COMPOSITOR_WAYLAND_GL if (m_extensions & QWaylandCompositor::HardwareIntegrationExtension) m_hw_integration.reset(new HardwareIntegration(this)); - QWindow *window = m_qt_compositor->window(); - if (window && window->surfaceType() != QWindow::RasterSurface) { - loadClientBufferIntegration(); - loadServerBufferIntegration(); - } + + loadClientBufferIntegration(); + loadServerBufferIntegration(); if (m_client_buffer_integration) m_client_buffer_integration->initializeHardware(m_display); @@ -319,55 +380,12 @@ void Compositor::initializeExtensions() void Compositor::initializeDefaultInputDevice() { m_default_wayland_input_device = new QWaylandInputDevice(m_qt_compositor); - m_default_input_device = m_default_wayland_input_device->handle(); -} - -QList<struct wl_client *> Compositor::clients() const -{ - QList<struct wl_client *> list; - foreach (Surface *surface, m_surfaces) { - struct wl_client *client = surface->resource()->client(); - if (!list.contains(client)) - list.append(client); - } - return list; -} - -void Compositor::setScreenOrientation(Qt::ScreenOrientation orientation) -{ - m_orientation = orientation; - m_output_global->sendOutputOrientation(orientation); -} - -Qt::ScreenOrientation Compositor::screenOrientation() const -{ - return m_orientation; -} - -void Compositor::setOutputGeometry(const QRect &geometry) -{ - if (m_output_global) - m_output_global->setGeometry(geometry); -} - -QRect Compositor::outputGeometry() const -{ - if (m_output_global) - return m_output_global->geometry(); - return QRect(); + registerInputDevice(m_default_wayland_input_device); } -void Compositor::setOutputRefreshRate(int rate) +QList<QWaylandClient *> Compositor::clients() const { - if (m_output_global) - m_output_global->setRefreshRate(rate); -} - -int Compositor::outputRefreshRate() const -{ - if (m_output_global) - return m_output_global->refreshRate(); - return 0; + return m_clients; } void Compositor::setClientFullScreenHint(bool value) @@ -383,7 +401,8 @@ QWaylandCompositor::ExtensionFlags Compositor::extensions() const InputDevice* Compositor::defaultInputDevice() { - return m_default_input_device; + // The list gets prepended so that default is the last element + return m_inputDevices.last()->handle(); } QList<QtWayland::Surface *> Compositor::surfacesForClient(wl_client *client) @@ -501,6 +520,32 @@ void Compositor::loadServerBufferIntegration() } } +void Compositor::registerInputDevice(QWaylandInputDevice *device) +{ + // The devices get prepended as the first input device that gets added + // is assumed to be the default and it will claim to accept all the input + // events if asked + m_inputDevices.prepend(device); +} + +void Compositor::removeInputDevice(QWaylandInputDevice *device) +{ + m_inputDevices.removeOne(device); +} + +QWaylandInputDevice *Compositor::inputDeviceFor(QInputEvent *inputEvent) +{ + QWaylandInputDevice *dev = NULL; + for (int i = 0; i < m_inputDevices.size(); i++) { + QWaylandInputDevice *candidate = m_inputDevices.at(i); + if (candidate->isOwner(inputEvent)) { + dev = candidate; + break; + } + } + return dev; +} + } // namespace Wayland QT_END_NAMESPACE diff --git a/src/compositor/wayland_wrapper/qwlcompositor_p.h b/src/compositor/wayland_wrapper/qwlcompositor_p.h index 599f79b6d..2a55ae493 100644 --- a/src/compositor/wayland_wrapper/qwlcompositor_p.h +++ b/src/compositor/wayland_wrapper/qwlcompositor_p.h @@ -1,7 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -48,7 +49,6 @@ #include <QtCore/QElapsedTimer> #include <QtCore/QSet> -#include <QtGui/QWindow> #include <private/qwldisplay_p.h> @@ -56,6 +56,10 @@ QT_BEGIN_NAMESPACE +class QWaylandClient; +class QWaylandClientPrivate; +class QInputEvent; + class QWaylandCompositor; class QWaylandInputDevice; class WindowManagerServerIntegration; @@ -93,15 +97,27 @@ public: void sendFrameCallbacks(QList<QWaylandSurface *> visibleSurfaces); void frameFinished(Surface *surface = 0); - InputDevice *defaultInputDevice(); //we just have 1 default device for now (since QPA doesn't give us anything else) + InputDevice *defaultInputDevice(); + + void registerInputDevice(QWaylandInputDevice *device); + QList<QWaylandInputDevice *> inputDevices() const { return m_inputDevices; } + QWaylandInputDevice *inputDeviceFor(QInputEvent *inputEvent); + void removeInputDevice(QWaylandInputDevice *device); void destroySurface(Surface *surface); - void destroyClient(WaylandClient *client); + void destroyClient(QWaylandClient *client); uint currentTimeMsecs() const; - QWindow *window() const; + QList<QWaylandOutput *> outputs() const; + QWaylandOutput *output(QWindow *window) const; + + void addOutput(QWaylandOutput *output); + void removeOutput(QWaylandOutput *output); + + QWaylandOutput *primaryOutput() const; + void setPrimaryOutput(QWaylandOutput *output); ClientBufferIntegration *clientBufferIntegration() const; ServerBufferIntegration *serverBufferIntegration() const; @@ -119,17 +135,10 @@ public: static Compositor *instance(); - QList<struct wl_client *> clients() const; + QList<QWaylandClient *> clients() const; WindowManagerServerIntegration *windowManagerIntegration() const { return m_windowManagerIntegration; } - void setScreenOrientation(Qt::ScreenOrientation orientation); - Qt::ScreenOrientation screenOrientation() const; - void setOutputGeometry(const QRect &geometry); - QRect outputGeometry() const; - void setOutputRefreshRate(int rate); - int outputRefreshRate() const; - void setClientFullScreenHint(bool value); QWaylandCompositor::ExtensionFlags extensions() const; @@ -153,6 +162,8 @@ public: void feedRetainedSelectionData(QMimeData *data); static void bindGlobal(wl_client *client, void *data, uint32_t version, uint32_t id); + void resetInputDevice(Surface *surface); + public slots: void cleanupGraphicsResources(); @@ -173,11 +184,11 @@ protected: /* Input */ QWaylandInputDevice *m_default_wayland_input_device; - InputDevice *m_default_input_device; + + QList<QWaylandInputDevice *> m_inputDevices; /* Output */ - //make this a list of the available screens - OutputGlobal *m_output_global; + QList<QWaylandOutput *> m_outputs; DataDeviceManager *m_data_device_manager; @@ -193,6 +204,7 @@ protected: QWaylandCompositor *m_qt_compositor; Qt::ScreenOrientation m_orientation; + QList<QWaylandClient *> m_clients; #ifdef QT_COMPOSITOR_WAYLAND_GL QScopedPointer<HardwareIntegration> m_hw_integration; @@ -218,6 +230,8 @@ protected: bool m_retainSelection; friend class QT_PREPEND_NAMESPACE(QWaylandCompositor); + friend class QT_PREPEND_NAMESPACE(QWaylandClient); + friend class QT_PREPEND_NAMESPACE(QWaylandClientPrivate); }; } diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp index 9003e03e2..d97592bd7 100644 --- a/src/compositor/wayland_wrapper/qwldatadevice.cpp +++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwldatadevice_p.h b/src/compositor/wayland_wrapper/qwldatadevice_p.h index 520d231f4..6be177dec 100644 --- a/src/compositor/wayland_wrapper/qwldatadevice_p.h +++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp index ab4c3fec0..2fe7ff4d7 100644 --- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp +++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h index e21a95676..988066fc5 100644 --- a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h +++ b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwldataoffer.cpp b/src/compositor/wayland_wrapper/qwldataoffer.cpp index 02da4ec92..028e0bf86 100644 --- a/src/compositor/wayland_wrapper/qwldataoffer.cpp +++ b/src/compositor/wayland_wrapper/qwldataoffer.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwldataoffer_p.h b/src/compositor/wayland_wrapper/qwldataoffer_p.h index 643322f32..8d4cd1256 100644 --- a/src/compositor/wayland_wrapper/qwldataoffer_p.h +++ b/src/compositor/wayland_wrapper/qwldataoffer_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwldatasource.cpp b/src/compositor/wayland_wrapper/qwldatasource.cpp index 21e622703..0350ff649 100644 --- a/src/compositor/wayland_wrapper/qwldatasource.cpp +++ b/src/compositor/wayland_wrapper/qwldatasource.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwldatasource_p.h b/src/compositor/wayland_wrapper/qwldatasource_p.h index 013f4b54f..1ddad3634 100644 --- a/src/compositor/wayland_wrapper/qwldatasource_p.h +++ b/src/compositor/wayland_wrapper/qwldatasource_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwldisplay.cpp b/src/compositor/wayland_wrapper/qwldisplay.cpp index affb0d17a..fafde3f73 100644 --- a/src/compositor/wayland_wrapper/qwldisplay.cpp +++ b/src/compositor/wayland_wrapper/qwldisplay.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwldisplay_p.h b/src/compositor/wayland_wrapper/qwldisplay_p.h index f18cb1e6b..6ba66f951 100644 --- a/src/compositor/wayland_wrapper/qwldisplay_p.h +++ b/src/compositor/wayland_wrapper/qwldisplay_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlextendedoutput.cpp b/src/compositor/wayland_wrapper/qwlextendedoutput.cpp index 8bf69ff41..dbcbb57b8 100644 --- a/src/compositor/wayland_wrapper/qwlextendedoutput.cpp +++ b/src/compositor/wayland_wrapper/qwlextendedoutput.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -56,10 +56,10 @@ OutputExtensionGlobal::OutputExtensionGlobal(Compositor *compositor) void OutputExtensionGlobal::output_extension_get_extended_output(qt_output_extension::Resource *resource, uint32_t id, wl_resource *output_resource) { - Output *output = static_cast<Output *>(OutputGlobal::Resource::fromResource(output_resource)); + OutputResource *output = static_cast<OutputResource *>(Output::Resource::fromResource(output_resource)); Q_ASSERT(output->extendedOutput == 0); - ExtendedOutput *extendedOutput = static_cast<ExtendedOutput *>(qt_extended_output::add(resource->client(), id, resource->version())); + ExtendedOutput *extendedOutput = static_cast<ExtendedOutput *>(qt_extended_output::add(resource->client(), id)); Q_ASSERT(!output->extendedOutput); output->extendedOutput = extendedOutput; diff --git a/src/compositor/wayland_wrapper/qwlextendedoutput_p.h b/src/compositor/wayland_wrapper/qwlextendedoutput_p.h index 5f620cd86..8d030dd95 100644 --- a/src/compositor/wayland_wrapper/qwlextendedoutput_p.h +++ b/src/compositor/wayland_wrapper/qwlextendedoutput_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -54,14 +54,14 @@ QT_BEGIN_NAMESPACE namespace QtWayland { class Compositor; -class Output; +class OutputResource; class ExtendedOutput : public QtWaylandServer::qt_extended_output::Resource { public: ExtendedOutput() : output(0) {} - Output *output; + OutputResource *output; }; class OutputExtensionGlobal : public QtWaylandServer::qt_output_extension, public QtWaylandServer::qt_extended_output diff --git a/src/compositor/wayland_wrapper/qwlextendedsurface.cpp b/src/compositor/wayland_wrapper/qwlextendedsurface.cpp index e4ba40e70..1c6a14172 100644 --- a/src/compositor/wayland_wrapper/qwlextendedsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlextendedsurface.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlextendedsurface_p.h b/src/compositor/wayland_wrapper/qwlextendedsurface_p.h index 9bcb28272..e3c370091 100644 --- a/src/compositor/wayland_wrapper/qwlextendedsurface_p.h +++ b/src/compositor/wayland_wrapper/qwlextendedsurface_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlinputdevice.cpp b/src/compositor/wayland_wrapper/qwlinputdevice.cpp index 40f21134e..cb27ab4e4 100644 --- a/src/compositor/wayland_wrapper/qwlinputdevice.cpp +++ b/src/compositor/wayland_wrapper/qwlinputdevice.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE namespace QtWayland { InputDevice::InputDevice(QWaylandInputDevice *handle, Compositor *compositor, QWaylandInputDevice::CapabilityFlags caps) - : QtWaylandServer::wl_seat(compositor->wl_display(), 2) + : QtWaylandServer::wl_seat(compositor->wl_display(), 3) , m_handle(handle) , m_dragHandle(new QWaylandDrag(this)) , m_compositor(compositor) diff --git a/src/compositor/wayland_wrapper/qwlinputdevice_p.h b/src/compositor/wayland_wrapper/qwlinputdevice_p.h index 35a2224b9..785c6d7e9 100644 --- a/src/compositor/wayland_wrapper/qwlinputdevice_p.h +++ b/src/compositor/wayland_wrapper/qwlinputdevice_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlinputmethod.cpp b/src/compositor/wayland_wrapper/qwlinputmethod.cpp index ea495b37c..5bafe7894 100644 --- a/src/compositor/wayland_wrapper/qwlinputmethod.cpp +++ b/src/compositor/wayland_wrapper/qwlinputmethod.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlinputmethod_p.h b/src/compositor/wayland_wrapper/qwlinputmethod_p.h index 2cfa14b99..f2df5c8ab 100644 --- a/src/compositor/wayland_wrapper/qwlinputmethod_p.h +++ b/src/compositor/wayland_wrapper/qwlinputmethod_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlinputmethodcontext.cpp b/src/compositor/wayland_wrapper/qwlinputmethodcontext.cpp index 5b9a24db1..caf75b2ae 100644 --- a/src/compositor/wayland_wrapper/qwlinputmethodcontext.cpp +++ b/src/compositor/wayland_wrapper/qwlinputmethodcontext.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlinputmethodcontext_p.h b/src/compositor/wayland_wrapper/qwlinputmethodcontext_p.h index 5060d4d6f..a766d63d6 100644 --- a/src/compositor/wayland_wrapper/qwlinputmethodcontext_p.h +++ b/src/compositor/wayland_wrapper/qwlinputmethodcontext_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlinputpanel.cpp b/src/compositor/wayland_wrapper/qwlinputpanel.cpp index 4dae2749c..2f11a9b3f 100644 --- a/src/compositor/wayland_wrapper/qwlinputpanel.cpp +++ b/src/compositor/wayland_wrapper/qwlinputpanel.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlinputpanel_p.h b/src/compositor/wayland_wrapper/qwlinputpanel_p.h index 75d795e4c..a475da37c 100644 --- a/src/compositor/wayland_wrapper/qwlinputpanel_p.h +++ b/src/compositor/wayland_wrapper/qwlinputpanel_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlinputpanelsurface.cpp b/src/compositor/wayland_wrapper/qwlinputpanelsurface.cpp index 138e57032..fdaf895ef 100644 --- a/src/compositor/wayland_wrapper/qwlinputpanelsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlinputpanelsurface.cpp @@ -1,7 +1,8 @@ /**************************************************************************** ** +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -77,10 +78,11 @@ void InputPanelSurface::input_panel_surface_set_overlay_panel(Resource *) m_type = OverlayPanel; } -void InputPanelSurface::input_panel_surface_set_toplevel(Resource *, wl_resource *output, uint32_t position) +void InputPanelSurface::input_panel_surface_set_toplevel(Resource *, wl_resource *output_resource, uint32_t position) { m_type = Toplevel; - m_output = static_cast<Output *>(Output::Resource::fromResource(output)); + OutputResource *output = static_cast<OutputResource *>(Output::Resource::fromResource(output_resource)); + m_output = static_cast<Output *>(output->output_object); m_position = static_cast<wl_input_panel_surface::position>(position); } diff --git a/src/compositor/wayland_wrapper/qwlinputpanelsurface_p.h b/src/compositor/wayland_wrapper/qwlinputpanelsurface_p.h index 89c85895f..621ce135c 100644 --- a/src/compositor/wayland_wrapper/qwlinputpanelsurface_p.h +++ b/src/compositor/wayland_wrapper/qwlinputpanelsurface_p.h @@ -1,7 +1,8 @@ /**************************************************************************** ** +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -68,7 +69,7 @@ public: protected: void input_panel_surface_set_overlay_panel(Resource *resource) Q_DECL_OVERRIDE; - void input_panel_surface_set_toplevel(Resource *resource, wl_resource *output, uint32_t position) Q_DECL_OVERRIDE; + void input_panel_surface_set_toplevel(Resource *resource, wl_resource *output_resource, uint32_t position) Q_DECL_OVERRIDE; private: Surface *m_surface; diff --git a/src/compositor/wayland_wrapper/qwlkeyboard.cpp b/src/compositor/wayland_wrapper/qwlkeyboard.cpp index 748639c8d..a7889fd40 100644 --- a/src/compositor/wayland_wrapper/qwlkeyboard.cpp +++ b/src/compositor/wayland_wrapper/qwlkeyboard.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -18,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -203,6 +203,11 @@ void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource) m_focusResource = 0; } +void Keyboard::keyboard_release(wl_keyboard::Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + void Keyboard::key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { if (m_focusResource) { diff --git a/src/compositor/wayland_wrapper/qwlkeyboard_p.h b/src/compositor/wayland_wrapper/qwlkeyboard_p.h index fff6e3e04..44503114e 100644 --- a/src/compositor/wayland_wrapper/qwlkeyboard_p.h +++ b/src/compositor/wayland_wrapper/qwlkeyboard_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidi ary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -18,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -110,6 +110,7 @@ Q_SIGNALS: protected: void keyboard_bind_resource(Resource *resource); void keyboard_destroy_resource(Resource *resource); + void keyboard_release(Resource *resource) Q_DECL_OVERRIDE; private: void sendKeyEvent(uint code, uint32_t state); diff --git a/src/compositor/wayland_wrapper/qwllistener.cpp b/src/compositor/wayland_wrapper/qwllistener.cpp index a754981bf..5a3c0e576 100644 --- a/src/compositor/wayland_wrapper/qwllistener.cpp +++ b/src/compositor/wayland_wrapper/qwllistener.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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 +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/wayland_wrapper/qwllistener_p.h b/src/compositor/wayland_wrapper/qwllistener_p.h index 4c49b1433..addc9a1fb 100644 --- a/src/compositor/wayland_wrapper/qwllistener_p.h +++ b/src/compositor/wayland_wrapper/qwllistener_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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. +** 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. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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$ ** ****************************************************************************/ diff --git a/src/compositor/wayland_wrapper/qwloutput.cpp b/src/compositor/wayland_wrapper/qwloutput.cpp index 7638370bc..9cecff2a9 100644 --- a/src/compositor/wayland_wrapper/qwloutput.cpp +++ b/src/compositor/wayland_wrapper/qwloutput.cpp @@ -1,7 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -39,100 +40,222 @@ ****************************************************************************/ #include "qwloutput_p.h" + +#include "qwlcompositor_p.h" #include "qwlextendedoutput_p.h" -#include <QGuiApplication> -#include <QtGui/QScreen> + +#include <QtGui/QWindow> #include <QRect> QT_BEGIN_NAMESPACE namespace QtWayland { -OutputGlobal::OutputGlobal(struct ::wl_display *display) - : QtWaylandServer::wl_output(display, 2) - , m_displayId(-1) - , m_numQueued(0) - , m_transform(WL_OUTPUT_TRANSFORM_NORMAL) +static QtWaylandServer::wl_output::subpixel toWlSubpixel(const QWaylandOutput::Subpixel &value) { - QScreen *screen = QGuiApplication::primaryScreen(); - m_geometry = QRect(QPoint(0, 0), screen->availableGeometry().size()); - m_refreshRate = qRound(screen->refreshRate() * 1000.0); + switch (value) { + case QWaylandOutput::SubpixelUnknown: + return QtWaylandServer::wl_output::subpixel_unknown; + case QWaylandOutput::SubpixelNone: + return QtWaylandServer::wl_output::subpixel_none; + case QWaylandOutput::SubpixelHorizontalRgb: + return QtWaylandServer::wl_output::subpixel_horizontal_rgb; + case QWaylandOutput::SubpixelHorizontalBgr: + return QtWaylandServer::wl_output::subpixel_horizontal_bgr; + case QWaylandOutput::SubpixelVerticalRgb: + return QtWaylandServer::wl_output::subpixel_vertical_rgb; + case QWaylandOutput::SubpixelVerticalBgr: + return QtWaylandServer::wl_output::subpixel_vertical_bgr; + default: + break; + } + + return QtWaylandServer::wl_output::subpixel_unknown; } -OutputGlobal::~OutputGlobal() +static QtWaylandServer::wl_output::transform toWlTransform(const QWaylandOutput::Transform &value) { + switch (value) { + case QWaylandOutput::Transform90: + return QtWaylandServer::wl_output::transform_90; + case QWaylandOutput::Transform180: + return QtWaylandServer::wl_output::transform_180; + case QWaylandOutput::Transform270: + return QtWaylandServer::wl_output::transform_270; + case QWaylandOutput::TransformFlipped: + return QtWaylandServer::wl_output::transform_flipped; + case QWaylandOutput::TransformFlipped90: + return QtWaylandServer::wl_output::transform_flipped_90; + case QWaylandOutput::TransformFlipped180: + return QtWaylandServer::wl_output::transform_flipped_180; + case QWaylandOutput::TransformFlipped270: + return QtWaylandServer::wl_output::transform_flipped_270; + default: + break; + } + + return QtWaylandServer::wl_output::transform_normal; } -void OutputGlobal::output_bind_resource(Resource *resource) +Output::Output(Compositor *compositor, QWindow *window) + : QtWaylandServer::wl_output(compositor->wl_display(), 2) + , m_compositor(compositor) + , m_window(window) + , m_output(Q_NULLPTR) + , m_position(QPoint()) + , m_availableGeometry(QRect()) + , m_physicalSize(QSize()) + , m_subpixel(QWaylandOutput::SubpixelUnknown) + , m_transform(QWaylandOutput::TransformNormal) + , m_scaleFactor(1) { - wl_output_send_geometry(resource->handle, 0, 0, - m_physicalSize.width(), m_physicalSize.height(), 0, "", "", m_transform); + m_mode.size = window ? window->size() : QSize(); + m_mode.refreshRate = 60; - wl_output_send_mode(resource->handle, WL_OUTPUT_MODE_CURRENT|WL_OUTPUT_MODE_PREFERRED, - size().width(), size().height(), refreshRate()); + qRegisterMetaType<QWaylandOutput::Mode>("WaylandOutput::Mode"); +} - if (resource->version() >= 2) - wl_output_send_done(resource->handle); +void Output::output_bind_resource(Resource *resource) +{ + send_geometry(resource->handle, + m_position.x(), m_position.y(), + m_physicalSize.width(), m_physicalSize.height(), + toWlSubpixel(m_subpixel), m_manufacturer, m_model, + toWlTransform(m_transform)); + + send_mode(resource->handle, mode_current | mode_preferred, + m_mode.size.width(), m_mode.size.height(), + m_mode.refreshRate); + + send_scale(resource->handle, m_scaleFactor); + + send_done(resource->handle); } -void OutputGlobal::setPhysicalSize(const QSize &size) +void Output::setManufacturer(const QString &manufacturer) { - if (m_physicalSize != size) { - m_physicalSize = size; + m_manufacturer = manufacturer; +} - foreach (Resource *res, resourceMap()) { - wl_output_send_geometry(res->handle, 0, 0, - m_physicalSize.width(), m_physicalSize.height(), 0, "", "", m_transform); +void Output::setModel(const QString &model) +{ + m_model = model; +} - if (res->version() >= 2) - wl_output_send_done(res->handle); - } - } +void Output::setPosition(const QPoint &position) +{ + if (m_position == position) + return; + + m_position = position; + + sendGeometryInfo(); } -void OutputGlobal::setGeometry(const QRect &geometry) +void Output::setMode(const QWaylandOutput::Mode &mode) { - m_geometry = geometry; + if (m_mode.size == mode.size && m_mode.refreshRate == mode.refreshRate) + return; + + m_mode = mode; + + Q_FOREACH (Resource *resource, resourceMap().values()) { + send_mode(resource->handle, mode_current, + m_mode.size.width(), m_mode.size.height(), + m_mode.refreshRate * 1000); + send_done(resource->handle); + } } -void OutputGlobal::setRefreshRate(int rate) +QRect Output::geometry() const { - m_refreshRate = rate; + return QRect(m_position, m_mode.size); } -void OutputGlobal::sendOutputOrientation(Qt::ScreenOrientation orientation) +void Output::setGeometry(const QRect &geometry) { - QScreen *screen = QGuiApplication::primaryScreen(); - bool isPortrait = screen->primaryOrientation() == Qt::PortraitOrientation; - switch (orientation) { - case Qt::PrimaryOrientation: - m_transform = WL_OUTPUT_TRANSFORM_NORMAL; - break; - case Qt::PortraitOrientation: - m_transform = isPortrait ? WL_OUTPUT_TRANSFORM_NORMAL : WL_OUTPUT_TRANSFORM_90; - break; - case Qt::LandscapeOrientation: - m_transform = isPortrait ? WL_OUTPUT_TRANSFORM_270 : WL_OUTPUT_TRANSFORM_NORMAL; - break; - case Qt::InvertedPortraitOrientation: - m_transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270; - break; - case Qt::InvertedLandscapeOrientation: - m_transform = isPortrait ? WL_OUTPUT_TRANSFORM_90 : WL_OUTPUT_TRANSFORM_180; - break; + if (m_position == geometry.topLeft() && m_mode.size == geometry.size()) + return; + + m_position = geometry.topLeft(); + m_mode.size = geometry.size(); + + Q_FOREACH (Resource *resource, resourceMap().values()) { + send_geometry(resource->handle, + m_position.x(), m_position.y(), + m_physicalSize.width(), m_physicalSize.height(), + toWlSubpixel(m_subpixel), m_manufacturer, m_model, + toWlTransform(m_transform)); + send_mode(resource->handle, mode_current, + m_mode.size.width(), m_mode.size.height(), + m_mode.refreshRate * 1000); + send_done(resource->handle); } +} - foreach (Resource *res, resourceMap()) { - wl_output_send_geometry(res->handle, 0, 0, - m_physicalSize.width(), m_physicalSize.height(), 0, "", "", m_transform); - if (res->version() >= 2) - wl_output_send_done(res->handle); +void Output::setAvailableGeometry(const QRect &availableGeometry) +{ + m_availableGeometry = availableGeometry; +} + +void Output::setPhysicalSize(const QSize &physicalSize) +{ + if (m_physicalSize == physicalSize) + return; + + m_physicalSize = physicalSize; + + sendGeometryInfo(); +} + +void Output::setSubpixel(const QWaylandOutput::Subpixel &subpixel) +{ + if (m_subpixel == subpixel) + return; + + m_subpixel = subpixel; + + sendGeometryInfo(); +} + +void Output::setTransform(const QWaylandOutput::Transform &transform) +{ + if (m_transform == transform) + return; + + m_transform = transform; + + sendGeometryInfo(); +} + +void Output::setScaleFactor(int scale) +{ + if (m_scaleFactor == scale) + return; + + m_scaleFactor = scale; + + Q_FOREACH (Resource *resource, resourceMap().values()) { + send_scale(resource->handle, m_scaleFactor); + send_done(resource->handle); } } -Output *OutputGlobal::outputForClient(wl_client *client) const +OutputResource *Output::outputForClient(wl_client *client) const +{ + return static_cast<OutputResource *>(resourceMap().value(client)); +} + +void Output::sendGeometryInfo() { - return static_cast<Output *>(resourceMap().value(client)); + Q_FOREACH (Resource *resource, resourceMap().values()) { + send_geometry(resource->handle, + m_position.x(), m_position.x(), + m_physicalSize.width(), m_physicalSize.height(), + toWlSubpixel(m_subpixel), m_manufacturer, m_model, + toWlTransform(m_transform)); + send_done(resource->handle); + } } } // namespace Wayland diff --git a/src/compositor/wayland_wrapper/qwloutput_p.h b/src/compositor/wayland_wrapper/qwloutput_p.h index 9d90550e3..06ff02eda 100644 --- a/src/compositor/wayland_wrapper/qwloutput_p.h +++ b/src/compositor/wayland_wrapper/qwloutput_p.h @@ -1,7 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -41,74 +42,95 @@ #ifndef WL_OUTPUT_H #define WL_OUTPUT_H +#include <QtCompositor/qwaylandexport.h> + #include <QtCore/QRect> #include <QtCore/QList> #include <QtCompositor/private/qwayland-server-wayland.h> +#include <QtCompositor/qwaylandoutput.h> QT_BEGIN_NAMESPACE +class QWindow; + namespace QtWayland { +class Compositor; class ExtendedOutput; -struct Output : public QtWaylandServer::wl_output::Resource +struct OutputResource : public QtWaylandServer::wl_output::Resource { - Output() : extendedOutput(0) {} + OutputResource() : extendedOutput(0) {} ExtendedOutput *extendedOutput; }; -class OutputGlobal : public QtWaylandServer::wl_output +class Output : public QtWaylandServer::wl_output { public: - OutputGlobal(struct ::wl_display *display); - ~OutputGlobal(); + explicit Output(Compositor *compositor, QWindow *window = 0); + + Compositor *compositor() const { return m_compositor; } + + QWaylandOutput *output() const { return m_output; } + + QString manufacturer() const { return m_manufacturer; } + void setManufacturer(const QString &manufacturer); + QString model() const { return m_model; } + void setModel(const QString &model); + + QPoint position() const { return m_position; } + void setPosition(const QPoint &position); + + QRect geometry() const; void setGeometry(const QRect &geometry); - QRect geometry() const { return m_geometry; } - int x() const { return m_geometry.x(); } - int y() const { return m_geometry.y(); } - QSize size() const { return m_geometry.size(); } + QWaylandOutput::Mode mode() const { return m_mode; } + void setMode(const QWaylandOutput::Mode &mode); - void setPhysicalSize(const QSize &size); - void setRefreshRate(int rate); - int refreshRate() const { return m_refreshRate; } - void sendOutputOrientation(Qt::ScreenOrientation orientation); + QRect availableGeometry() const { return m_availableGeometry; } + void setAvailableGeometry(const QRect &availableGeometry); - Output *outputForClient(struct wl_client *client) const; + QSize physicalSize() const { return m_physicalSize; } + void setPhysicalSize(const QSize &physicalSize); - void output_bind_resource(Resource *resource) Q_DECL_OVERRIDE; - Resource *output_allocate() Q_DECL_OVERRIDE { return new Output; } + QWaylandOutput::Subpixel subpixel() const { return m_subpixel; } + void setSubpixel(const QWaylandOutput::Subpixel &subpixel); -private: - QRect m_geometry; - QSize m_physicalSize; - int m_refreshRate; - int m_displayId; - int m_numQueued; - wl_output_transform m_transform; -}; + QWaylandOutput::Transform transform() const { return m_transform; } + void setTransform(const QWaylandOutput::Transform &transform); -#if 0 -class Output -{ -public: - Output(OutputGlobal *outputGlobal, struct ::wl_resource *resource); - ~Output(); + int scaleFactor() const { return m_scaleFactor; } + void setScaleFactor(int scale); + + QWindow *window() const { return m_window; } - OutputGlobal *outputGlobal() const; + OutputResource *outputForClient(struct wl_client *client) const; - ExtendedOutput *extendedOutput() const; - void setExtendedOutput(ExtendedOutput *extendedOutput); + QWaylandOutput *waylandOutput() const { return m_output; } + + void output_bind_resource(Resource *resource) Q_DECL_OVERRIDE; + Resource *output_allocate() Q_DECL_OVERRIDE { return new OutputResource; } - struct wl_resource *handle() const; private: - struct wl_resource *m_output_resource; - OutputGlobal *m_output_global; - ExtendedOutput *m_extended_output; + friend class QT_PREPEND_NAMESPACE(QWaylandOutput); + + Compositor *m_compositor; + QWindow *m_window; + QWaylandOutput *m_output; + QString m_manufacturer; + QString m_model; + QPoint m_position; + QWaylandOutput::Mode m_mode; + QRect m_availableGeometry; + QSize m_physicalSize; + QWaylandOutput::Subpixel m_subpixel; + QWaylandOutput::Transform m_transform; + int m_scaleFactor; + + void sendGeometryInfo(); }; -#endif } diff --git a/src/compositor/wayland_wrapper/qwlpointer.cpp b/src/compositor/wayland_wrapper/qwlpointer.cpp index 4363ed0f4..10c2d1037 100644 --- a/src/compositor/wayland_wrapper/qwlpointer.cpp +++ b/src/compositor/wayland_wrapper/qwlpointer.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -18,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -217,6 +217,11 @@ void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource) m_focusResource = 0; } +void Pointer::pointer_release(wl_pointer::Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + void Pointer::setMouseFocus(QWaylandSurfaceView *surface, const QPointF &localPos, const QPointF &globalPos) { m_position = globalPos; diff --git a/src/compositor/wayland_wrapper/qwlpointer_p.h b/src/compositor/wayland_wrapper/qwlpointer_p.h index f24b7c038..db2932d04 100644 --- a/src/compositor/wayland_wrapper/qwlpointer_p.h +++ b/src/compositor/wayland_wrapper/qwlpointer_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -18,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -114,6 +114,7 @@ public: protected: void pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) Q_DECL_OVERRIDE; + void pointer_release(Resource *resource) Q_DECL_OVERRIDE; void pointer_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; private: diff --git a/src/compositor/wayland_wrapper/qwlqtkey.cpp b/src/compositor/wayland_wrapper/qwlqtkey.cpp index 285709064..1eb6c2f1b 100644 --- a/src/compositor/wayland_wrapper/qwlqtkey.cpp +++ b/src/compositor/wayland_wrapper/qwlqtkey.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlqtkey_p.h b/src/compositor/wayland_wrapper/qwlqtkey_p.h index 6257e0a92..2b10c8f71 100644 --- a/src/compositor/wayland_wrapper/qwlqtkey_p.h +++ b/src/compositor/wayland_wrapper/qwlqtkey_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlqttouch.cpp b/src/compositor/wayland_wrapper/qwlqttouch.cpp index 0110c433b..9d4dfdcdd 100644 --- a/src/compositor/wayland_wrapper/qwlqttouch.cpp +++ b/src/compositor/wayland_wrapper/qwlqttouch.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlqttouch_p.h b/src/compositor/wayland_wrapper/qwlqttouch_p.h index 720bc83e5..e5215def6 100644 --- a/src/compositor/wayland_wrapper/qwlqttouch_p.h +++ b/src/compositor/wayland_wrapper/qwlqttouch_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlregion.cpp b/src/compositor/wayland_wrapper/qwlregion.cpp index f9bcde380..03829df9a 100644 --- a/src/compositor/wayland_wrapper/qwlregion.cpp +++ b/src/compositor/wayland_wrapper/qwlregion.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlregion_p.h b/src/compositor/wayland_wrapper/qwlregion_p.h index 06d21ff37..7fc92f071 100644 --- a/src/compositor/wayland_wrapper/qwlregion_p.h +++ b/src/compositor/wayland_wrapper/qwlregion_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlshellsurface.cpp b/src/compositor/wayland_wrapper/qwlshellsurface.cpp index 80304f3cb..42c6a56e6 100644 --- a/src/compositor/wayland_wrapper/qwlshellsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlshellsurface.cpp @@ -1,7 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -42,11 +43,13 @@ #include "qwlcompositor_p.h" #include "qwlsurface_p.h" +#include "qwloutput_p.h" #include "qwlinputdevice_p.h" #include "qwlsubsurface_p.h" #include "qwlpointer_p.h" #include "qwlextendedsurface_p.h" +#include "qwaylandoutput.h" #include "qwaylandsurfaceview.h" #include <QtCore/qglobal.h> @@ -278,14 +281,33 @@ void ShellSurface::shell_surface_set_transient(Resource *resource, void ShellSurface::shell_surface_set_fullscreen(Resource *resource, uint32_t method, uint32_t framerate, - struct wl_resource *output) + struct wl_resource *output_resource) { Q_UNUSED(resource); Q_UNUSED(method); Q_UNUSED(framerate); - Q_UNUSED(output); - QSize defaultScreenSize = m_surface->compositor()->outputGeometry().size(); - send_configure(resize_bottom_right, defaultScreenSize.width(), defaultScreenSize.height()); + + QWaylandOutput *output = output_resource + ? QWaylandOutput::fromResource(output_resource) + : Q_NULLPTR; + if (!output) { + // Look for an output that can contain this surface + Q_FOREACH (QWaylandOutput *curOutput, m_surface->compositor()->outputs()) { + if (curOutput->geometry().size().width() >= m_surface->size().width() && + curOutput->geometry().size().height() >= m_surface->size().height()) { + output = curOutput; + break; + } + } + } + if (!output) { + qWarning() << "Unable to resize surface full screen, cannot determine output"; + return; + } + QSize outputSize = output->geometry().size(); + + m_view->setPos(output->geometry().topLeft()); + send_configure(resize_bottom_right, outputSize.width(), outputSize.height()); if (m_surface->extendedSurface()) m_surface->extendedSurface()->setVisibility(QWindow::FullScreen, false); @@ -311,12 +333,31 @@ void ShellSurface::shell_surface_set_popup(Resource *resource, wl_resource *inpu } void ShellSurface::shell_surface_set_maximized(Resource *resource, - struct wl_resource *output) + struct wl_resource *output_resource) { Q_UNUSED(resource); - Q_UNUSED(output); - QSize defaultScreenSize = m_surface->compositor()->outputGeometry().size(); - send_configure(resize_bottom_right, defaultScreenSize.width(), defaultScreenSize.height()); + + QWaylandOutput *output = output_resource + ? QWaylandOutput::fromResource(output_resource) + : Q_NULLPTR; + if (!output) { + // Look for an output that can contain this surface + Q_FOREACH (QWaylandOutput *curOutput, m_surface->compositor()->outputs()) { + if (curOutput->geometry().size().width() >= m_surface->size().width() && + curOutput->geometry().size().height() >= m_surface->size().height()) { + output = curOutput; + break; + } + } + } + if (!output) { + qWarning() << "Unable to maximize surface, cannot determine output"; + return; + } + QSize outputSize = output->availableGeometry().size(); + + m_view->setPos(output->availableGeometry().topLeft()); + send_configure(resize_bottom_right, outputSize.width(), outputSize.height()); if (m_surface->extendedSurface()) m_surface->extendedSurface()->setVisibility(QWindow::Maximized, false); diff --git a/src/compositor/wayland_wrapper/qwlshellsurface_p.h b/src/compositor/wayland_wrapper/qwlshellsurface_p.h index 92405bbc9..672606229 100644 --- a/src/compositor/wayland_wrapper/qwlshellsurface_p.h +++ b/src/compositor/wayland_wrapper/qwlshellsurface_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -139,7 +139,7 @@ private: void shell_surface_set_fullscreen(Resource *resource, uint32_t method, uint32_t framerate, - struct wl_resource *output) Q_DECL_OVERRIDE; + struct wl_resource *output_resource) Q_DECL_OVERRIDE; void shell_surface_set_popup(Resource *resource, struct wl_resource *input_device, uint32_t time, @@ -148,7 +148,7 @@ private: int32_t y, uint32_t flags) Q_DECL_OVERRIDE; void shell_surface_set_maximized(Resource *resource, - struct wl_resource *output) Q_DECL_OVERRIDE; + struct wl_resource *output_resource) Q_DECL_OVERRIDE; void shell_surface_pong(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE; void shell_surface_set_title(Resource *resource, diff --git a/src/compositor/wayland_wrapper/qwlsubsurface.cpp b/src/compositor/wayland_wrapper/qwlsubsurface.cpp index 3c866a1d2..afc6d1825 100644 --- a/src/compositor/wayland_wrapper/qwlsubsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlsubsurface.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlsubsurface_p.h b/src/compositor/wayland_wrapper/qwlsubsurface_p.h index 938c2be33..0357b1e0e 100644 --- a/src/compositor/wayland_wrapper/qwlsubsurface_p.h +++ b/src/compositor/wayland_wrapper/qwlsubsurface_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp index 5cd8bb506..e26eec8ba 100644 --- a/src/compositor/wayland_wrapper/qwlsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlsurface.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -48,6 +48,7 @@ #include "qwlsubsurface_p.h" #include "qwlsurfacebuffer_p.h" #include "qwaylandsurfaceview.h" +#include "qwaylandoutput.h" #include <QtCore/QDebug> #include <QTouchEvent> @@ -104,16 +105,23 @@ public: bool canSend; }; +static QRegion infiniteRegion() { + return QRegion(QRect(QPoint(std::numeric_limits<int>::min(), std::numeric_limits<int>::min()), + QPoint(std::numeric_limits<int>::max(), std::numeric_limits<int>::max()))); +} + Surface::Surface(struct wl_client *client, uint32_t id, int version, QWaylandCompositor *compositor, QWaylandSurface *surface) : QtWaylandServer::wl_surface(client, id, version) , m_compositor(compositor->handle()) , m_waylandSurface(surface) + , m_output(m_compositor->primaryOutput()->handle()) , m_buffer(0) , m_surfaceMapped(false) , m_attacher(0) , m_extendedSurface(0) , m_subSurface(0) , m_inputPanelSurface(0) + , m_inputRegion(infiniteRegion()) , m_transientParent(0) , m_transientInactive(false) , m_transientOffset(QPointF(0, 0)) @@ -124,6 +132,7 @@ Surface::Surface(struct wl_client *client, uint32_t id, int version, QWaylandCom { m_pending.buffer = 0; m_pending.newlyAttached = false; + m_pending.inputRegion = infiniteRegion(); } Surface::~Surface() @@ -190,7 +199,6 @@ void Surface::setSize(const QSize &size) { if (size != m_size) { m_opaqueRegion = QRegion(); - m_inputRegion = QRegion(QRect(QPoint(), size)); m_size = size; m_waylandSurface->sizeChanged(); } @@ -270,6 +278,11 @@ Compositor *Surface::compositor() const return m_compositor; } +Output *Surface::output() const +{ + return m_output; +} + /*! * Sets the backbuffer for this surface. The back buffer is not yet on * screen and will become live during the next swapBuffers(). @@ -288,11 +301,7 @@ void Surface::setBackBuffer(SurfaceBuffer *buffer) m_damage = m_damage.intersected(QRect(QPoint(), m_size)); emit m_waylandSurface->damaged(m_damage); } else { - InputDevice *inputDevice = m_compositor->defaultInputDevice(); - if (inputDevice->keyboardFocus() == this) - inputDevice->setKeyboardFocus(0); - if (inputDevice->mouseFocus() && inputDevice->mouseFocus()->surface() == waylandSurface()) - inputDevice->setMouseFocus(0, QPointF(), QPointF()); + m_compositor->resetInputDevice(this); } m_damage = QRegion(); } @@ -379,7 +388,11 @@ void Surface::surface_set_opaque_region(Resource *, struct wl_resource *region) void Surface::surface_set_input_region(Resource *, struct wl_resource *region) { - m_inputRegion = region ? Region::fromResource(region)->region() : QRegion(QRect(QPoint(), size())); + if (region) { + m_pending.inputRegion = Region::fromResource(region)->region(); + } else { + m_pending.inputRegion = infiniteRegion(); + } } void Surface::surface_commit(Resource *) @@ -406,6 +419,8 @@ void Surface::surface_commit(Resource *) m_frameCallbacks << m_pendingFrameCallbacks; m_pendingFrameCallbacks.clear(); + m_inputRegion = m_pending.inputRegion.intersected(QRect(QPoint(), m_size)); + emit m_waylandSurface->redraw(); } diff --git a/src/compositor/wayland_wrapper/qwlsurface_p.h b/src/compositor/wayland_wrapper/qwlsurface_p.h index 5a3c4be3d..0633a938b 100644 --- a/src/compositor/wayland_wrapper/qwlsurface_p.h +++ b/src/compositor/wayland_wrapper/qwlsurface_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -44,6 +44,7 @@ #include <QtCompositor/qwaylandexport.h> #include <private/qwlsurfacebuffer_p.h> +#include <private/qwloutput_p.h> #include <QtCompositor/qwaylandsurface.h> #include <QtCompositor/qwaylandbufferref.h> @@ -112,6 +113,8 @@ public: Compositor *compositor() const; + Output *output() const; + QString className() const { return m_className; } void setClassName(const QString &className); @@ -159,6 +162,7 @@ protected: Compositor *m_compositor; QWaylandSurface *m_waylandSurface; + Output *m_output; QRegion m_damage; SurfaceBuffer *m_buffer; @@ -171,6 +175,7 @@ protected: QRegion damage; QPoint offset; bool newlyAttached; + QRegion inputRegion; } m_pending; QPoint m_lastLocalMousePos; diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp index 1ed1fefd8..066ffd15b 100644 --- a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp +++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -50,6 +50,9 @@ #include <QtCore/QDebug> +#include <wayland-server-protocol.h> +#include "qwaylandshmformathelper.h" + QT_BEGIN_NAMESPACE namespace QtWayland { @@ -235,7 +238,8 @@ QImage SurfaceBuffer::image() int stride = wl_shm_buffer_get_stride(m_shmBuffer); int width = wl_shm_buffer_get_width(m_shmBuffer); int height = wl_shm_buffer_get_height(m_shmBuffer); - m_image = QImage(data, width, height, stride, QImage::Format_ARGB32_Premultiplied); + QImage::Format format = QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format(wl_shm_buffer_get_format(m_shmBuffer))); + m_image = QImage(data, width, height, stride, format); } return m_image; diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h index 19f45953d..8e07068bc 100644 --- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h +++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwltextinput.cpp b/src/compositor/wayland_wrapper/qwltextinput.cpp index 9aba674f4..992ca0dc5 100644 --- a/src/compositor/wayland_wrapper/qwltextinput.cpp +++ b/src/compositor/wayland_wrapper/qwltextinput.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwltextinput_p.h b/src/compositor/wayland_wrapper/qwltextinput_p.h index 7bfe6b88c..2618e296a 100644 --- a/src/compositor/wayland_wrapper/qwltextinput_p.h +++ b/src/compositor/wayland_wrapper/qwltextinput_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwltextinputmanager.cpp b/src/compositor/wayland_wrapper/qwltextinputmanager.cpp index 92062944b..ce16f01c9 100644 --- a/src/compositor/wayland_wrapper/qwltextinputmanager.cpp +++ b/src/compositor/wayland_wrapper/qwltextinputmanager.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwltextinputmanager_p.h b/src/compositor/wayland_wrapper/qwltextinputmanager_p.h index 2d9be14da..049929c0c 100644 --- a/src/compositor/wayland_wrapper/qwltextinputmanager_p.h +++ b/src/compositor/wayland_wrapper/qwltextinputmanager_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/src/compositor/wayland_wrapper/qwltouch.cpp b/src/compositor/wayland_wrapper/qwltouch.cpp index 85f065b59..d15988940 100644 --- a/src/compositor/wayland_wrapper/qwltouch.cpp +++ b/src/compositor/wayland_wrapper/qwltouch.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -18,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -90,6 +90,17 @@ void Touch::focusDestroyed(void *data) m_focusResource = 0; } +void Touch::touch_destroy_resource(Resource *resource) +{ + if (m_focusResource == resource) + m_focusResource = 0; +} + +void Touch::touch_release(Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + void Touch::sendCancel() { if (m_focusResource) diff --git a/src/compositor/wayland_wrapper/qwltouch_p.h b/src/compositor/wayland_wrapper/qwltouch_p.h index a6404c36e..403cc3b4e 100644 --- a/src/compositor/wayland_wrapper/qwltouch_p.h +++ b/src/compositor/wayland_wrapper/qwltouch_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -18,8 +18,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -101,6 +101,8 @@ public: private: void focusDestroyed(void *data); + void touch_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void touch_release(Resource *resource) Q_DECL_OVERRIDE; Compositor *m_compositor; diff --git a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp index 5387854a4..25e0419e9 100644 --- a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp +++ b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -43,6 +43,7 @@ #include <wayland_wrapper/qwldisplay_p.h> #include <wayland_wrapper/qwlcompositor_p.h> +#include <compositor_api/qwaylandclient.h> #include <compositor_api/qwaylandcompositor.h> #include <wayland-server.h> @@ -104,7 +105,7 @@ void WindowManagerServerIntegration::windowmanager_open_url(Resource *resource, m_urls.insert(resource, url); else { m_urls.remove(resource); - m_compositor->openUrl(resource->client(), QUrl(url)); + m_compositor->openUrl(QWaylandClient::fromWlClient(resource->client()), QUrl(url)); } } diff --git a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration_p.h b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration_p.h index 4b2a753ee..2575a3d6b 100644 --- a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration_p.h +++ b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** |