From e71099c07e23d1ed1776caa432c4207b0d535885 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 8 Oct 2018 11:25:32 +0200 Subject: [PATCH] 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 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c57dc13add2..a2957e0dd3d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -526,9 +526,10 @@ void QWaylandDisplay::setCursor(const QSharedPointer &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;