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>
This commit is contained in:
Johan Klokkhammer Helsing 2018-10-08 11:25:32 +02:00 committed by Johan Helsing
parent b25af2c768
commit e71099c07e

View File

@ -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;