diff options
Diffstat (limited to 'src/compositor/compositor_api/qwaylandcompositor.h')
-rw-r--r-- | src/compositor/compositor_api/qwaylandcompositor.h | 185 |
1 files changed, 74 insertions, 111 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h index 1817fa07d..cae7b4582 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.h +++ b/src/compositor/compositor_api/qwaylandcompositor.h @@ -3,36 +3,32 @@ ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Compositor. +** This file is part of the QtWaylandCompositor module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $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. ** -** "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. +** 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. ** -** -** 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." +** 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$ ** @@ -41,7 +37,9 @@ #ifndef QWAYLANDCOMPOSITOR_H #define QWAYLANDCOMPOSITOR_H -#include <QtCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qwaylandexport.h> +#include <QtWaylandCompositor/qwaylandextension.h> +#include <QtWaylandCompositor/QWaylandOutput> #include <QObject> #include <QImage> @@ -56,124 +54,89 @@ class QInputEvent; class QMimeData; class QUrl; class QOpenGLContext; +class QWaylandCompositorPrivate; class QWaylandClient; class QWaylandSurface; class QWaylandInputDevice; -class QWaylandInputPanel; -class QWaylandDrag; class QWaylandGlobalInterface; -class QWaylandSurfaceView; -class QWaylandOutput; +class QWaylandView; +class QWaylandPointer; +class QWaylandKeyboard; +class QWaylandTouch; -namespace QtWayland +class Q_COMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject { - class Compositor; -} + Q_OBJECT + Q_DECLARE_PRIVATE(QWaylandCompositor) + Q_PROPERTY(QByteArray socketName READ socketName WRITE setSocketName) + Q_PROPERTY(bool retainedSelection READ retainedSelectionEnabled WRITE setRetainedSelectionEnabled) + Q_PROPERTY(QWaylandOutput *defaultOutput READ defaultOutput WRITE setDefaultOutput NOTIFY defaultOutputChanged) + Q_PROPERTY(bool useHardwareIntegrationExtension READ useHardwareIntegrationExtension WRITE setUseHardwareIntegrationExtension NOTIFY useHardwareIntegrationExtensionChanged) + Q_PROPERTY(QWaylandInputDevice *defaultInputDevice READ defaultInputDevice NOTIFY defaultInputDeviceChanged) -class Q_COMPOSITOR_EXPORT QWaylandCompositor -{ public: - enum ExtensionFlag { - WindowManagerExtension = 0x01, - SurfaceExtension = 0x02, - QtKeyExtension = 0x04, - TouchExtension = 0x08, - SubSurfaceExtension = 0x10, - TextInputExtension = 0x20, - HardwareIntegrationExtension = 0x40, - - DefaultExtensions = WindowManagerExtension | SurfaceExtension | QtKeyExtension | TouchExtension | HardwareIntegrationExtension - }; - Q_DECLARE_FLAGS(ExtensionFlags, ExtensionFlag) - - QWaylandCompositor(const char *socketName = 0, ExtensionFlags extensions = DefaultExtensions); + QWaylandCompositor(QObject *parent = 0); virtual ~QWaylandCompositor(); - void addGlobalInterface(QWaylandGlobalInterface *interface); - void addDefaultShell(); - ::wl_display *waylandDisplay() const; - - void frameStarted(); - void sendFrameCallbacks(QList<QWaylandSurface *> visibleSurfaces); + virtual void create(); + bool isCreated() const; - void destroyClientForSurface(QWaylandSurface *surface); - void destroyClient(QWaylandClient *client); - - QList<QWaylandSurface *> surfacesForClient(QWaylandClient* client) const; - QList<QWaylandSurface *> surfaces() const; + void setSocketName(const QByteArray &name); + QByteArray socketName() const; - QList<QWaylandOutput *> outputs() const; - QWaylandOutput *output(QWindow *window); + ::wl_display *display() const; + uint32_t nextSerial(); - QWaylandOutput *primaryOutput() const; - void setPrimaryOutput(QWaylandOutput *output); + QList<QWaylandClient *>clients() const; + Q_INVOKABLE void destroyClientForSurface(QWaylandSurface *surface); + Q_INVOKABLE void destroyClient(QWaylandClient *client); - virtual void surfaceCreated(QWaylandSurface *surface) = 0; - virtual void surfaceAboutToBeDestroyed(QWaylandSurface *surface); + QList<QWaylandSurface *> surfaces() const; + QList<QWaylandSurface *> surfacesForClient(QWaylandClient* client) const; - virtual QWaylandSurfaceView *pickView(const QPointF &globalPosition) const; - virtual QPointF mapToView(QWaylandSurfaceView *view, const QPointF &surfacePosition) const; + Q_INVOKABLE QWaylandOutput *outputFor(QWindow *window) const; - virtual bool openUrl(QWaylandClient *client, const QUrl &url); + QWaylandOutput *defaultOutput() const; + void setDefaultOutput(QWaylandOutput *output); + QList<QWaylandOutput *> outputs() const; - QtWayland::Compositor *handle() const; + uint currentTimeMsecs() const; void setRetainedSelectionEnabled(bool enabled); bool retainedSelectionEnabled() const; void overrideSelection(const QMimeData *data); - void setClientFullScreenHint(bool value); - - const char *socketName() const; - -#if QT_DEPRECATED_SINCE(5, 5) - void setScreenOrientation(Qt::ScreenOrientation orientation); - - void setOutputGeometry(const QRect &outputGeometry); - QRect outputGeometry() const; - - void setOutputRefreshRate(int refreshRate); - int outputRefreshRate() const; -#endif - QWaylandInputDevice *defaultInputDevice() const; - QWaylandInputPanel *inputPanel() const; - QWaylandDrag *drag() const; + QWaylandView *createSurfaceView(QWaylandSurface *surface); - bool isDragging() const; - void sendDragMoveEvent(const QPoint &global, const QPoint &local, QWaylandSurface *surface); - void sendDragEndEvent(); - - virtual void setCursorSurface(QWaylandSurface *surface, int hotspotX, int hotspotY); + QWaylandInputDevice *inputDeviceFor(QInputEvent *inputEvent); - void cleanupGraphicsResources(); + bool useHardwareIntegrationExtension() const; + void setUseHardwareIntegrationExtension(bool use); - enum TouchExtensionFlag { - TouchExtMouseFromTouch = 0x01 - }; - Q_DECLARE_FLAGS(TouchExtensionFlags, TouchExtensionFlag) - void configureTouchExtension(TouchExtensionFlags flags); +public Q_SLOTS: + void processWaylandEvents(); - virtual QWaylandSurfaceView *createView(QWaylandSurface *surface); +Q_SIGNALS: + void createSurface(QWaylandClient *client, uint id, int version); + void surfaceCreated(QWaylandSurface *surface); + void surfaceAboutToBeDestroyed(QWaylandSurface *surface); - QWaylandInputDevice *inputDeviceFor(QInputEvent *inputEvent); + void defaultOutputChanged(); + void defaultInputDeviceChanged(); + void useHardwareIntegrationExtensionChanged(); protected: - QWaylandCompositor(const char *socketName, QtWayland::Compositor *dptr); virtual void retainedSelectionReceived(QMimeData *mimeData); + virtual QWaylandInputDevice *createInputDevice(); + virtual QWaylandPointer *createPointerDevice(QWaylandInputDevice *inputDevice); + virtual QWaylandKeyboard *createKeyboardDevice(QWaylandInputDevice *inputDevice); + virtual QWaylandTouch *createTouchDevice(QWaylandInputDevice *inputDevice); - virtual QWaylandOutput *createOutput(QWindow *window, - const QString &manufacturer, - const QString &model); - - friend class QtWayland::Compositor; - QtWayland::Compositor *m_compositor; + QWaylandCompositor(QWaylandCompositorPrivate &dptr, QObject *parent = 0); }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandCompositor::ExtensionFlags) -Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandCompositor::TouchExtensionFlags) - QT_END_NAMESPACE #endif // QWAYLANDCOMPOSITOR_H |