diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-10-08 11:25:32 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-10-08 14:01:06 +0000 |
commit | eff85f5be4013c10753b3c7cb05e7c601fb600cd (patch) | |
tree | fc479fc9028d2492bc25c39f05ec62e35f897fe9 | |
parent | 35f07de36baecc0fff7a2073995425b4da308220 (diff) | |
download | qtwayland-eff85f5be4013c10753b3c7cb05e7c601fb600cd.tar.gz |
Client: Fix cursor size becoming bigger and bigger when switching screens
cursorSize was a static which was multiplied with the dpr each time
loadCursorSize was called resulting in a bigger and bigger cursor size.
Fix it by making the static constant.
Change-Id: Ie23cf0cc0d6c13721feecebe214d7c794be35077
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index c57dc13a..a2957e0d 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -526,9 +526,10 @@ void QWaylandDisplay::setCursor(const QSharedPointer<QWaylandBuffer> &buffer, co QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRatio) { - static int cursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); - if (cursorSize <= 0) - cursorSize = 32; + constexpr int defaultCursorSize = 32; + static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); + int cursorSize = xCursorSize > 0 ? xCursorSize : defaultCursorSize; + if (compositorVersion() >= 3) // set_buffer_scale is not supported on earlier versions cursorSize *= devicePixelRatio; |