summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandoutputmode.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-06-15 08:55:01 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-06-19 12:43:05 +0000
commit0b397a6174db0d1c22c3a41de00479fe07ff3886 (patch)
treee99d650bd2a86cd983147b72562f8f658e00ea7c /src/compositor/compositor_api/qwaylandoutputmode.cpp
parentcf86659c874fcb1d3f88a784cd88a51942e5926b (diff)
Fix WaylandOutput.sizeFollowsWindow when window changes screen
If a QWaylandOutput's QWindow is moved from one screen to another and that causes the devicePixelRatio to change, it may result in a new pixel size, but QWindow::width and height may stay unchanged (because they're not in pixel coordinates). This is a problem because the sizeFollowsWindow functionality of QWaylandOutput relied on the widthChanged and heightChanged signals, which are then not fired, although the pixel size did change. There's no QWindow::devicePixelRatioChanged signal we can attach to, so to fix this, we attach to screenChanged instead and then compute the new pixelSize using QWindow::devicePixelRatio() and call the handler if it changed. This also removes some duplication between the old width and height handlers. Change-Id: Ibcbf10489b83498b4a0fee2b520f528f94cb9ce3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandoutputmode.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandoutputmode.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/compositor/compositor_api/qwaylandoutputmode.cpp b/src/compositor/compositor_api/qwaylandoutputmode.cpp
index 9ae285fd5..545871175 100644
--- a/src/compositor/compositor_api/qwaylandoutputmode.cpp
+++ b/src/compositor/compositor_api/qwaylandoutputmode.cpp
@@ -128,15 +128,7 @@ int QWaylandOutputMode::refreshRate() const
/*!
* \internal
*/
-void QWaylandOutputMode::setWidth(int width)
+void QWaylandOutputMode::setSize(const QSize &size)
{
- d->size.setWidth(width);
-}
-
-/*!
- * \internal
- */
-void QWaylandOutputMode::setHeight(int height)
-{
- d->size.setHeight(height);
+ d->size = size;
}