diff --git a/kcms/cursortheme/xcursor/previewwidget.cpp b/kcms/cursortheme/xcursor/previewwidget.cpp --- a/kcms/cursortheme/xcursor/previewwidget.cpp +++ b/kcms/cursortheme/xcursor/previewwidget.cpp @@ -92,7 +92,11 @@ m_pixmap = QPixmap::fromImage(image); // Load the cursor - m_cursor = theme->loadCursor(name, size); + if (QX11Info::isPlatformX11()) { + m_cursor = theme->loadCursor(name, size); + } else { + m_cursor = XCB_CURSOR_NONE; + } // ### perhaps we should tag the cursor so it doesn't get // replaced when a new theme is applied } @@ -216,6 +220,7 @@ { if (c != current) { + // TODO: implement for Wayland const uint32_t cursor = *c; if (QX11Info::isPlatformX11() && (cursor != XCB_CURSOR_NONE)) { xcb_change_window_attributes(QX11Info::connection(), winId(), XCB_CW_CURSOR, &cursor); diff --git a/kcms/cursortheme/xcursor/thememodel.cpp b/kcms/cursortheme/xcursor/thememodel.cpp --- a/kcms/cursortheme/xcursor/thememodel.cpp +++ b/kcms/cursortheme/xcursor/thememodel.cpp @@ -305,11 +305,6 @@ if (!themeDir.exists(QStringLiteral("index.theme")) && !haveCursors) return; - static bool isX11 = QX11Info::isPlatformX11(); - if (!isX11) { - // TODO: implement Wayland Cursor Theme support - return; - } // Create a cursor theme object for the theme dir XCursorTheme *theme = new XCursorTheme(themeDir); diff --git a/kcms/cursortheme/xcursor/themepage.cpp b/kcms/cursortheme/xcursor/themepage.cpp --- a/kcms/cursortheme/xcursor/themepage.cpp +++ b/kcms/cursortheme/xcursor/themepage.cpp @@ -239,8 +239,9 @@ #if HAVE_XFIXES && XFIXES_MAJOR >= 2 && XCURSOR_LIB_VERSION >= 10105 if (!theme) return false; + const bool isX11 = QX11Info::isPlatformX11(); - if (!CursorTheme::haveXfixes()) + if (isX11 && !CursorTheme::haveXfixes()) return false; QByteArray themeName = QFile::encodeName(theme->name()); @@ -252,11 +253,18 @@ klauncher.setLaunchEnv(QStringLiteral("XCURSOR_THEME"), themeName); // Update the Xcursor X resources - runRdb(0); + if (isX11) { + runRdb(0); + } // Notify all applications that the cursor theme has changed KGlobalSettings::self()->emitChange(KGlobalSettings::CursorChanged); + if (!isX11) { + // TODO: Wayland clients don't reload the cursor, QtWayland doesn't support it at all + return false; + } + // Reload the standard cursors QStringList names; diff --git a/kcms/cursortheme/xcursor/xcursortheme.cpp b/kcms/cursortheme/xcursor/xcursortheme.cpp --- a/kcms/cursortheme/xcursor/xcursortheme.cpp +++ b/kcms/cursortheme/xcursor/xcursortheme.cpp @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -152,6 +154,13 @@ int XCursorTheme::autodetectCursorSize() const { + if (!QX11Info::isPlatformX11()) { + if (QScreen *s = QGuiApplication::primaryScreen()) { + return s->logicalDotsPerInchY() * 16 / 72; + } + // some default value + return 16; + } /* This code is basically borrowed from display.c of the XCursor library We can't use "int XcursorGetDefaultSize(Display *dpy)" because if previously the cursor size was set to a custom value, it would return