@@ -185,8 +185,13 @@ void MirSurfaceItem::createQmlContentItem()
185185 m_qmlItem = qobject_cast<QQuickItem*>(m_qmlContentComponent->create());
186186 m_qmlItem->setParentItem(this);
187187
188− m_qmlItem->setWidth(m_surfaceWidth);
189− m_qmlItem->setHeight(m_surfaceHeight);
188+ if (m_fillMode == FillMode::Stretch) {
189+ m_qmlItem->setWidth(width());
190+ m_qmlItem->setHeight(height());
191+ } else {
192+ m_qmlItem->setWidth(m_surfaceWidth);
193+ m_qmlItem->setHeight(m_surfaceHeight);
194+ }
190195
191196 setImplicitWidth(m_qmlItem->implicitWidth());
192197 setImplicitHeight(m_qmlItem->implicitHeight());
@@ -294,7 +299,11 @@ void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
294299 connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
295300 connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);
296301 connect(m_qmlSurface, &MirSurface::sizeChanged, this, [this] () {
297− m_qmlItem->setSize(m_qmlSurface->size());
302+ if (m_fillMode == FillMode::Stretch) {
303+ m_qmlItem->setSize(QSize(this->width(), this->height()));
304+ } else {
305+ m_qmlItem->setSize(m_qmlSurface->size());
306+ }
298307 setImplicitSize(m_qmlSurface->width(), m_qmlSurface->height());
299308 });
300309
@@ -388,8 +397,13 @@ void MirSurfaceItem::updateSurfaceSize()
388397 if (m_qmlSurface && m_surfaceWidth > 0 && m_surfaceHeight > 0) {
389398 m_qmlSurface->resize(m_surfaceWidth, m_surfaceHeight);
390399 if (m_qmlItem) {
391− m_qmlItem->setWidth(m_surfaceWidth);
392− m_qmlItem->setHeight(m_surfaceHeight);
400+ if (m_fillMode == FillMode::Stretch) {
401+ m_qmlItem->setWidth(width());
402+ m_qmlItem->setHeight(height());
403+ } else {
404+ m_qmlItem->setWidth(m_surfaceWidth);
405+ m_qmlItem->setHeight(m_surfaceHeight);
406+ }
393407 }
394408 qDebug() << this << "setting implicitsize" << m_surfaceWidth << m_surfaceHeight;
395409 setImplicitSize(m_surfaceWidth, m_surfaceHeight);