summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-04-28 12:09:13 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-04-29 11:37:32 +0000
commit32a09df9a1b42806be0fd82a40f5837a22cfa52c (patch)
tree65e2b4ba3e6c0277b9da74382231d5f16dee8f28
parent3004d09437aca95544be88f60bae9b3f1d412a63 (diff)
downloadqtwayland-32a09df9a1b42806be0fd82a40f5837a22cfa52c.tar.gz
Compositor API: Add bufferScale property to QWaylandSurface
Change-Id: I1d4e4b65e5a58e3f314551bb10226fa58650becb Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp40
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h3
-rw-r--r--src/compositor/compositor_api/qwaylandsurface_p.h4
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h1
4 files changed, 48 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 3a16ed27..ea4c4672 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -126,6 +126,7 @@ QWaylandSurfacePrivate::QWaylandSurfacePrivate()
, buffer(0)
, role(0)
, inputRegion(infiniteRegion())
+ , bufferScale(1)
, isCursorSurface(false)
, destroyed(false)
, mapped(false)
@@ -137,6 +138,7 @@ QWaylandSurfacePrivate::QWaylandSurfacePrivate()
pending.buffer = 0;
pending.newlyAttached = false;
pending.inputRegion = infiniteRegion();
+ pending.bufferScale = 1;
#ifndef QT_NO_DEBUG
addUninitializedSurface(this);
#endif
@@ -170,6 +172,15 @@ void QWaylandSurfacePrivate::setSize(const QSize &s)
}
}
+void QWaylandSurfacePrivate::setBufferScale(int scale)
+{
+ Q_Q(QWaylandSurface);
+ if (scale == bufferScale)
+ return;
+ bufferScale = scale;
+ emit q->bufferScaleChanged();
+}
+
void QWaylandSurfacePrivate::removeFrameCallback(QtWayland::FrameCallback *callback)
{
pendingFrameCallbacks.removeOne(callback);
@@ -272,6 +283,8 @@ void QWaylandSurfacePrivate::surface_commit(Resource *)
pending.newlyAttached = false;
pending.damage = QRegion();
+ setBufferScale(pending.bufferScale);
+
if (buffer)
buffer->setCommitted();
@@ -307,6 +320,12 @@ void QWaylandSurfacePrivate::surface_set_buffer_transform(Resource *resource, in
emit q->contentOrientationChanged();
}
+void QWaylandSurfacePrivate::surface_set_buffer_scale(QtWaylandServer::wl_surface::Resource *resource, int32_t scale)
+{
+ Q_UNUSED(resource);
+ pending.bufferScale = scale;
+}
+
void QWaylandSurfacePrivate::setBackBuffer(QtWayland::SurfaceBuffer *b, const QRegion &d)
{
Q_Q(QWaylandSurface);
@@ -497,6 +516,27 @@ QSize QWaylandSurface::size() const
}
/*!
+ * \qmlproperty size QtWaylandCompositor::WaylandSurface::bufferScale
+ *
+ * This property holds the WaylandSurface's buffer scale. The buffer scale lets
+ * a client supply higher resolution buffer data for use on high resolution
+ * outputs.
+ */
+
+/*!
+ * \property QWaylandSurface::bufferScale
+ *
+ * This property holds the QWaylandSurface's buffer scale. The buffer scale
+ * lets a client supply higher resolution buffer data for use on high
+ * resolution outputs.
+ */
+int QWaylandSurface::bufferScale() const
+{
+ Q_D(const QWaylandSurface);
+ return d->bufferScale;
+}
+
+/*!
* \qmlproperty enum QtWaylandCompositor::WaylandSurface::contentOrientation
*
* This property holds the orientation of the WaylandSurface's contents.
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index 6abdbdef..4abe9e74 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -78,6 +78,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSurface : public QWaylandObject
Q_DECLARE_PRIVATE(QWaylandSurface)
Q_PROPERTY(QWaylandClient *client READ client CONSTANT)
Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
+ 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)
Q_PROPERTY(bool isMapped READ isMapped NOTIFY mappedChanged)
@@ -106,6 +107,7 @@ public:
bool isMapped() const;
QSize size() const;
+ int bufferScale() const;
Qt::ScreenOrientation contentOrientation() const;
@@ -146,6 +148,7 @@ Q_SIGNALS:
void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
void childAdded(QWaylandSurface *child);
void sizeChanged();
+ void bufferScaleChanged();
void offsetForNextFrame(const QPoint &offset);
void contentOrientationChanged();
void surfaceDestroyed();
diff --git a/src/compositor/compositor_api/qwaylandsurface_p.h b/src/compositor/compositor_api/qwaylandsurface_p.h
index d8b289c6..e37179cc 100644
--- a/src/compositor/compositor_api/qwaylandsurface_p.h
+++ b/src/compositor/compositor_api/qwaylandsurface_p.h
@@ -100,6 +100,7 @@ public:
using QtWaylandServer::wl_surface::resource;
void setSize(const QSize &size);
+ void setBufferScale(int bufferScale);
void removeFrameCallback(QtWayland::FrameCallback *callback);
@@ -131,6 +132,7 @@ protected:
struct wl_resource *region) Q_DECL_OVERRIDE;
void surface_commit(Resource *resource) Q_DECL_OVERRIDE;
void surface_set_buffer_transform(Resource *resource, int32_t transform) Q_DECL_OVERRIDE;
+ void surface_set_buffer_scale(Resource *resource, int32_t bufferScale) Q_DECL_OVERRIDE;
void setBackBuffer(QtWayland::SurfaceBuffer *buffer, const QRegion &damage);
QtWayland::SurfaceBuffer *createSurfaceBuffer(struct ::wl_resource *buffer);
@@ -151,6 +153,7 @@ public: //member variables
QPoint offset;
bool newlyAttached;
QRegion inputRegion;
+ int bufferScale;
} pending;
QPoint lastLocalMousePos;
@@ -165,6 +168,7 @@ public: //member variables
QVector<QtWayland::SurfaceBuffer *> bufferPool;
QSize size;
+ int bufferScale;
bool isCursorSurface;
bool destroyed;
bool mapped;
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
index a3866f28..1d186e2d 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
@@ -116,6 +116,7 @@ private:
QWaylandSurface *m_surface;
QWaylandCompositor *m_compositor;
struct ::wl_resource *m_buffer;
+ int m_bufferScale;
struct surface_buffer_destroy_listener m_destroy_listener;
bool m_committed;
bool m_is_registered_for_buffer;