diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-11-08 21:05:19 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-01-25 18:04:15 (GMT) |
commit | aba46c644461616a2b14fc422efba74d5c44d017 (patch) | |
tree | ef30ecbc8ecd92c5a5e70c5d41e851807c27a5a2 /src/plugins | |
parent | f3bb98a1fa89a505ae3015977840ddbe2219ab5a (diff) | |
download | Qt-aba46c644461616a2b14fc422efba74d5c44d017.zip Qt-aba46c644461616a2b14fc422efba74d5c44d017.tar.gz Qt-aba46c644461616a2b14fc422efba74d5c44d017.tar.bz2 |
Wayland: clamp window resizes to screen size
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddrmsurface.cpp | 16 |
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 ®ion, 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); |