Commit 1e804fd9 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[kcm/touchpad] Allow to build without synaptics

Currently the whole touchpad KCM is not built if synaptics isn't found.

However synaptics is only required for the old synaptics variant, the
newer libinput variant works without it.

This patch allows to build the libinput one without synaptics headers
present
parent 8f2b38ae
......@@ -150,7 +150,11 @@ pkg_check_modules(EVDEV xorg-evdev>=2.8.99.1 IMPORTED_TARGET)
find_package(Synaptics)
set_package_properties(Synaptics PROPERTIES TYPE OPTIONAL)
add_feature_info("Synaptics" SYNAPTICS_FOUND "Synaptics libraries needed for touchpad KCM")
add_feature_info("Synaptics" SYNAPTICS_FOUND "Synaptics libraries are needed for the synaptics touchpad KCM")
if(SYNAPTICS_FOUND)
set(HAVE_SYNAPTICS 1)
endif()
if(XORGLIBINPUT_FOUND)
set(HAVE_XORGLIBINPUT 1)
......
......@@ -45,3 +45,6 @@
/* Define if you have X11 at all */
#cmakedefine01 HAVE_X11
/* Define if you have synaptics */
#cmakedefine01 HAVE_SYNAPTICS
......@@ -41,6 +41,6 @@ if (KF5Baloo_FOUND)
endif()
add_subdirectory(solid_actions)
if (SYNAPTICS_FOUND AND X11_XCB_FOUND AND X11_Xi_FOUND)
if (X11_XCB_FOUND AND X11_Xi_FOUND)
add_subdirectory(touchpad)
endif()
......@@ -4,13 +4,16 @@ SET(backend_SRCS
${backend_SRCS}
backends/x11/propertyinfo.cpp
backends/x11/xlibbackend.cpp
backends/x11/synapticstouchpad.cpp
backends/x11/xlibtouchpad.cpp
backends/x11/xcbatom.cpp
backends/x11/xlibnotifications.cpp
backends/x11/xrecordkeyboardmonitor.cpp
)
if(SYNAPTICS_FOUND)
list(APPEND backend_SRCS backends/x11/synapticstouchpad.cpp)
endif()
if (XORGLIBINPUT_FOUND)
SET(backend_SRCS
......@@ -32,9 +35,12 @@ SET(backend_LIBS
X11::X11
X11::Xi
X11::XCB
PkgConfig::SYNAPTICS
)
if(SYNAPTICS_FOUND)
list(APPEND backend_LIBS PkgConfig::SYNAPTICS)
endif()
add_executable(kcm-touchpad-list-devices backends/x11/listdevices.cpp)
target_link_libraries(kcm-touchpad-list-devices
X11::X11
......
......@@ -38,7 +38,9 @@
#include <X11/extensions/XInput.h>
#include <X11/extensions/XInput2.h>
#if HAVE_SYNAPTICS
#include <synaptics-properties.h>
#endif
#include <xserver-properties.h>
struct DeviceListDeleter {
......@@ -90,7 +92,9 @@ XlibBackend::XlibBackend(QObject *parent)
m_touchpadAtom.intern(m_connection, XI_TOUCHPAD);
m_enabledAtom.intern(m_connection, XI_PROP_ENABLED);
#if HAVE_SYNAPTICS
m_synapticsIdentifierAtom.intern(m_connection, SYNAPTICS_PROP_CAPABILITIES);
#endif
m_libinputIdentifierAtom.intern(m_connection, "libinput Send Events Modes Available");
m_device.reset(findTouchpad());
......@@ -120,10 +124,12 @@ XlibTouchpad *XlibBackend::findTouchpad()
return new LibinputTouchpad(m_display.data(), info->id);
}
#endif
#if HAVE_SYNAPTICS
if (*atom == m_synapticsIdentifierAtom.atom()) {
setMode(TouchpadInputBackendMode::XSynaptics);
return new SynapticsTouchpad(m_display.data(), info->id);
}
#endif
}
}
......@@ -352,10 +358,13 @@ QVector<QObject *> XlibBackend::getDevices() const
}
#endif
#if HAVE_SYNAPTICS
SynapticsTouchpad *synaptics = dynamic_cast<SynapticsTouchpad *>(m_device.data());
if (synaptics) {
touchpads.push_back(synaptics);
}
#endif
return touchpads;
}
......
Supports Markdown
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