From 6aa799c6fe24c29f9d92634b605dd91b2ca12bc1 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sat, 5 Dec 2015 12:24:56 +0100 Subject: Output available geometry in output coordinates space The available geometry is a portion of the output so starting from the output global coordinates is wrong, it should start from 0,0 by default. Warn when coordinates outside the output are set. Update the documentation accordingly. Change-Id: Ia93481ad092c9daab3837321b62831f51fce9e57 Reviewed-by: Paul Olav Tvete --- src/compositor/compositor_api/qwaylandoutput.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp index 5aa3b20f7..c8c5878bf 100644 --- a/src/compositor/compositor_api/qwaylandoutput.cpp +++ b/src/compositor/compositor_api/qwaylandoutput.cpp @@ -510,6 +510,8 @@ void QWaylandOutput::setGeometry(const QRect &geometry) * \qmlproperty rect QtWaylandCompositor::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 + * as the output by default. * * \sa QWaylandOutput::geometry */ @@ -518,6 +520,8 @@ void QWaylandOutput::setGeometry(const QRect &geometry) * \property QWaylandOutput::availableGeometry * * This property holds the geometry of the QWaylandOutput available for displaying content. + * The available geometry is in output coordinates space, starts from 0,0 and it's as big + * as the output by default. * * \sa QWaylandOutput::mode, QWaylandOutput::geometry */ @@ -525,7 +529,7 @@ QRect QWaylandOutput::availableGeometry() const { Q_D(const QWaylandOutput); if (!d->availableGeometry.isValid()) - return QRect(d->position, d->mode.size); + return QRect(QPoint(0, 0), d->mode.size); return d->availableGeometry; } @@ -536,6 +540,9 @@ void QWaylandOutput::setAvailableGeometry(const QRect &availableGeometry) if (d->availableGeometry == availableGeometry) return; + if (availableGeometry.topLeft().x() < 0 || availableGeometry.topLeft().y() < 0) + qWarning("Available geometry should be a portion of the output"); + d->availableGeometry = availableGeometry; Q_EMIT availableGeometryChanged(); -- cgit v1.2.3