diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-07-30 14:53:35 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-08-28 13:09:42 +0200 |
commit | ce58545b220a49354533a27ef79cdbc8d50186cd (patch) | |
tree | 660232f61bc971d68c29b37acfa9c709f617c697 /src/compositor/compositor_api | |
parent | 5edaac978e01ead8648aad91f0d050748f7a8915 (diff) |
Rework how we manage extensions
Change-Id: If2cbf096e7419bc1bda007d5167ce39d1a5d50ae
Diffstat (limited to 'src/compositor/compositor_api')
17 files changed, 44 insertions, 699 deletions
diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri index 656f2e0c5..0cb5392dc 100644 --- a/src/compositor/compositor_api/compositor_api.pri +++ b/src/compositor/compositor_api/compositor_api.pri @@ -12,8 +12,6 @@ HEADERS += \ compositor_api/qwaylandbufferref.h \ compositor_api/qwaylandsurfaceview.h \ compositor_api/qwaylandsurfaceview_p.h \ - compositor_api/qwaylandglobalinterface.h \ - compositor_api/qwaylandsurfaceinterface.h \ compositor_api/qwaylandoutputspace.h \ compositor_api/qwaylandoutputspace_p.h @@ -27,8 +25,6 @@ SOURCES += \ compositor_api/qwaylanddrag.cpp \ compositor_api/qwaylandbufferref.cpp \ compositor_api/qwaylandsurfaceview.cpp \ - compositor_api/qwaylandglobalinterface.cpp \ - compositor_api/qwaylandsurfaceinterface.cpp \ compositor_api/qwaylandoutputspace.cpp QT += core-private diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 0c7342329..cc1826fc7 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -40,7 +40,6 @@ #include "qwaylandclient.h" #include "qwaylandinput.h" #include "qwaylandoutput.h" -#include "qwaylandglobalinterface.h" #include "qwaylandsurfaceview.h" #include "qwaylandclient.h" @@ -48,8 +47,9 @@ #include "wayland_wrapper/qwldatadevice_p.h" #include "wayland_wrapper/qwlsurface_p.h" #include "wayland_wrapper/qwlinputdevice_p.h" -#include "wayland_wrapper/qwlinputpanel_p.h" -#include "wayland_wrapper/qwlshellsurface_p.h" + +#include "extensions/qwlinputpanel_p.h" +#include "extensions/qwlshellsurface_p.h" #include <QtCore/QCoreApplication> #include <QtCore/QStringList> @@ -69,7 +69,6 @@ QWaylandCompositor::QWaylandCompositor(QObject *parent) QWaylandCompositor::~QWaylandCompositor() { - qDeleteAll(m_compositor->m_globals); delete m_compositor; } @@ -111,17 +110,6 @@ QWaylandCompositor::ExtensionFlags QWaylandCompositor::extensionFlags() const return m_compositor->extensions(); } -void QWaylandCompositor::addGlobalInterface(QWaylandGlobalInterface *interface) -{ - wl_global_create(m_compositor->wl_display(), interface->interface(), interface->version(), interface, QtWayland::Compositor::bindGlobal); - m_compositor->m_globals << interface; -} - -void QWaylandCompositor::addDefaultShell() -{ - addGlobalInterface(new QtWayland::Shell); -} - struct wl_display *QWaylandCompositor::waylandDisplay() const { return m_compositor->wl_display(); @@ -311,11 +299,6 @@ QWaylandInputDevice *QWaylandCompositor::defaultInputDevice() const return m_compositor->defaultInputDevice()->handle(); } -QWaylandInputPanel *QWaylandCompositor::inputPanel() const -{ - return m_compositor->inputPanel()->handle(); -} - QWaylandDrag *QWaylandCompositor::drag() const { return m_compositor->defaultInputDevice()->dragHandle(); @@ -346,12 +329,6 @@ void QWaylandCompositor::setCursorSurface(QWaylandSurface *surface, int hotspotX } #endif -void QWaylandCompositor::configureTouchExtension(TouchExtensionFlags flags) -{ - m_compositor->configureTouchExtension(flags); -} - - QWaylandSurfaceView *QWaylandCompositor::createSurfaceView(QWaylandSurface *surface) { QWaylandSurfaceView *view = createView(); diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h index 462f381c6..984624383 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.h +++ b/src/compositor/compositor_api/qwaylandcompositor.h @@ -38,6 +38,7 @@ #define QWAYLANDCOMPOSITOR_H #include <QtCompositor/qwaylandexport.h> +#include <QtCompositor/qwaylandextension.h> #include <QObject> #include <QImage> @@ -55,7 +56,6 @@ class QOpenGLContext; class QWaylandClient; class QWaylandSurface; class QWaylandInputDevice; -class QWaylandInputPanel; class QWaylandDrag; class QWaylandGlobalInterface; class QWaylandSurfaceView; @@ -67,7 +67,7 @@ namespace QtWayland class Compositor; } -class Q_COMPOSITOR_EXPORT QWaylandCompositor : public QObject +class Q_COMPOSITOR_EXPORT QWaylandCompositor : public QObject, public QWaylandExtensionContainer { Q_OBJECT Q_PROPERTY(QByteArray socketName READ socketName WRITE setSocketName) @@ -85,6 +85,7 @@ public: SubSurfaceExtension = 0x10, TextInputExtension = 0x20, HardwareIntegrationExtension = 0x40, + DefaultShellExtension = 0x80, DefaultExtensions = WindowManagerExtension | SurfaceExtension | QtKeyExtension | TouchExtension | HardwareIntegrationExtension }; @@ -102,9 +103,6 @@ public: void setExtensionFlags(ExtensionFlags flags); ExtensionFlags extensionFlags() const; - void addGlobalInterface(QWaylandGlobalInterface *interface); - void addDefaultShell(); - ::wl_display *waylandDisplay() const; Q_INVOKABLE void destroyClientForSurface(QWaylandSurface *surface); @@ -143,7 +141,6 @@ public: QWaylandInputDevice *defaultInputDevice() const; - QWaylandInputPanel *inputPanel() const; QWaylandDrag *drag() const; bool isDragging() const; @@ -156,12 +153,6 @@ public: void cleanupGraphicsResources(); - enum TouchExtensionFlag { - TouchExtMouseFromTouch = 0x01 - }; - Q_DECLARE_FLAGS(TouchExtensionFlags, TouchExtensionFlag) - void configureTouchExtension(TouchExtensionFlags flags); - QWaylandSurfaceView *createSurfaceView(QWaylandSurface *surface); QWaylandInputDevice *inputDeviceFor(QInputEvent *inputEvent); @@ -192,7 +183,6 @@ protected: }; Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandCompositor::ExtensionFlags) -Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandCompositor::TouchExtensionFlags) QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandglobalinterface.cpp b/src/compositor/compositor_api/qwaylandglobalinterface.cpp deleted file mode 100644 index 48f374eb8..000000000 --- a/src/compositor/compositor_api/qwaylandglobalinterface.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandglobalinterface.h" - -#include <wayland-server.h> - -QT_BEGIN_NAMESPACE - -QWaylandGlobalInterface::QWaylandGlobalInterface() -{ - -} - -QWaylandGlobalInterface::~QWaylandGlobalInterface() -{ - -} - -quint32 QWaylandGlobalInterface::version() const -{ - return interface()->version; -} - -QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandglobalinterface.h b/src/compositor/compositor_api/qwaylandglobalinterface.h deleted file mode 100644 index e17b1671e..000000000 --- a/src/compositor/compositor_api/qwaylandglobalinterface.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDGLOBALINTERFACE_H -#define QWAYLANDGLOBALINTERFACE_H - -#include <QtCompositor/qwaylandexport.h> - -struct wl_interface; -struct wl_client; - -QT_BEGIN_NAMESPACE - -namespace QtWayland { -class Compositor; -} - -class Q_COMPOSITOR_EXPORT QWaylandGlobalInterface -{ -public: - QWaylandGlobalInterface(); - virtual ~QWaylandGlobalInterface(); - - virtual const wl_interface *interface() const = 0; - virtual quint32 version() const; - -protected: - virtual void bind(wl_client *client, quint32 version, quint32 id) = 0; - - friend class QtWayland::Compositor; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/compositor/compositor_api/qwaylandinputpanel.cpp b/src/compositor/compositor_api/qwaylandinputpanel.cpp index 8a2330220..a7fa8214d 100644 --- a/src/compositor/compositor_api/qwaylandinputpanel.cpp +++ b/src/compositor/compositor_api/qwaylandinputpanel.cpp @@ -36,6 +36,8 @@ #include "qwaylandinputpanel.h" +#include <QtCompositor/QWaylandCompositor> + #include <private/qobject_p.h> #include "qwlinputpanel_p.h" @@ -43,35 +45,16 @@ QT_BEGIN_NAMESPACE -class QWaylandInputPanelPrivate : public QObjectPrivate -{ -public: - QWaylandInputPanelPrivate(QtWayland::InputPanel *panel) - : inputPanel(panel) - { - } - - QtWayland::InputPanel *inputPanel; -}; - - -QWaylandInputPanel::QWaylandInputPanel(QtWayland::InputPanel *inputPanel) - : QObject(*new QWaylandInputPanelPrivate(inputPanel)) -{ -} - -QtWayland::InputPanel *QWaylandInputPanel::handle() const +QWaylandInputPanel::QWaylandInputPanel(QWaylandCompositor *compositor) + : QWaylandExtensionTemplate(*new QWaylandInputPanelPrivate(compositor->handle())) { - Q_D(const QWaylandInputPanel); - - return d->inputPanel; } QWaylandSurface *QWaylandInputPanel::focus() const { - Q_D(const QWaylandInputPanel); + Q_D(const QWaylandInputPanel); - QtWayland::Surface *surface = d->inputPanel->focus(); + QtWayland::Surface *surface = d->focus(); if (surface) return surface->waylandSurface(); return 0; @@ -81,14 +64,19 @@ bool QWaylandInputPanel::visible() const { Q_D(const QWaylandInputPanel); - return d->inputPanel->inputPanelVisible(); + return d->inputPanelVisible(); } QRect QWaylandInputPanel::cursorRectangle() const { Q_D(const QWaylandInputPanel); - return d->inputPanel->cursorRectangle(); + return d->cursorRectangle(); +} + +QWaylandInputPanel *QWaylandInputPanel::get(QWaylandExtensionContainer *container) +{ + return static_cast<QWaylandInputPanel *>(container->extension(QtWaylandServer::wl_input_panel::name())); } QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandinputpanel.h b/src/compositor/compositor_api/qwaylandinputpanel.h index a4a710fbb..9336b7cad 100644 --- a/src/compositor/compositor_api/qwaylandinputpanel.h +++ b/src/compositor/compositor_api/qwaylandinputpanel.h @@ -38,6 +38,7 @@ #define QWAYLANDINPUTPANEL_H #include <QtCompositor/qwaylandexport.h> +#include <QtCompositor/qwaylandextension.h> #include <QObject> #include <QRect> @@ -52,7 +53,7 @@ namespace QtWayland { class InputPanel; } -class Q_COMPOSITOR_EXPORT QWaylandInputPanel : public QObject +class Q_COMPOSITOR_EXPORT QWaylandInputPanel : public QWaylandExtensionTemplate { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandInputPanel) @@ -62,14 +63,13 @@ class Q_COMPOSITOR_EXPORT QWaylandInputPanel : public QObject Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged) public: - explicit QWaylandInputPanel(QtWayland::InputPanel *inputPanel); - - QtWayland::InputPanel *handle() const; + explicit QWaylandInputPanel(QWaylandCompositor *compositor); QWaylandSurface *focus() const; bool visible() const; QRect cursorRectangle() const; + static QWaylandInputPanel *get(QWaylandExtensionContainer *container); Q_SIGNALS: void focusChanged(); void visibleChanged(); diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp index 39dae9461..75027299b 100644 --- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp @@ -60,6 +60,11 @@ void QWaylandQuickCompositor::create() if (m_initializeLegazyQmlNames) registerLegacyQmlNames(); + if (m_exposeDefaultShell) + setExtensionFlags(extensionFlags() | QWaylandCompositor::DefaultShellExtension); + else + setExtensionFlags(extensionFlags() & !QWaylandCompositor::DefaultShellExtension); + QWaylandCompositor::create(); } @@ -133,8 +138,8 @@ void QWaylandQuickCompositor::classBegin() void QWaylandQuickCompositor::componentComplete() { - if (m_exposeDefaultShell) - addDefaultShell(); + //if (m_exposeDefaultShell) + //addDefaultShell(); } diff --git a/src/compositor/compositor_api/qwaylandquicksurface.cpp b/src/compositor/compositor_api/qwaylandquicksurface.cpp index 96e9ca484..ffa8f437f 100644 --- a/src/compositor/compositor_api/qwaylandquicksurface.cpp +++ b/src/compositor/compositor_api/qwaylandquicksurface.cpp @@ -38,7 +38,6 @@ #include <QOpenGLTexture> #include <QQuickWindow> #include <QDebug> -#include <QQmlPropertyMap> #include "qwaylandquicksurface.h" #include "qwaylandquickcompositor.h" @@ -47,6 +46,9 @@ #include <QtCompositor/qwaylandbufferref.h> #include <QtCompositor/private/qwaylandsurface_p.h> +#include <QtCompositor/private/qwayland-server-surface-extension.h> +#include <QtCompositor/private/qwlextendedsurface_p.h> + QT_BEGIN_NAMESPACE class QWaylandQuickSurfacePrivate : public QWaylandSurfacePrivate @@ -56,14 +58,12 @@ public: : QWaylandSurfacePrivate(client, id, version, c, surf) , compositor(c) , useTextureAlpha(true) - , windowPropertyMap(new QQmlPropertyMap) , clientRenderingEnabled(true) { } ~QWaylandQuickSurfacePrivate() { - windowPropertyMap->deleteLater(); } void surface_commit(Resource *resource) Q_DECL_OVERRIDE @@ -78,18 +78,13 @@ public: QWaylandQuickCompositor *compositor; bool useTextureAlpha; - QQmlPropertyMap *windowPropertyMap; bool clientRenderingEnabled; }; QWaylandQuickSurface::QWaylandQuickSurface(wl_client *client, quint32 id, int version, QWaylandQuickCompositor *compositor) : QWaylandSurface(new QWaylandQuickSurfacePrivate(client, id, version, compositor, this)) { - Q_D(QWaylandQuickSurface); - connect(this, &QWaylandSurface::shellViewCreated, this, &QWaylandQuickSurface::shellViewCreated); connect(this, &QWaylandSurface::primaryOutputChanged, this, &QWaylandQuickSurface::primaryOutputWindowChanged); - connect(this, &QWaylandSurface::windowPropertyChanged, d->windowPropertyMap, &QQmlPropertyMap::insert); - connect(d->windowPropertyMap, &QQmlPropertyMap::valueChanged, this, &QWaylandSurface::setWindowProperty); connect(this, &QWaylandSurface::windowPropertyChanged, d->windowPropertyMap, &QQmlPropertyMap::insert); connect(d->windowPropertyMap, &QQmlPropertyMap::valueChanged, this, &QWaylandSurface::setWindowProperty); @@ -117,17 +112,6 @@ void QWaylandQuickSurface::setUseTextureAlpha(bool useTextureAlpha) } } -QObject *QWaylandQuickSurface::windowPropertyMap() const -{ - Q_D(const QWaylandQuickSurface); - return d->windowPropertyMap; -} - -QWaylandSurfaceItem *QWaylandQuickSurface::shellView() const -{ - return static_cast<QWaylandSurfaceItem *>(QWaylandSurface::shellView()); -} - QWindow *QWaylandQuickSurface::primaryOutputWindow() const { return primaryOutput() ? primaryOutput()->window() : Q_NULLPTR; @@ -185,8 +169,8 @@ void QWaylandQuickSurface::setClientRenderingEnabled(bool enabled) if (d->clientRenderingEnabled != enabled) { d->clientRenderingEnabled = enabled; - sendOnScreenVisibilityChange(enabled); - + if (QWaylandExtension *extension = this->extension(QtWaylandServer::qt_extended_surface::name())) + static_cast<QtWayland::ExtendedSurface*>(extension)->setVisibility(enabled ? QWindow::AutomaticVisibility : QWindow::Hidden); emit clientRenderingEnabledChanged(); } } diff --git a/src/compositor/compositor_api/qwaylandquicksurface.h b/src/compositor/compositor_api/qwaylandquicksurface.h index 7e079471d..03d889e72 100644 --- a/src/compositor/compositor_api/qwaylandquicksurface.h +++ b/src/compositor/compositor_api/qwaylandquicksurface.h @@ -53,8 +53,6 @@ class Q_COMPOSITOR_EXPORT QWaylandQuickSurface : public QWaylandSurface Q_DECLARE_PRIVATE(QWaylandQuickSurface) Q_PROPERTY(bool useTextureAlpha READ useTextureAlpha WRITE setUseTextureAlpha NOTIFY useTextureAlphaChanged) Q_PROPERTY(bool clientRenderingEnabled READ clientRenderingEnabled WRITE setClientRenderingEnabled NOTIFY clientRenderingEnabledChanged) - Q_PROPERTY(QObject *windowProperties READ windowPropertyMap CONSTANT) - Q_PROPERTY(QWaylandSurfaceItem *shellView READ shellView NOTIFY shellViewCreated) Q_PROPERTY(QWindow *primaryOutputWindow READ primaryOutputWindow NOTIFY primaryOutputWindowChanged) public: QWaylandQuickSurface(wl_client *client, quint32 id, int version, QWaylandQuickCompositor *compositor); @@ -66,18 +64,13 @@ public: bool clientRenderingEnabled() const; void setClientRenderingEnabled(bool enabled); - QObject *windowPropertyMap() const; - - QWaylandSurfaceItem *shellView() const; -private: - bool event(QEvent *event) Q_DECL_OVERRIDE; - QWindow *primaryOutputWindow() const; +protected: + bool event(QEvent *event) Q_DECL_OVERRIDE; Q_SIGNALS: void useTextureAlphaChanged(); void clientRenderingEnabledChanged(); - void shellViewCreated(); void primaryOutputWindowChanged(); }; diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index 0f722f334..cc463d08a 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -40,19 +40,18 @@ #include <private/qobject_p.h> #include "wayland_wrapper/qwlsurface_p.h" -#include "wayland_wrapper/qwlextendedsurface_p.h" -#include "wayland_wrapper/qwlsubsurface_p.h" #include "wayland_wrapper/qwlcompositor_p.h" -#include "wayland_wrapper/qwlshellsurface_p.h" #include "wayland_wrapper/qwlinputdevice_p.h" #include "wayland_wrapper/qwldatadevice_p.h" #include "wayland_wrapper/qwldatadevicemanager_p.h" +#include "extensions/qwlextendedsurface_p.h" +#include "extensions/qwlsubsurface_p.h" + #include "qwaylandcompositor.h" #include "qwaylandclient.h" #include "qwaylandsurface_p.h" #include "qwaylandbufferref.h" -#include "qwaylandsurfaceinterface.h" #include "qwaylandoutput.h" #include <QtGui/QGuiApplication> @@ -136,14 +135,13 @@ QWaylandSurface::QWaylandSurface(wl_client *client, quint32 id, int version, QWa } QWaylandSurface::QWaylandSurface(QWaylandSurfacePrivate *dptr) - : QObject(*dptr) + : QObject(*dptr) { } QWaylandSurface::~QWaylandSurface() { Q_D(QWaylandSurface); - qDeleteAll(d->interfaces); d->m_compositor->unregisterSurface(this); d->notifyViewsAboutDestruction(); } @@ -160,7 +158,7 @@ QWaylandSurface *QWaylandSurface::parentSurface() const { Q_D(const QWaylandSurface); if (d->subSurface() && d->subSurface()->parent()) { - return d->subSurface()->parent()->waylandSurface(); + return d->subSurface()->parent()->surface(); } return 0; } @@ -174,18 +172,6 @@ QLinkedList<QWaylandSurface *> QWaylandSurface::subSurfaces() const return QLinkedList<QWaylandSurface *>(); } -void QWaylandSurface::addInterface(QWaylandSurfaceInterface *iface) -{ - Q_D(QWaylandSurface); - d->interfaces.prepend(iface); -} - -void QWaylandSurface::removeInterface(QWaylandSurfaceInterface *iface) -{ - Q_D(QWaylandSurface); - d->interfaces.removeOne(iface); -} - bool QWaylandSurface::visible() const { return isMapped(); @@ -203,44 +189,12 @@ QSize QWaylandSurface::size() const return d->size(); } -void QWaylandSurface::requestSize(const QSize &size) -{ - Q_D(QWaylandSurface); - QWaylandSurfaceResizeOp op(size); - if (!sendInterfaceOp(op)) { - int id = wl_resource_get_id(d->resource()->handle); - qWarning("No surface interface forwarded the resize request for this surface (wl_surface@%d).", id); - } -} - -Qt::ScreenOrientations QWaylandSurface::orientationUpdateMask() const -{ - Q_D(const QWaylandSurface); - if (!d->extendedSurface()) - return Qt::PrimaryOrientation; - return d->extendedSurface()->contentOrientationMask(); -} - Qt::ScreenOrientation QWaylandSurface::contentOrientation() const { Q_D(const QWaylandSurface); return d->contentOrientation(); } -QWaylandSurface::WindowFlags QWaylandSurface::windowFlags() const -{ - Q_D(const QWaylandSurface); - if (!d->extendedSurface()) - return QWaylandSurface::WindowFlags(0); - return d->extendedSurface()->windowFlags(); -} - -QWaylandSurface::WindowType QWaylandSurface::windowType() const -{ - Q_D(const QWaylandSurface); - return d->windowType; -} - QWaylandSurface::Origin QWaylandSurface::origin() const { Q_D(const QWaylandSurface); @@ -265,24 +219,6 @@ QtWayland::Surface * QWaylandSurface::handle() return d; } -QVariantMap QWaylandSurface::windowProperties() const -{ - Q_D(const QWaylandSurface); - if (!d->extendedSurface()) - return QVariantMap(); - - return d->extendedSurface()->windowProperties(); -} - -void QWaylandSurface::setWindowProperty(const QString &name, const QVariant &value) -{ - Q_D(QWaylandSurface); - if (!d->extendedSurface()) - return; - - d->extendedSurface()->setWindowProperty(name, value); -} - QWaylandCompositor *QWaylandSurface::compositor() const { Q_D(const QWaylandSurface); @@ -303,63 +239,12 @@ void QWaylandSurface::setPrimaryOutput(QWaylandOutput *output) d->setPrimaryOutput(output->handle()); } -QWindow::Visibility QWaylandSurface::visibility() const -{ - Q_D(const QWaylandSurface); - return d->m_visibility; -} - -void QWaylandSurface::setVisibility(QWindow::Visibility v) -{ - Q_D(QWaylandSurface); - if (v == visibility()) - return; - - d->m_visibility = v; - QWaylandSurfaceSetVisibilityOp op(v); - sendInterfaceOp(op); - - emit visibilityChanged(); -} - -QWaylandSurfaceView *QWaylandSurface::shellView() const -{ - Q_D(const QWaylandSurface); - return d->shellSurface() ? d->shellSurface()->view() : Q_NULLPTR; -} - -bool QWaylandSurface::sendInterfaceOp(QWaylandSurfaceOp &op) -{ - Q_D(QWaylandSurface); - foreach (QWaylandSurfaceInterface *iface, d->interfaces) { - if (iface->runOperation(&op)) - return true; - } - return false; -} - -void QWaylandSurface::ping() -{ - Q_D(QWaylandSurface); - uint32_t serial = wl_display_next_serial(compositor()->waylandDisplay()); - QWaylandSurfacePingOp op(serial); - if (!sendInterfaceOp(op)) { - int id = wl_resource_get_id(d->resource()->handle); - qWarning("No surface interface forwarded the ping for this surface (wl_surface@%d).", id); - } -} - void QWaylandSurface::sendFrameCallbacks() { Q_D(QWaylandSurface); d->sendFrameCallback(); } -void QWaylandSurface::sendOnScreenVisibilityChange(bool visible) -{ - setVisibility(visible ? QWindow::AutomaticVisibility : QWindow::Hidden); -} - QString QWaylandSurface::className() const { Q_D(const QWaylandSurface); @@ -399,13 +284,6 @@ void QWaylandSurface::destroy() deref(); } -void QWaylandSurface::destroySurface() -{ - QWaylandSurfaceOp op(QWaylandSurfaceOp::Close); - if (!sendInterfaceOp(op)) - emit surfaceDestroyed(); -} - void QWaylandSurface::enter(QWaylandOutput *output) { Q_D(QWaylandSurface); @@ -465,12 +343,6 @@ QList<QWaylandSurfaceView *> QWaylandSurface::views() const return d->views; } -QList<QWaylandSurfaceInterface *> QWaylandSurface::interfaces() const -{ - Q_D(const QWaylandSurface); - return d->interfaces; -} - QWaylandSurface *QWaylandSurface::fromResource(::wl_resource *res) { QtWayland::Surface *s = QtWayland::Surface::fromResource(res); @@ -502,15 +374,6 @@ void QWaylandSurfacePrivate::setClassName(const QString &className) } } -void QWaylandSurfacePrivate::setType(QWaylandSurface::WindowType type) -{ - Q_Q(QWaylandSurface); - if (windowType != type) { - windowType = type; - emit q->windowTypeChanged(type); - } -} - void QWaylandSurfacePrivate::refView(QWaylandSurfaceView *view) { if (views.contains(view)) diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h index 30005e3f7..96be55f7d 100644 --- a/src/compositor/compositor_api/qwaylandsurface.h +++ b/src/compositor/compositor_api/qwaylandsurface.h @@ -39,6 +39,7 @@ #define QWAYLANDSURFACE_H #include <QtCompositor/qwaylandexport.h> +#include <QtCompositor/qwaylandextension.h> #include <QtCore/QScopedPointer> #include <QtGui/QImage> @@ -56,7 +57,6 @@ class QWaylandSurfacePrivate; class QWaylandCompositor; class QWaylandBufferRef; class QWaylandSurfaceView; -class QWaylandSurfaceInterface; class QWaylandSurfaceOp; class QWaylandOutput; @@ -98,42 +98,21 @@ private: QWaylandSurfaceLeaveEventPrivate *d; }; -class Q_COMPOSITOR_EXPORT QWaylandSurface : public QObject +class Q_COMPOSITOR_EXPORT QWaylandSurface : public QObject, public QWaylandExtensionContainer { 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) Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation NOTIFY contentOrientationChanged) Q_PROPERTY(QString className READ className NOTIFY classNameChanged) Q_PROPERTY(QString title READ title NOTIFY titleChanged) - Q_PROPERTY(Qt::ScreenOrientations orientationUpdateMask READ orientationUpdateMask NOTIFY orientationUpdateMaskChanged) - Q_PROPERTY(QWindow::Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged) Q_PROPERTY(QWaylandSurface *transientParent READ transientParent) Q_PROPERTY(QPointF transientOffset READ transientOffset) Q_PROPERTY(QWaylandOutput *primaryOutput READ primaryOutput WRITE setPrimaryOutput NOTIFY primaryOutputChanged) Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged); - Q_ENUMS(WindowFlag WindowType) - Q_FLAGS(WindowFlag WindowFlags) - public: - enum WindowFlag { - OverridesSystemGestures = 0x0001, - StaysOnTop = 0x0002, - BypassWindowManager = 0x0004 - }; - Q_DECLARE_FLAGS(WindowFlags, WindowFlag) - - enum WindowType { - None, - Toplevel, - Transient, - Popup - }; - enum Origin { OriginTopLeft, OriginBottomLeft @@ -146,27 +125,16 @@ public: QWaylandSurface *parentSurface() const; QLinkedList<QWaylandSurface *> subSurfaces() const; - void addInterface(QWaylandSurfaceInterface *interface); - void removeInterface(QWaylandSurfaceInterface *interface); bool visible() const; bool isMapped() const; QSize size() const; - Q_INVOKABLE void requestSize(const QSize &size); - Qt::ScreenOrientations orientationUpdateMask() const; Qt::ScreenOrientation contentOrientation() const; - WindowFlags windowFlags() const; - - WindowType windowType() const; Origin origin() const; - QWindow::Visibility visibility() const; - void setVisibility(QWindow::Visibility visibility); - Q_INVOKABLE void sendOnScreenVisibilityChange(bool visible); // Compat - QWaylandSurface *transientParent() const; QPointF transientOffset() const; @@ -174,8 +142,6 @@ public: QtWayland::Surface *handle(); QByteArray authenticationToken() const; - QVariantMap windowProperties() const; - void setWindowProperty(const QString &name, const QVariant &value); QWaylandCompositor *compositor() const; @@ -193,8 +159,6 @@ public: bool inputRegionContains(const QPoint &p) const; Q_INVOKABLE void destroy(); - Q_INVOKABLE void destroySurface(); - Q_INVOKABLE void ping(); Q_INVOKABLE void sendFrameCallbacks(); @@ -203,11 +167,6 @@ public: void setMapped(bool mapped); QList<QWaylandSurfaceView *> views() const; - QList<QWaylandSurfaceInterface *> interfaces() const; - - QWaylandSurfaceView *shellView() const; - - bool sendInterfaceOp(QWaylandSurfaceOp &op); static QWaylandSurface *fromResource(::wl_resource *resource); @@ -227,27 +186,20 @@ Q_SIGNALS: void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent); void sizeChanged(); void offsetForNextFrame(const QPoint &offset); - void windowPropertyChanged(const QString &name, const QVariant &value); - void windowFlagsChanged(WindowFlags flags); - void windowTypeChanged(WindowType type); void contentOrientationChanged(); - void orientationUpdateMaskChanged(); void extendedSurfaceReady(); void classNameChanged(); void titleChanged(); void raiseRequested(); void lowerRequested(); - void visibilityChanged(); void pong(); void surfaceDestroyed(); - void shellViewCreated(); void primaryOutputChanged(QWaylandOutput *newOutput, QWaylandOutput *oldOutput); void originChanged(); void configure(bool hasBuffer); void redraw(); - friend class QWaylandSurfaceInterface; friend class QtWayland::Surface; }; diff --git a/src/compositor/compositor_api/qwaylandsurface_p.h b/src/compositor/compositor_api/qwaylandsurface_p.h index bef6a49e0..683c50654 100644 --- a/src/compositor/compositor_api/qwaylandsurface_p.h +++ b/src/compositor/compositor_api/qwaylandsurface_p.h @@ -56,7 +56,6 @@ class Q_COMPOSITOR_EXPORT QWaylandSurfacePrivate : public QObjectPrivate, public public: static QWaylandSurfacePrivate *get(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); void refView(QWaylandSurfaceView *view); @@ -67,9 +66,7 @@ public: QWaylandClient *client; - QWaylandSurface::WindowType windowType; QList<QWaylandSurfaceView *> views; - QList<QWaylandSurfaceInterface *> interfaces; }; QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp b/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp deleted file mode 100644 index b20d70613..000000000 --- a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <wayland-server.h> - -#include "qwaylandsurfaceinterface.h" -#include "qwaylandsurface.h" -#include "qwaylandsurface_p.h" - -class QWaylandSurfaceInterface::Private -{ -public: - QWaylandSurface *surface; -}; - -QWaylandSurfaceInterface::QWaylandSurfaceInterface(QWaylandSurface *surface) - : d(new Private) -{ - d->surface = surface; - surface->addInterface(this); -} - -QWaylandSurfaceInterface::~QWaylandSurfaceInterface() -{ - d->surface->removeInterface(this); - delete d; -} - -QWaylandSurface *QWaylandSurfaceInterface::surface() const -{ - return d->surface; -} - -void QWaylandSurfaceInterface::setSurfaceType(QWaylandSurface::WindowType type) -{ - surface()->d_func()->setType(type); -} - -void QWaylandSurfaceInterface::setSurfaceClassName(const QString &name) -{ - surface()->d_func()->setClassName(name); -} - -void QWaylandSurfaceInterface::setSurfaceTitle(const QString &title) -{ - surface()->d_func()->setTitle(title); -} - - - -class QWaylandSurfaceOp::Private -{ -public: - int type; -}; - -QWaylandSurfaceOp::QWaylandSurfaceOp(int t) - : d(new Private) -{ - d->type = t; -} - -QWaylandSurfaceOp::~QWaylandSurfaceOp() -{ - delete d; -} - -int QWaylandSurfaceOp::type() const -{ - return d->type; -} - - - -QWaylandSurfaceSetVisibilityOp::QWaylandSurfaceSetVisibilityOp(QWindow::Visibility visibility) - : QWaylandSurfaceOp(QWaylandSurfaceOp::SetVisibility) - , m_visibility(visibility) -{ -} - -QWindow::Visibility QWaylandSurfaceSetVisibilityOp::visibility() const -{ - return m_visibility; -} - -QWaylandSurfaceResizeOp::QWaylandSurfaceResizeOp(const QSize &size) - : QWaylandSurfaceOp(QWaylandSurfaceOp::Resize) - , m_size(size) -{ -} - -QSize QWaylandSurfaceResizeOp::size() const -{ - return m_size; -} - -QWaylandSurfacePingOp::QWaylandSurfacePingOp(uint32_t serial) - : QWaylandSurfaceOp(QWaylandSurfaceOp::Ping) - , m_serial(serial) -{ -} - -uint32_t QWaylandSurfacePingOp::serial() const -{ - return m_serial; -} diff --git a/src/compositor/compositor_api/qwaylandsurfaceinterface.h b/src/compositor/compositor_api/qwaylandsurfaceinterface.h deleted file mode 100644 index 89d5772b6..000000000 --- a/src/compositor/compositor_api/qwaylandsurfaceinterface.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDSURFACEINTERFACE_H -#define QWAYLANDSURFACEINTERFACE_H - -#include <QWindow> - -#include <QtCompositor/qwaylandsurface.h> -#include <QtCompositor/qwaylandexport.h> - -QT_BEGIN_NAMESPACE - -class QWaylandSurface; - -class Q_COMPOSITOR_EXPORT QWaylandSurfaceOp -{ -public: - enum Type { - Close, - SetVisibility, - Resize, - Ping, - UserType = 1000 - }; - - QWaylandSurfaceOp(int t); - virtual ~QWaylandSurfaceOp(); - - int type() const; - -private: - class Private; - Private *const d; -}; - -class Q_COMPOSITOR_EXPORT QWaylandSurfaceSetVisibilityOp : public QWaylandSurfaceOp -{ -public: - QWaylandSurfaceSetVisibilityOp(QWindow::Visibility visibility); - QWindow::Visibility visibility() const; - -private: - QWindow::Visibility m_visibility; -}; - -class Q_COMPOSITOR_EXPORT QWaylandSurfaceResizeOp : public QWaylandSurfaceOp -{ -public: - QWaylandSurfaceResizeOp(const QSize &size); - QSize size() const; - -private: - QSize m_size; -}; - -class Q_COMPOSITOR_EXPORT QWaylandSurfacePingOp : public QWaylandSurfaceOp -{ -public: - QWaylandSurfacePingOp(quint32 serial); - quint32 serial() const; - -private: - quint32 m_serial; -}; - -class Q_COMPOSITOR_EXPORT QWaylandSurfaceInterface -{ -public: - QWaylandSurfaceInterface(QWaylandSurface *surf); - virtual ~QWaylandSurfaceInterface(); - - QWaylandSurface *surface() const; - -protected: - virtual bool runOperation(QWaylandSurfaceOp *op) = 0; - - void setSurfaceType(QWaylandSurface::WindowType type); - void setSurfaceClassName(const QString &name); - void setSurfaceTitle(const QString &title); - -private: - class Private; - Private *const d; - friend class QWaylandSurface; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp index c690521ba..3b0ec3a3e 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp @@ -408,16 +408,6 @@ void QWaylandSurfaceItem::updateSize() } } -void QWaylandSurfaceItem::geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry) -{ - QQuickItem::geometryChanged(newGeometry, oldGeometry); - - if (surface() && m_resizeSurfaceToItem) { - surface()->requestSize(newGeometry.size().toSize()); - } -} - void QWaylandSurfaceItem::setRequestedPosition(const QPointF &pos) { bool xChanged = pos.x() != requestedPosition().x(); diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.h b/src/compositor/compositor_api/qwaylandsurfaceitem.h index c8eea8973..a06f4534c 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.h +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.h @@ -123,8 +123,6 @@ protected: void waylandSurfaceChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface) Q_DECL_OVERRIDE; void waylandSurfaceDestroyed() Q_DECL_OVERRIDE; - void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry) Q_DECL_OVERRIDE; public Q_SLOTS: virtual void takeFocus(QWaylandInputDevice *device = 0); void setPaintEnabled(bool paintEnabled); |