summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-10-22 12:52:46 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-11-16 08:49:12 +0000
commit9c321ec34a8c52ce8ae418e962be1b5e7462ccf4 (patch)
tree68bfeeeda92678b8211ce18ac229ef6d76330db3 /src/compositor
parent79b7925098936ebf3a8e6ca3119256fb4f1a52a9 (diff)
Add QWaylandSurface::bufferSize and deprecate size
Size is confusingly returning the surface size in buffer coordinates and not surface coordinates. Create a new property bufferSize and deprecated size in order to make it less ambiguous. [ChangeLog][Compositor] QWaylandSurface::size has been deprecated. Use bufferSize or destinationSize instead. Change-Id: I7985e4cc1b8d627f922680c1800d2687d710d7b3 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp44
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h14
2 files changed, 47 insertions, 11 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 79b2a9d4e..59e741c84 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -270,8 +270,12 @@ void QWaylandSurfacePrivate::surface_commit(Resource *)
emit q->damaged(damage);
- if (oldBufferSize != bufferSize)
+ if (oldBufferSize != bufferSize) {
+ emit q->bufferSizeChanged();
+#if QT_DEPRECATED_SINCE(5, 13)
emit q->sizeChanged();
+#endif
+ }
if (oldBufferScale != bufferScale)
emit q->bufferScaleChanged();
@@ -457,9 +461,8 @@ bool QWaylandSurface::hasContent() const
*
* This property holds the size of this WaylandSurface in surface coordinates.
*
- * If you want the size in pixels, multiply this size with \l bufferScale.
- *
* \sa bufferScale
+ * \sa bufferSize
*/
/*!
@@ -467,9 +470,8 @@ bool QWaylandSurface::hasContent() const
*
* This property holds the size of this WaylandSurface in surface coordinates.
*
- * If you want the size in pixels, multiply this size with \l bufferScale.
- *
* \sa bufferScale
+ * \sa bufferSize
*/
QSize QWaylandSurface::destinationSize() const
{
@@ -478,28 +480,54 @@ QSize QWaylandSurface::destinationSize() const
}
/*!
- * \qmlproperty size QtWaylandCompositor::WaylandSurface::size
+ * \qmlproperty size QtWaylandCompositor::WaylandSurface::bufferSize
*
* This property holds the size of the current buffer of this WaylandSurface in pixels,
* not in surface coordinates.
*
* For the size in surface coordinates, use \l destinationSize instead.
+ *
+ * \sa destinationSize
+ * \sa bufferScale
*/
/*!
- * \property QWaylandSurface::size
+ * \property QWaylandSurface::bufferSize
*
* This property holds the size of the current buffer of this QWaylandSurface in pixels,
* not in surface coordinates.
*
* For the size in surface coordinates, use \l destinationSize instead.
+ *
+ * \sa destinationSize
+ * \sa bufferScale
*/
-QSize QWaylandSurface::size() const
+QSize QWaylandSurface::bufferSize() const
{
Q_D(const QWaylandSurface);
return d->bufferSize;
}
+#if QT_DEPRECATED_SINCE(5, 13)
+/*!
+ * \qmlproperty size QtWaylandCompositor::WaylandSurface::size
+ * \obsolete use bufferSize or destinationSize instead
+ *
+ * This property has been deprecated, use \l bufferSize or \l destinationSize instead.
+ */
+
+/*!
+ * \property QWaylandSurface::size
+ * \obsolete use bufferSize or destinationSize instead
+ *
+ * This property has been deprecated, use \l bufferSize or \l destinationSize instead.
+ */
+QSize QWaylandSurface::size() const
+{
+ return bufferSize();
+}
+#endif
+
/*!
* \qmlproperty size QtWaylandCompositor::WaylandSurface::bufferScale
*
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index 243aebd11..cd08a3d2a 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -82,7 +82,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSurface : public QWaylandObject
Q_DECLARE_PRIVATE(QWaylandSurface)
Q_PROPERTY(QWaylandClient *client READ client CONSTANT)
Q_PROPERTY(QSize destinationSize READ destinationSize NOTIFY destinationSizeChanged)
- Q_PROPERTY(QSize size READ size NOTIFY sizeChanged) // Qt 6: Remove or replace with destinationSize
+#if QT_DEPRECATED_SINCE(5, 13)
+ Q_PROPERTY(QSize size READ size NOTIFY sizeChanged) // Qt 6: Remove
+#endif
Q_PROPERTY(int bufferScale READ bufferScale NOTIFY bufferScaleChanged)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation NOTIFY contentOrientationChanged)
Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged)
@@ -112,7 +114,10 @@ public:
bool hasContent() const;
QSize destinationSize() const;
- QSize size() const;
+#if QT_DEPRECATED_SINCE(5, 13)
+ QT_DEPRECATED QSize size() const;
+#endif
+ QSize bufferSize() const;
int bufferScale() const;
Qt::ScreenOrientation contentOrientation() const;
@@ -158,7 +163,10 @@ Q_SIGNALS:
void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
void childAdded(QWaylandSurface *child);
void destinationSizeChanged();
- void sizeChanged();
+#if QT_DEPRECATED_SINCE(5, 13)
+ QT_DEPRECATED void sizeChanged();
+#endif
+ void bufferSizeChanged();
void bufferScaleChanged();
void offsetForNextFrame(const QPoint &offset);
void contentOrientationChanged();