@@ -77,24 +77,26 @@ CustomCursorImage::CustomCursorImage(const QCursor &cursor)
77XCursorImage::XCursorImage(const QString &theme, const QString &file)
77XCursorImage::XCursorImage(const QString &theme, const QString &file)
78 : xcursorImages(nullptr)
78 : xcursorImages(nullptr)
80+ // TODO: Consider grid unit value
81+ // Hardcoding to a medium size for now
82+ int preferredCursorHeightPx = 32;
80− xcursorImages = XcursorLibraryLoadImages(QFile::encodeName(file), QFile::encodeName(theme), 32);
84+ xcursorImages = XcursorLibraryLoadImages(QFile::encodeName(file), QFile::encodeName(theme),
85+ preferredCursorHeightPx);
81 if (!xcursorImages) {
86 if (!xcursorImages) {
85− bool loaded = false;
90+ // Just take the first one. It will have multiple images in case of an animated cursor.
91+ // TODO: Support animated cursors
86− for (int i = 0; i < xcursorImages->nimage && !loaded; ++i) {
92+ if ( xcursorImages->nimage > 0) {
87− XcursorImage *xcursorImage = xcursorImages->images[i];
93+ XcursorImage *xcursorImage = xcursorImages->images[0];
88− if (xcursorImage->size == 32) {
90− qimage = QImage((uchar*)xcursorImage->pixels,
91− xcursorImage->width, xcursorImage->height, QImage::Format_ARGB32);
93− hotspot.setX(xcursorImage->xhot);
95+ qimage = QImage((uchar*)xcursorImage->pixels,
94− hotspot.setY(xcursorImage->yhot);
96+ xcursorImage->width, xcursorImage->height, QImage::Format_ARGB32);
96− loaded = true;
98+ hotspot.setX(xcursorImage->xhot);
97− }
99+ hotspot.setY(xcursorImage->yhot);