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