Commit 1c43e1b4 authored by Johan Ouwerkerk's avatar Johan Ouwerkerk
Browse files

Make the lookandfeel KCM build without XCursor support

Summary:
With this change the lookandfeel KCM can be built without X11 cursor development headers.
In the case the KCM is built without XCursor support, it will not be able to reload the cursor dynamically at runtime but it will still be able to configure cursor themes.

This is an alternative to: D26344 (https://phabricator.kde.org/D26344)

Test Plan: plasma-desktop builds using kdesrc-build with and without X11 cursor development headers present.

Reviewers: davidedmundson, #plasma

Reviewed By: davidedmundson, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26367
parent fd4fd031
# KI18N Translation Domain for this library
add_definitions(-DTRANSLATION_DOMAIN=\"kcm_lookandfeel\")
if(X11_Xcursor_FOUND)
set(HAVE_XCURSOR TRUE)
endif()
configure_file (config-kcm.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kcm.h )
set(kcm_lookandfeel_SRCS
kcmmain.cpp
kcm.cpp
../krdb/krdb.cpp
../cursortheme/xcursor/cursortheme.cpp
../cursortheme/xcursor/xcursortheme.cpp
kcmmain.cpp
kcm.cpp
../krdb/krdb.cpp
)
if (X11_Xcursor_FOUND)
set(kcm_lookandfeel_SRCS
${kcm_lookandfeel_SRCS}
../cursortheme/xcursor/cursortheme.cpp
../cursortheme/xcursor/xcursortheme.cpp
)
endif ()
set(klauncher_xml ${KINIT_DBUS_INTERFACES_DIR}/kf5_org.kde.KLauncher.xml)
qt5_add_dbus_interface(kcm_lookandfeel_SRCS ${klauncher_xml} klauncher_iface)
......@@ -69,10 +77,16 @@ set(lookandfeeltool_SRCS
# TODO: load kcm plugin instead of using code copy
kcm.cpp
../krdb/krdb.cpp
../cursortheme/xcursor/cursortheme.cpp
../cursortheme/xcursor/xcursortheme.cpp
)
if (X11_Xcursor_FOUND)
set(lookandfeeltool_SRCS
${lookandfeeltool_SRCS}
../cursortheme/xcursor/cursortheme.cpp
../cursortheme/xcursor/xcursortheme.cpp
)
endif ()
qt5_add_dbus_interface(lookandfeeltool_SRCS ${klauncher_xml} klauncher_iface)
kconfig_add_kcfg_files(lookandfeeltool_SRCS lookandfeelsettings.kcfgc GENERATE_MOC)
......
......@@ -6,10 +6,16 @@ set( kcmTest_SRCS
kcmtest.cpp
../kcm.cpp
../../krdb/krdb.cpp
../../cursortheme/xcursor/cursortheme.cpp
../../cursortheme/xcursor/xcursortheme.cpp
)
if (X11_Xcursor_FOUND)
set(kcmTest_SRCS
${kcmTest_SRCS}
../../cursortheme/xcursor/cursortheme.cpp
../../cursortheme/xcursor/xcursortheme.cpp
)
endif ()
set(klauncher_xml ${KINIT_DBUS_INTERFACES_DIR}/kf5_org.kde.KLauncher.xml)
qt5_add_dbus_interface(kcmTest_SRCS ${klauncher_xml} klauncher_iface)
......
#cmakedefine HAVE_XFIXES 1
#cmakedefine HAVE_XCURSOR 1
#cmakedefine HAVE_BREEZE_DECO 1
......@@ -20,7 +20,6 @@
#include "kcm.h"
#include "../krdb/krdb.h"
#include "../cursortheme/xcursor/xcursortheme.h"
#include "config-kcm.h"
#include "config-workspace.h"
#include <klauncher_iface.h>
......@@ -45,10 +44,14 @@
#include <KPackage/PackageLoader>
#include <X11/Xlib.h>
#include <X11/Xcursor/Xcursor.h>
#include "lookandfeelsettings.h"
#ifdef HAVE_XCURSOR
# include "../cursortheme/xcursor/xcursortheme.h"
# include <X11/Xcursor/Xcursor.h>
#endif
#ifdef HAVE_XFIXES
# include <X11/extensions/Xfixes.h>
#endif
......@@ -467,10 +470,11 @@ void KCMLookandFeel::setCursorTheme(const QString themeName)
cg.writeEntry("cursorTheme", themeName);
cg.sync();
#ifdef HAVE_XCURSOR
// Require the Xcursor version that shipped with X11R6.9 or greater, since
// in previous versions the Xfixes code wasn't enabled due to a bug in the
// build system (freedesktop bug #975).
#if HAVE_XFIXES && XFIXES_MAJOR >= 2 && XCURSOR_LIB_VERSION >= 10105
#if defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2 && XCURSOR_LIB_VERSION >= 10105
const int cursorSize = cg.readEntry("cursorSize", 0);
QDir themeDir = cursorThemeDir(themeName, 0);
......@@ -526,6 +530,7 @@ void KCMLookandFeel::setCursorTheme(const QString themeName)
i18n("You have to restart the Plasma session for these changes to take effect."),
i18n("Cursor Settings Changed"), "CursorSettingsChanged");
#endif
#endif
}
QDir KCMLookandFeel::cursorThemeDir(const QString &theme, const int depth)
......@@ -579,6 +584,7 @@ const QStringList KCMLookandFeel::cursorSearchPaths()
if (!m_cursorSearchPaths.isEmpty())
return m_cursorSearchPaths;
#ifdef HAVE_XCURSOR
#if XCURSOR_LIB_MAJOR == 1 && XCURSOR_LIB_MINOR < 1
// These are the default paths Xcursor will scan for cursor themes
QString path("~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons");
......@@ -609,6 +615,9 @@ const QStringList KCMLookandFeel::cursorSearchPaths()
// Expand all occurrences of ~/ to the home dir
m_cursorSearchPaths.replaceInStrings(QRegExp(QStringLiteral("^~\\/")), QDir::home().path() + QLatin1Char('/'));
return m_cursorSearchPaths;
#else
return QStringList();
#endif
}
void KCMLookandFeel::setSplashScreen(const QString &theme)
......
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