diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-06-15 08:55:01 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-06-19 12:43:05 +0000 |
commit | 0b397a6174db0d1c22c3a41de00479fe07ff3886 (patch) | |
tree | e99d650bd2a86cd983147b72562f8f658e00ea7c /src/compositor/compositor_api/qwaylandoutput.h | |
parent | cf86659c874fcb1d3f88a784cd88a51942e5926b (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/qwaylandoutput.h')
-rw-r--r-- | src/compositor/compositor_api/qwaylandoutput.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/compositor/compositor_api/qwaylandoutput.h b/src/compositor/compositor_api/qwaylandoutput.h index f0bea809e..c7f2973b6 100644 --- a/src/compositor/compositor_api/qwaylandoutput.h +++ b/src/compositor/compositor_api/qwaylandoutput.h @@ -181,8 +181,7 @@ Q_SIGNALS: void windowDestroyed(); private Q_SLOTS: - void handleSetWidth(int newWidth); - void handleSetHeight(int newHeight); + void handleMaybeWindowPixelSizeChanged(); void handleWindowDestroyed(); protected: |