summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandquickitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/compositor_api/qwaylandquickitem.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index fd9b1b800..19c0656c7 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -64,7 +64,7 @@
#include <QtCore/QMutexLocker>
#include <QtCore/QMutex>
-#include <wayland-server.h>
+#include <wayland-server-core.h>
#include <QThread>
#ifndef GL_TEXTURE_EXTERNAL_OES
@@ -1061,6 +1061,22 @@ QPointF QWaylandQuickItem::mapToSurface(const QPointF &point) const
}
/*!
+ * Maps the given \a point in the Wayland surfaces's coordinate system to the equivalent
+ * point within this item's coordinate system, and returns the mapped coordinate.
+ */
+QPointF QWaylandQuickItem::mapFromSurface(const QPointF &point) const
+{
+ Q_D(const QWaylandQuickItem);
+ if (!surface() || surface()->size().isEmpty())
+ return point * d->scaleFactor();
+
+ qreal xScale = width() / surface()->size().width() * surface()->bufferScale();
+ qreal yScale = height() / surface()->size().height() * surface()->bufferScale();
+
+ return QPointF(point.x() * xScale, point.y() * yScale);
+}
+
+/*!
* \qmlproperty bool QtWaylandCompositor::WaylandQuickItem::sizeFollowsSurface
*
* This property specifies whether the size of the item should always match