Changeset View
Changeset View
Standalone View
Standalone View
kcms/cursortheme/xcursor/themepage.cpp
Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Line(s) | |||||
234 | bool ThemePage::applyTheme(const CursorTheme *theme, const int size) | 234 | bool ThemePage::applyTheme(const CursorTheme *theme, const int size) | ||
235 | { | 235 | { | ||
236 | // Require the Xcursor version that shipped with X11R6.9 or greater, since | 236 | // Require the Xcursor version that shipped with X11R6.9 or greater, since | ||
237 | // in previous versions the Xfixes code wasn't enabled due to a bug in the | 237 | // in previous versions the Xfixes code wasn't enabled due to a bug in the | ||
238 | // build system (freedesktop bug #975). | 238 | // build system (freedesktop bug #975). | ||
239 | #if HAVE_XFIXES && XFIXES_MAJOR >= 2 && XCURSOR_LIB_VERSION >= 10105 | 239 | #if HAVE_XFIXES && XFIXES_MAJOR >= 2 && XCURSOR_LIB_VERSION >= 10105 | ||
240 | if (!theme) | 240 | if (!theme) | ||
241 | return false; | 241 | return false; | ||
242 | const bool isX11 = QX11Info::isPlatformX11(); | ||||
242 | 243 | | |||
243 | if (!CursorTheme::haveXfixes()) | 244 | if (isX11 && !CursorTheme::haveXfixes()) | ||
244 | return false; | 245 | return false; | ||
245 | 246 | | |||
246 | QByteArray themeName = QFile::encodeName(theme->name()); | 247 | QByteArray themeName = QFile::encodeName(theme->name()); | ||
247 | 248 | | |||
248 | // Set up the proper launch environment for newly started apps | 249 | // Set up the proper launch environment for newly started apps | ||
249 | OrgKdeKLauncherInterface klauncher(QStringLiteral("org.kde.klauncher5"), | 250 | OrgKdeKLauncherInterface klauncher(QStringLiteral("org.kde.klauncher5"), | ||
250 | QStringLiteral("/KLauncher"), | 251 | QStringLiteral("/KLauncher"), | ||
251 | QDBusConnection::sessionBus()); | 252 | QDBusConnection::sessionBus()); | ||
252 | klauncher.setLaunchEnv(QStringLiteral("XCURSOR_THEME"), themeName); | 253 | klauncher.setLaunchEnv(QStringLiteral("XCURSOR_THEME"), themeName); | ||
253 | 254 | | |||
254 | // Update the Xcursor X resources | 255 | // Update the Xcursor X resources | ||
256 | if (isX11) { | ||||
255 | runRdb(0); | 257 | runRdb(0); | ||
258 | } | ||||
256 | 259 | | |||
257 | // Notify all applications that the cursor theme has changed | 260 | // Notify all applications that the cursor theme has changed | ||
258 | KGlobalSettings::self()->emitChange(KGlobalSettings::CursorChanged); | 261 | KGlobalSettings::self()->emitChange(KGlobalSettings::CursorChanged); | ||
259 | 262 | | |||
263 | if (!isX11) { | ||||
264 | // TODO: Wayland clients don't reload the cursor, QtWayland doesn't support it at all | ||||
265 | return false; | ||||
266 | } | ||||
267 | | ||||
260 | // Reload the standard cursors | 268 | // Reload the standard cursors | ||
261 | QStringList names; | 269 | QStringList names; | ||
262 | 270 | | |||
263 | // Qt cursors | 271 | // Qt cursors | ||
264 | names << QStringLiteral("left_ptr") << QStringLiteral("up_arrow") << QStringLiteral("cross") << QStringLiteral("wait") | 272 | names << QStringLiteral("left_ptr") << QStringLiteral("up_arrow") << QStringLiteral("cross") << QStringLiteral("wait") | ||
265 | << QStringLiteral("left_ptr_watch") << QStringLiteral("ibeam") << QStringLiteral("size_ver") << QStringLiteral("size_hor") | 273 | << QStringLiteral("left_ptr_watch") << QStringLiteral("ibeam") << QStringLiteral("size_ver") << QStringLiteral("size_hor") | ||
266 | << QStringLiteral("size_bdiag") << QStringLiteral("size_fdiag") << QStringLiteral("size_all") << QStringLiteral("split_v") | 274 | << QStringLiteral("size_bdiag") << QStringLiteral("size_fdiag") << QStringLiteral("size_all") << QStringLiteral("split_v") | ||
267 | << QStringLiteral("split_h") << QStringLiteral("pointing_hand") << QStringLiteral("openhand") | 275 | << QStringLiteral("split_h") << QStringLiteral("pointing_hand") << QStringLiteral("openhand") | ||
▲ Show 20 Lines • Show All 300 Lines • Show Last 20 Lines |