summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/wayland/qwaylanddrmsurface.cpp')
-rw-r--r--src/plugins/platforms/wayland/qwaylanddrmsurface.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp
index c9fb187..7756e85 100644
--- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp
+++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp
@@ -196,11 +196,13 @@ void QWaylandDrmWindowSurface::flush(QWidget *widget, const QRegion &region, con
}
}
-void QWaylandDrmWindowSurface::resize(const QSize &size)
+void QWaylandDrmWindowSurface::resize(const QSize &requestedSize)
{
QWaylandWindow *ww = (QWaylandWindow *) window()->platformWindow();
- QWindowSurface::resize(size);
- QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format();
+ QWaylandScreen *screen = (QWaylandScreen *)QApplicationPrivate::platformIntegration()->screens().first();
+ QImage::Format format = screen->format();
+ QSize screenSize = screen->geometry().size();
+ QSize size = requestedSize;
if (mBuffer != NULL && mBuffer->mSize == size)
return;
@@ -208,6 +210,14 @@ void QWaylandDrmWindowSurface::resize(const QSize &size)
if (mBuffer != NULL)
delete mBuffer;
+ /* Clamp to screen size */
+ if (size.width() > screenSize.width())
+ size.setWidth(screenSize.width());
+ if (size.height() > screenSize.height())
+ size.setHeight(screenSize.height());
+
+ QWindowSurface::resize(size);
+
mBuffer = new QWaylandDrmBuffer(mDisplay, size, format);
ww->attach(mBuffer);