summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandoutput.h
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2013-08-26 08:18:56 +0200
committerPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2015-02-08 10:35:22 +0000
commitb09f2e8440b7a0c9532d730d52296cf05b944ee2 (patch)
treef70d559074195c454f31d0e48292e8b43bae0eb2 /src/compositor/compositor_api/qwaylandoutput.h
parent2322ef51948ef20afb3a93d1fea7830dfee4f7d6 (diff)
Add QWaylandOutput to support multiple outputs
Add a new QWaylandOutput class to support multiple outputs. Each QWaylandOutput need a window for rendering. Rename OutputGlobal to Output and Output to OutputResource. Add support for physical size, mode and available geometry. Use better defaults for geometry and refreshRate from the QWindow if available. A window is no longer passed to QWaylandCompositor constructor and all output related methods are removed, however one or more outputs are required for hardware integration. QWaylandCompositor returns a list of outputs and offers an API to add or remove outputs. Hardware integrations can run headless. Change-Id: I742996571ddb78328f7bfa4f79b25a81995279e1 Done-with: Jan Arne Petersen <jan.petersen@kdab.com> Done-with: Jørgen Lind <jorgen.lind@theqtcompany.com> Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandoutput.h')
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.h164
1 files changed, 164 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandoutput.h b/src/compositor/compositor_api/qwaylandoutput.h
new file mode 100644
index 000000000..5c31be9df
--- /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-project.org/legal
+**
+** 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 Digia Plc and its Subsidiary(-ies) 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