Commit 1330abc9 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii Committed by Vlad Zahorodnii
Browse files

Provide hotspot in the device independent pixels

Currently, the trend is to get the coordinates of the hotspot and map it
to the device independent pixels at the call site.

This change makes the KXcursorSprite return the coordinates of the hotspot
in the device independent pixels to reduce the amount of duplicated code.
parent 487e2d9f
......@@ -64,7 +64,6 @@ static PlatformCursorImage loadReferenceThemeCursor_helper(const KXcursorTheme &
QPoint cursorHotspot = sprites.first().hotspot();
cursorHotspot /= theme.devicePixelRatio();
return PlatformCursorImage(cursorImage, cursorHotspot);
......@@ -1322,7 +1322,6 @@ bool WaylandCursorImage::loadThemeCursor_helper(const QByteArray &name, Image *c
cursorImage->hotspot = sprites.first().hotspot();
cursorImage->hotspot /= m_cursorTheme.devicePixelRatio();
return true;
......@@ -96,7 +96,7 @@ static void load_callback(XcursorImages *images, void *data)
QImage data(nativeCursorImage->width, nativeCursorImage->height, QImage::Format_ARGB32);
memcpy(data.bits(), nativeCursorImage->pixels, data.sizeInBytes());
sprites.append(KXcursorSprite(data, hotspot, delay));
sprites.append(KXcursorSprite(data, hotspot / themePrivate->devicePixelRatio, delay));
themePrivate->registry.insert(images->name, sprites);
......@@ -71,7 +71,7 @@ public:
* Returns the hotspot for this sprite. (0, 0) corresponds to the upper left corner.
* The coordinates of the hotspot are in device pixels.
* The coordinates of the hotspot are in device independent pixels.
QPoint hotspot() const;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment