summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-04-28 12:08:08 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-04-29 15:45:57 +0000
commitaae5a5b19c320f367a7e43d54d84b0562a85737a (patch)
treed7a142d70e6af069cd8bee12dacdc5c0eeaeb3ed
parent0f1a02920eb58dd16b085e60a2b36d822f104437 (diff)
QML compositor: Scale surfaces if bufferScale is not set
If bufferScale is not set to match the output scale factor, scale the QWaylandQuickItem accordingly. Change-Id: I2c9e8679ad6eccda9e8e752aaca217d5352bb23e Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index e6844f4c8..ded16a9c3 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -552,6 +552,7 @@ void QWaylandQuickItem::handleSurfaceChanged()
disconnect(d->oldSurface, &QWaylandSurface::mappedChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
disconnect(d->oldSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged);
disconnect(d->oldSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize);
+ disconnect(d->oldSurface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandQuickItem::updateSize);
disconnect(d->oldSurface, &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer);
disconnect(d->oldSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
disconnect(d->oldSurface, &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded);
@@ -563,16 +564,16 @@ void QWaylandQuickItem::handleSurfaceChanged()
connect(newSurface, &QWaylandSurface::mappedChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
connect(newSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged);
connect(newSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize);
+ connect(newSurface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandQuickItem::updateSize);
connect(newSurface, &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer);
connect(newSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
connect(newSurface, &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded);
#ifndef QT_NO_IM
connect(newSurface->inputMethodControl(), &QWaylandInputMethodControl::updateInputMethod, this, &QWaylandQuickItem::updateInputMethod);
#endif
- if (d->sizeFollowsSurface) {
- setWidth(newSurface->size().width());
- setHeight(newSurface->size().height());
- }
+
+ updateSize();
+
if (newSurface->origin() != d->origin) {
d->origin = newSurface->origin();
emit originChanged();
@@ -640,7 +641,7 @@ void QWaylandQuickItem::updateSize()
{
Q_D(QWaylandQuickItem);
if (d->sizeFollowsSurface && surface()) {
- setSize(surface()->size());
+ setSize(surface()->size() * (d->scaleFactor() / surface()->bufferScale()));
}
}