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_p.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_p.h')
-rw-r--r-- | src/compositor/compositor_api/qwaylandoutput_p.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandoutput_p.h b/src/compositor/compositor_api/qwaylandoutput_p.h index 38bb1ec6e..d8b2c9dfa 100644 --- a/src/compositor/compositor_api/qwaylandoutput_p.h +++ b/src/compositor/compositor_api/qwaylandoutput_p.h @@ -108,6 +108,8 @@ public: void sendMode(const Resource *resource, const QWaylandOutputMode &mode); void sendModesInfo(); + void handleWindowPixelSizeChanged(); + protected: void output_bind_resource(Resource *resource) override; @@ -128,6 +130,7 @@ private: int scaleFactor = 1; bool sizeFollowsWindow = false; bool initialized = false; + QSize windowPixelSize; Q_DECLARE_PUBLIC(QWaylandOutput) Q_DISABLE_COPY(QWaylandOutputPrivate) |