summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandquickoutput.cpp
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/qwaylandquickoutput.cpp
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/qwaylandquickoutput.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickoutput.cpp b/src/compositor/compositor_api/qwaylandquickoutput.cpp
new file mode 100644
index 000000000..6dfe1e04d
--- /dev/null
+++ b/src/compositor/compositor_api/qwaylandquickoutput.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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.
+**
+** 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
+** 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 "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;
+ frameStarted();
+ compositor()->cleanupGraphicsResources();
+}
+
+QT_END_NAMESPACE