@@ -185,8 +185,13 @@ void MirSurfaceItem::createQmlContentItem()
185 m_qmlItem = qobject_cast<QQuickItem*>(m_qmlContentComponent->create());
185 m_qmlItem = qobject_cast<QQuickItem*>(m_qmlContentComponent->create());
186 m_qmlItem->setParentItem(this);
186 m_qmlItem->setParentItem(this);
188+ if (m_fillMode == FillMode::Stretch) {
189+ m_qmlItem->setWidth(width());
190+ m_qmlItem->setHeight(height());
188− m_qmlItem->setWidth(m_surfaceWidth);
192+ m_qmlItem->setWidth(m_surfaceWidth);
189− m_qmlItem->setHeight(m_surfaceHeight);
193+ m_qmlItem->setHeight(m_surfaceHeight);
191 setImplicitWidth(m_qmlItem->implicitWidth());
196 setImplicitWidth(m_qmlItem->implicitWidth());
192 setImplicitHeight(m_qmlItem->implicitHeight());
197 setImplicitHeight(m_qmlItem->implicitHeight());
@@ -294,7 +299,11 @@ void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
294 connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
299 connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
295 connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);
300 connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);
296 connect(m_qmlSurface, &MirSurface::sizeChanged, this, [this] () {
301 connect(m_qmlSurface, &MirSurface::sizeChanged, this, [this] () {
302+ if (m_fillMode == FillMode::Stretch) {
303+ m_qmlItem->setSize(QSize(this->width(), this->height()));
297− m_qmlItem->setSize(m_qmlSurface->size());
305+ m_qmlItem->setSize(m_qmlSurface->size());
298 setImplicitSize(m_qmlSurface->width(), m_qmlSurface->height());
307 setImplicitSize(m_qmlSurface->width(), m_qmlSurface->height());
@@ -388,8 +397,13 @@ void MirSurfaceItem::updateSurfaceSize()
388 if (m_qmlSurface && m_surfaceWidth > 0 && m_surfaceHeight > 0) {
397 if (m_qmlSurface && m_surfaceWidth > 0 && m_surfaceHeight > 0) {
389 m_qmlSurface->resize(m_surfaceWidth, m_surfaceHeight);
398 m_qmlSurface->resize(m_surfaceWidth, m_surfaceHeight);
390 if (m_qmlItem) {
399 if (m_qmlItem) {
400+ if (m_fillMode == FillMode::Stretch) {
401+ m_qmlItem->setWidth(width());
402+ m_qmlItem->setHeight(height());
391− m_qmlItem->setWidth(m_surfaceWidth);
404+ m_qmlItem->setWidth(m_surfaceWidth);
392− m_qmlItem->setHeight(m_surfaceHeight);
405+ m_qmlItem->setHeight(m_surfaceHeight);
394 qDebug() << this << "setting implicitsize" << m_surfaceWidth << m_surfaceHeight;
408 qDebug() << this << "setting implicitsize" << m_surfaceWidth << m_surfaceHeight;
395 setImplicitSize(m_surfaceWidth, m_surfaceHeight);
409 setImplicitSize(m_surfaceWidth, m_surfaceHeight);