summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandoutput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/compositor_api/qwaylandoutput.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.cpp91
1 files changed, 36 insertions, 55 deletions
diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp
index 1f34f4eac..c19e2bd94 100644
--- a/src/compositor/compositor_api/qwaylandoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandoutput.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandoutput.h"
#include "qwaylandoutput_p.h"
@@ -47,6 +11,8 @@
#include <QtWaylandCompositor/private/qwaylandsurface_p.h>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
#include <QtWaylandCompositor/private/qwaylandview_p.h>
+#include <QtWaylandCompositor/private/qwaylandutils_p.h>
+#include <QtWaylandCompositor/private/qwaylandxdgoutputv1_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QtMath>
@@ -161,6 +127,9 @@ void QWaylandOutputPrivate::sendGeometryInfo()
if (resource->version() >= 2)
send_done(resource->handle);
}
+
+ if (xdgOutput)
+ QWaylandXdgOutputV1Private::get(xdgOutput)->sendDone();
}
void QWaylandOutputPrivate::sendMode(const Resource *resource, const QWaylandOutputMode &mode)
@@ -184,6 +153,9 @@ void QWaylandOutputPrivate::sendModesInfo()
if (resource->version() >= 2)
send_done(resource->handle);
}
+
+ if (xdgOutput)
+ QWaylandXdgOutputV1Private::get(xdgOutput)->sendDone();
}
void QWaylandOutputPrivate::handleWindowPixelSizeChanged()
@@ -251,6 +223,7 @@ QWaylandOutput::QWaylandOutput()
/*!
\qmltype WaylandOutput
+ \instantiates QWaylandOutput
\inqmlmodule QtWayland.Compositor
\since 5.8
\brief Provides access to a displayable area managed by the compositor.
@@ -260,6 +233,9 @@ QWaylandOutput::QWaylandOutput()
a screen managed by the WaylandCompositor.
The type corresponds to the \c wl_output interface in the Wayland protocol.
+
+ \note If the compositor has multiple Wayland outputs, the \l Qt::AA_ShareOpenGLContexts
+ attribute must be set before the \l QGuiApplication object is constructed.
*/
/*!
@@ -350,8 +326,8 @@ void QWaylandOutput::initialize()
*/
QWaylandOutput *QWaylandOutput::fromResource(wl_resource *resource)
{
- if (auto *r = QWaylandOutputPrivate::Resource::fromResource(resource))
- return static_cast<QWaylandOutputPrivate *>(r->output_object)->q_func();
+ if (auto p = QtWayland::fromResource<QWaylandOutputPrivate *>(resource))
+ return p->q_func();
return nullptr;
}
@@ -382,7 +358,7 @@ void QWaylandOutput::update()
}
/*!
- * \qmlproperty WaylandCompositor QtWaylandCompositor::WaylandOutput::compositor
+ * \qmlproperty WaylandCompositor QtWayland.Compositor::WaylandOutput::compositor
*
* This property holds the compositor displaying content on this WaylandOutput.
*
@@ -422,7 +398,7 @@ void QWaylandOutput::setCompositor(QWaylandCompositor *compositor)
}
/*!
- * \qmlproperty string QtWaylandCompositor::WaylandOutput::manufacturer
+ * \qmlproperty string QtWayland.Compositor::WaylandOutput::manufacturer
*
* This property holds a textual description of the manufacturer of this WaylandOutput.
*/
@@ -450,7 +426,7 @@ void QWaylandOutput::setManufacturer(const QString &manufacturer)
}
/*!
- * \qmlproperty string QtWaylandCompositor::WaylandOutput::model
+ * \qmlproperty string QtWayland.Compositor::WaylandOutput::model
*
* This property holds a textual description of the model of this WaylandOutput.
*/
@@ -478,7 +454,7 @@ void QWaylandOutput::setModel(const QString &model)
}
/*!
- * \qmlproperty point QtWaylandCompositor::WaylandOutput::position
+ * \qmlproperty point QtWayland.Compositor::WaylandOutput::position
*
* This property holds the position of this WaylandOutput in the compositor's coordinate system.
*/
@@ -530,7 +506,8 @@ void QWaylandOutput::addMode(const QWaylandOutputMode &mode, bool preferred)
return;
}
- d->modes.append(mode);
+ if (d->modes.indexOf(mode) < 0)
+ d->modes.append(mode);
if (preferred)
d->preferredMode = d->modes.indexOf(mode);
@@ -582,7 +559,7 @@ void QWaylandOutput::setCurrentMode(const QWaylandOutputMode &mode)
}
/*!
- * \qmlproperty rect QtWaylandCompositor::WaylandOutput::geometry
+ * \qmlproperty rect QtWayland.Compositor::WaylandOutput::geometry
*
* This property holds the geometry of the WaylandOutput.
*/
@@ -601,7 +578,7 @@ QRect QWaylandOutput::geometry() const
}
/*!
- * \qmlproperty rect QtWaylandCompositor::WaylandOutput::availableGeometry
+ * \qmlproperty rect QtWayland.Compositor::WaylandOutput::availableGeometry
*
* This property holds the geometry of the WaylandOutput available for displaying content.
* The available geometry is in output coordinates space, starts from 0,0 and it's as big
@@ -644,7 +621,7 @@ void QWaylandOutput::setAvailableGeometry(const QRect &availableGeometry)
}
/*!
- * \qmlproperty size QtWaylandCompositor::WaylandOutput::physicalSize
+ * \qmlproperty size QtWayland.Compositor::WaylandOutput::physicalSize
*
* This property holds the physical size of the WaylandOutput in millimeters.
*
@@ -692,7 +669,7 @@ void QWaylandOutput::setPhysicalSize(const QSize &size)
*/
/*!
- * \qmlproperty enum QtWaylandCompositor::WaylandOutput::subpixel
+ * \qmlproperty enum QtWayland.Compositor::WaylandOutput::subpixel
*
* This property holds the subpixel arrangement of this WaylandOutput.
*
@@ -749,7 +726,7 @@ void QWaylandOutput::setSubpixel(const Subpixel &subpixel)
*/
/*!
- * \qmlproperty enum QtWaylandCompositor::WaylandOutput::transform
+ * \qmlproperty enum QtWayland.Compositor::WaylandOutput::transform
*
* This property holds the transformation that the QWaylandCompositor applies to a surface
* to compensate for the orientation of the QWaylandOutput.
@@ -795,7 +772,7 @@ void QWaylandOutput::setTransform(const Transform &transform)
}
/*!
- * \qmlproperty int QtWaylandCompositor::WaylandOutput::scaleFactor
+ * \qmlproperty int QtWayland.Compositor::WaylandOutput::scaleFactor
*
* This property holds the factor by which the WaylandCompositor scales surface buffers
* before they are displayed. It is used on high density output devices where unscaled content
@@ -830,7 +807,8 @@ void QWaylandOutput::setScaleFactor(int scale)
d->scaleFactor = scale;
- Q_FOREACH (QWaylandOutputPrivate::Resource *resource, d->resourceMap().values()) {
+ const auto resMap = d->resourceMap();
+ for (QWaylandOutputPrivate::Resource *resource : resMap) {
if (resource->version() >= 2) {
d->send_scale(resource->handle, scale);
d->send_done(resource->handle);
@@ -838,10 +816,13 @@ void QWaylandOutput::setScaleFactor(int scale)
}
Q_EMIT scaleFactorChanged();
+
+ if (d->xdgOutput)
+ QWaylandXdgOutputV1Private::get(d->xdgOutput)->sendDone();
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandOutput::sizeFollowsWindow
+ * \qmlproperty bool QtWayland.Compositor::WaylandOutput::sizeFollowsWindow
*
* This property controls whether the size of the WaylandOutput matches the
* size of its window.
@@ -879,7 +860,7 @@ void QWaylandOutput::setSizeFollowsWindow(bool follow)
}
/*!
- * \qmlproperty Window QtWaylandCompositor::WaylandOutput::window
+ * \qmlproperty Window QtWayland.Compositor::WaylandOutput::window
*
* This property holds the Window for this WaylandOutput.
*