diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f17fc477b..cbf9529ca0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -176,27 +176,19 @@ set_package_properties(XKB PROPERTIES
)
find_package(Libinput 1.9)
-set_package_properties(Libinput PROPERTIES TYPE OPTIONAL PURPOSE "Required for input handling on Wayland.")
+set_package_properties(Libinput PROPERTIES TYPE REQUIRED PURPOSE "Required for input handling on Wayland.")
find_package(UDev)
set_package_properties(UDev PROPERTIES URL "http://www.freedesktop.org/software/systemd/libudev/"
DESCRIPTION "Linux device library."
- TYPE OPTIONAL
+ TYPE REQUIRED
PURPOSE "Required for input handling on Wayland."
)
-set(HAVE_INPUT FALSE)
-if (Libinput_FOUND AND UDEV_FOUND)
- set(HAVE_INPUT TRUE)
-endif()
-set(HAVE_UDEV FALSE)
-if (UDEV_FOUND)
- set(HAVE_UDEV TRUE)
-endif()
find_package(Libdrm 2.4.62)
set_package_properties(Libdrm PROPERTIES TYPE OPTIONAL PURPOSE "Required for drm output on Wayland.")
set(HAVE_DRM FALSE)
-if(Libdrm_FOUND AND UDEV_FOUND)
+if(Libdrm_FOUND)
set(HAVE_DRM TRUE)
endif()
@@ -482,6 +474,12 @@ set(kwin_KDEINIT_SRCS
rootinfo_filter.cpp
orientation_sensor.cpp
idle_inhibition.cpp
+ libinput/context.cpp
+ libinput/connection.cpp
+ libinput/device.cpp
+ libinput/events.cpp
+ libinput/libinput_logging.cpp
+ udev.cpp
)
include(ECMQtDeclareLoggingCategory)
@@ -518,28 +516,11 @@ if(KWIN_BUILD_ACTIVITIES)
)
endif()
-if(UDEV_FOUND)
- set(kwin_KDEINIT_SRCS
- ${kwin_KDEINIT_SRCS}
- udev.cpp
- )
-endif()
-
-if(HAVE_INPUT)
- set(kwin_KDEINIT_SRCS
- ${kwin_KDEINIT_SRCS}
- libinput/context.cpp
- libinput/connection.cpp
- libinput/device.cpp
- libinput/events.cpp
- libinput/libinput_logging.cpp
- )
- if (HAVE_LINUX_VT_H)
- set(kwin_KDEINIT_SRCS
- ${kwin_KDEINIT_SRCS}
- virtual_terminal.cpp
- )
- endif()
+if (HAVE_LINUX_VT_H)
+ set(kwin_KDEINIT_SRCS
+ ${kwin_KDEINIT_SRCS}
+ virtual_terminal.cpp
+ )
endif()
kconfig_add_kcfg_files(kwin_KDEINIT_SRCS settings.kcfgc)
@@ -634,16 +615,10 @@ set(kwinLibs
${kwin_XLIB_LIBS}
${kwin_XCB_LIBS}
${kwin_WAYLAND_LIBS}
+ ${UDEV_LIBS}
+ Libinput::Libinput
)
-if(UDEV_FOUND)
- set(kwinLibs ${kwinLibs} ${UDEV_LIBS})
-endif()
-
-if(HAVE_INPUT)
- set(kwinLibs ${kwinLibs} Libinput::Libinput)
-endif()
-
add_library(kwin SHARED ${kwin_KDEINIT_SRCS})
set_target_properties(kwin PROPERTIES
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index b5cfbc8265..35b420233e 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -3,9 +3,7 @@ remove_definitions(-DQT_USE_QSTRINGBUILDER)
add_subdirectory(libkwineffects)
add_subdirectory(libxrenderutils)
add_subdirectory(integration)
-if (HAVE_INPUT)
- add_subdirectory(libinput)
-endif()
+add_subdirectory(libinput)
if (HAVE_DRM)
add_subdirectory(drm)
endif()
diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake
index 1566d649f6..8f680800f0 100644
--- a/config-kwin.h.cmake
+++ b/config-kwin.h.cmake
@@ -9,7 +9,6 @@
#define KWIN_KILLER_BIN "${CMAKE_INSTALL_FULL_LIBEXECDIR}/kwin_killer_helper"
#define KWIN_RULES_DIALOG_BIN "${CMAKE_INSTALL_FULL_LIBEXECDIR}/kwin_rules_dialog"
#define KWIN_XCLIPBOARD_SYNC_BIN "${CMAKE_INSTALL_FULL_LIBEXECDIR}/org_kde_kwin_xclipboard_syncer"
-#cmakedefine01 HAVE_INPUT
#cmakedefine01 HAVE_X11_XCB
#cmakedefine01 HAVE_X11_XINPUT
#cmakedefine01 HAVE_DRM
@@ -23,7 +22,6 @@
#cmakedefine01 HAVE_PROC_TRACE_CTL
#cmakedefine01 HAVE_SYS_SYSMACROS_H
#cmakedefine01 HAVE_BREEZE_DECO
-#cmakedefine01 HAVE_UDEV
#cmakedefine01 HAVE_LIBCAP
#cmakedefine01 HAVE_SCHED_RESET_ON_FORK
#if HAVE_BREEZE_DECO
diff --git a/debug_console.cpp b/debug_console.cpp
index 44aed0f9f0..a556bb38bb 100644
--- a/debug_console.cpp
+++ b/debug_console.cpp
@@ -28,10 +28,8 @@ along with this program. If not, see .
#include "wayland_server.h"
#include "workspace.h"
#include "keyboard_input.h"
-#if HAVE_INPUT
#include "libinput/connection.h"
#include "libinput/device.h"
-#endif
#include
#include
@@ -143,7 +141,6 @@ static QString buttonToString(Qt::MouseButton button)
}
}
-#if HAVE_INPUT
static QString deviceRow(LibInput::Device *device)
{
if (!device) {
@@ -151,7 +148,6 @@ static QString deviceRow(LibInput::Device *device)
}
return tableRow(i18n("Input Device"), QStringLiteral("%1 (%2)").arg(device->name()).arg(device->sysName()));
}
-#endif
static QString buttonsToString(Qt::MouseButtons buttons)
{
@@ -186,9 +182,7 @@ void DebugConsoleFilter::pointerEvent(MouseEvent *event)
switch (event->type()) {
case QEvent::MouseMove: {
text.append(tableHeaderRow(i18nc("A mouse pointer motion event", "Pointer Motion")));
-#if HAVE_INPUT
text.append(deviceRow(event->device()));
-#endif
text.append(timestamp);
if (event->timestampMicroseconds() != 0) {
text.append(timestampRowUsec(event->timestampMicroseconds()));
@@ -206,9 +200,7 @@ void DebugConsoleFilter::pointerEvent(MouseEvent *event)
}
case QEvent::MouseButtonPress:
text.append(tableHeaderRow(i18nc("A mouse pointer button press event", "Pointer Button Press")));
-#if HAVE_INPUT
text.append(deviceRow(event->device()));
-#endif
text.append(timestamp);
text.append(tableRow(i18nc("A button in a mouse press/release event", "Button"), buttonToString(event->button())));
text.append(tableRow(i18nc("A button in a mouse press/release event", "Native Button code"), event->nativeButton()));
@@ -216,9 +208,7 @@ void DebugConsoleFilter::pointerEvent(MouseEvent *event)
break;
case QEvent::MouseButtonRelease:
text.append(tableHeaderRow(i18nc("A mouse pointer button release event", "Pointer Button Release")));
-#if HAVE_INPUT
text.append(deviceRow(event->device()));
-#endif
text.append(timestamp);
text.append(tableRow(i18nc("A button in a mouse press/release event", "Button"), buttonToString(event->button())));
text.append(tableRow(i18nc("A button in a mouse press/release event", "Native Button code"), event->nativeButton()));
@@ -238,9 +228,7 @@ void DebugConsoleFilter::wheelEvent(WheelEvent *event)
QString text = s_hr;
text.append(s_tableStart);
text.append(tableHeaderRow(i18nc("A mouse pointer axis (wheel) event", "Pointer Axis")));
-#if HAVE_INPUT
- text.append(deviceRow(event->device()));
-#endif
+ text.append(deviceRow(event->device()));
text.append(timestampRow(event->timestamp()));
const Qt::Orientation orientation = event->angleDelta().x() == 0 ? Qt::Vertical : Qt::Horizontal;
text.append(tableRow(i18nc("The orientation of a pointer axis event", "Orientation"),
@@ -268,9 +256,7 @@ void DebugConsoleFilter::keyEvent(KeyEvent *event)
default:
break;
}
-#if HAVE_INPUT
- text.append(deviceRow(event->device()));
-#endif
+ text.append(deviceRow(event->device()));
auto modifiersToString = [event] {
QString ret;
if (event->modifiers().testFlag(Qt::ShiftModifier)) {
@@ -468,7 +454,6 @@ void DebugConsoleFilter::switchEvent(SwitchEvent *event)
if (event->timestampMicroseconds() != 0) {
text.append(timestampRowUsec(event->timestampMicroseconds()));
}
-#if HAVE_INPUT
text.append(deviceRow(event->device()));
QString switchName;
if (event->device()->isLidSwitch()) {
@@ -477,7 +462,6 @@ void DebugConsoleFilter::switchEvent(SwitchEvent *event)
switchName = i18nc("Name of a hardware switch", "Tablet mode");
}
text.append(tableRow(i18nc("A hardware switch", "Switch"), switchName));
-#endif
QString switchState;
switch (event->state()) {
case SwitchEvent::State::Off:
@@ -505,12 +489,10 @@ DebugConsole::DebugConsole()
m_ui->windowsView->setItemDelegate(new DebugConsoleDelegate(this));
m_ui->windowsView->setModel(new DebugConsoleModel(this));
m_ui->surfacesView->setModel(new SurfaceTreeModel(this));
-#if HAVE_INPUT
if (kwinApp()->usesLibinput()) {
m_ui->inputDevicesView->setModel(new InputDeviceModel(this));
m_ui->inputDevicesView->setItemDelegate(new DebugConsoleDelegate(this));
}
-#endif
m_ui->quitButton->setIcon(QIcon::fromTheme(QStringLiteral("application-exit")));
m_ui->tabWidget->setTabIcon(0, QIcon::fromTheme(QStringLiteral("view-list-tree")));
m_ui->tabWidget->setTabIcon(1, QIcon::fromTheme(QStringLiteral("view-list-tree")));
@@ -1408,7 +1390,6 @@ QVariant SurfaceTreeModel::data(const QModelIndex &index, int role) const
return QVariant();
}
-#if HAVE_INPUT
InputDeviceModel::InputDeviceModel(QObject *parent)
: QAbstractItemModel(parent)
, m_devices(LibInput::Connection::self()->devices())
@@ -1541,6 +1522,4 @@ void InputDeviceModel::setupDeviceConnections(LibInput::Device *device)
);
}
-#endif
-
}
diff --git a/debug_console.h b/debug_console.h
index 27503d3395..6cda3ff523 100644
--- a/debug_console.h
+++ b/debug_console.h
@@ -156,8 +156,6 @@ private:
QTextEdit *m_textEdit;
};
-#if HAVE_INPUT
-
namespace LibInput
{
class Device;
@@ -180,7 +178,6 @@ private:
void setupDeviceConnections(LibInput::Device *device);
QVector m_devices;
};
-#endif
}
diff --git a/input.cpp b/input.cpp
index 9766115384..7eaa967890 100644
--- a/input.cpp
+++ b/input.cpp
@@ -36,10 +36,8 @@ along with this program. If not, see .
#include "screenedge.h"
#include "screens.h"
#include "workspace.h"
-#if HAVE_INPUT
#include "libinput/connection.h"
#include "libinput/device.h"
-#endif
#include "platform.h"
#include "popup_input_filter.h"
#include "shell_client.h"
@@ -191,7 +189,6 @@ void InputEventFilter::passToWaylandServer(QKeyEvent *event)
}
}
-#if HAVE_INPUT
class VirtualTerminalFilter : public InputEventFilter {
public:
bool keyEvent(QKeyEvent *event) override {
@@ -206,7 +203,6 @@ public:
return false;
}
};
-#endif
class TerminateServerFilter : public InputEventFilter {
public:
@@ -1505,7 +1501,6 @@ InputRedirection::InputRedirection(QObject *parent)
qRegisterMetaType();
qRegisterMetaType();
qRegisterMetaType();
-#if HAVE_INPUT
if (Application::usesLibinput()) {
if (LogindIntegration::self()->hasSessionControl()) {
setupLibInput();
@@ -1525,7 +1520,6 @@ InputRedirection::InputRedirection(QObject *parent)
);
}
}
-#endif
connect(kwinApp(), &Application::workspaceCreated, this, &InputRedirection::setupWorkspace);
reconfigure();
}
@@ -1670,11 +1664,9 @@ void InputRedirection::setupWorkspace()
void InputRedirection::setupInputFilters()
{
-#if HAVE_INPUT
if (LogindIntegration::self()->hasSessionControl()) {
installInputEventFilter(new VirtualTerminalFilter);
}
-#endif
if (waylandServer()) {
installInputEventFilter(new TerminateServerFilter);
installInputEventFilter(new DragAndDropInputFilter);
@@ -1702,7 +1694,6 @@ void InputRedirection::setupInputFilters()
void InputRedirection::reconfigure()
{
-#if HAVE_INPUT
if (Application::usesLibinput()) {
auto inputConfig = kwinApp()->inputConfig();
inputConfig->reparseConfiguration();
@@ -1713,7 +1704,6 @@ void InputRedirection::reconfigure()
waylandServer()->seat()->setKeyRepeatInfo(enabled ? rate : 0, delay);
}
-#endif
}
static KWayland::Server::SeatInterface *findSeat()
@@ -1727,7 +1717,6 @@ static KWayland::Server::SeatInterface *findSeat()
void InputRedirection::setupLibInput()
{
-#if HAVE_INPUT
if (!Application::usesLibinput()) {
return;
}
@@ -1841,7 +1830,6 @@ void InputRedirection::setupLibInput()
);
}
setupTouchpadShortcuts();
-#endif
}
void InputRedirection::setupTouchpadShortcuts()
@@ -1849,7 +1837,6 @@ void InputRedirection::setupTouchpadShortcuts()
if (!m_libInput) {
return;
}
-#if HAVE_INPUT
QAction *touchpadToggleAction = new QAction(this);
QAction *touchpadOnAction = new QAction(this);
QAction *touchpadOffAction = new QAction(this);
@@ -1874,16 +1861,13 @@ void InputRedirection::setupTouchpadShortcuts()
connect(touchpadToggleAction, &QAction::triggered, m_libInput, &LibInput::Connection::toggleTouchpads);
connect(touchpadOnAction, &QAction::triggered, m_libInput, &LibInput::Connection::enableTouchpads);
connect(touchpadOffAction, &QAction::triggered, m_libInput, &LibInput::Connection::disableTouchpads);
-#endif
}
bool InputRedirection::hasAlphaNumericKeyboard()
{
-#if HAVE_INPUT
if (m_libInput) {
return m_libInput->hasAlphaNumericKeyboard();
}
-#endif
return true;
}
@@ -1899,7 +1883,6 @@ bool InputRedirection::hasTabletModeSwitch()
void InputRedirection::setupLibInputWithScreens()
{
-#if HAVE_INPUT
if (!screens() || !m_libInput) {
return;
}
@@ -1911,7 +1894,6 @@ void InputRedirection::setupLibInputWithScreens()
}
);
connect(screens(), &Screens::changed, m_libInput, &LibInput::Connection::updateScreens);
-#endif
}
void InputRedirection::processPointerMotion(const QPointF &pos, uint32_t time)
diff --git a/main.cpp b/main.cpp
index 38d8ea60f2..4ed8528795 100644
--- a/main.cpp
+++ b/main.cpp
@@ -440,7 +440,6 @@ void Application::initPlatform(const KPluginMetaData &plugin)
m_platform = qobject_cast(plugin.instantiate());
if (m_platform) {
m_platform->setParent(this);
-#if HAVE_INPUT
// check whether it needs libinput
const QJsonObject &metaData = plugin.rawData();
auto it = metaData.find(QStringLiteral("input"));
@@ -452,7 +451,6 @@ void Application::initPlatform(const KPluginMetaData &plugin)
}
}
}
-#endif
}
}
diff --git a/main_wayland.cpp b/main_wayland.cpp
index 2bd59c903a..2107bc85a1 100644
--- a/main_wayland.cpp
+++ b/main_wayland.cpp
@@ -648,11 +648,9 @@ int main(int argc, char * argv[])
parser.addOption(hwcomposerOption);
}
#endif
-#if HAVE_INPUT
QCommandLineOption libinputOption(QStringLiteral("libinput"),
i18n("Enable libinput support for input events processing. Note: never use in a nested session."));
parser.addOption(libinputOption);
-#endif
#if HAVE_DRM
QCommandLineOption drmOption(QStringLiteral("drm"), i18n("Render through drm node."));
if (hasDrmOption) {
@@ -700,9 +698,7 @@ int main(int argc, char * argv[])
a.setSessionArgument(parser.value(exitWithSessionOption));
}
-#if HAVE_INPUT
KWin::Application::setUseLibinput(parser.isSet(libinputOption));
-#endif
QString pluginName;
QSize initialWindowSize;
diff --git a/plugins/platforms/CMakeLists.txt b/plugins/platforms/CMakeLists.txt
index 485baaa75a..9058f0a1ea 100644
--- a/plugins/platforms/CMakeLists.txt
+++ b/plugins/platforms/CMakeLists.txt
@@ -1,13 +1,11 @@
-if(HAVE_INPUT)
- if(HAVE_DRM)
- add_subdirectory(drm)
- endif()
- if (HAVE_LINUX_FB_H)
- add_subdirectory(fbdev)
- endif()
- if(HAVE_LIBHYBRIS)
- add_subdirectory(hwcomposer)
- endif()
+if(HAVE_DRM)
+ add_subdirectory(drm)
+endif()
+if (HAVE_LINUX_FB_H)
+ add_subdirectory(fbdev)
+endif()
+if(HAVE_LIBHYBRIS)
+ add_subdirectory(hwcomposer)
endif()
add_subdirectory(virtual)
add_subdirectory(wayland)
diff --git a/plugins/platforms/virtual/egl_gbm_backend.cpp b/plugins/platforms/virtual/egl_gbm_backend.cpp
index b4698a23f2..3057105231 100644
--- a/plugins/platforms/virtual/egl_gbm_backend.cpp
+++ b/plugins/platforms/virtual/egl_gbm_backend.cpp
@@ -23,9 +23,7 @@ along with this program. If not, see .
#include "virtual_backend.h"
#include "options.h"
#include "screens.h"
-#if HAVE_UDEV
#include "udev.h"
-#endif
#include
// kwin libs
#include
@@ -62,7 +60,6 @@ EglGbmBackend::~EglGbmBackend()
void EglGbmBackend::initGbmDevice()
{
-#if HAVE_UDEV
if (m_backend->drmFd() != -1) {
// already initialized
return;
@@ -92,7 +89,6 @@ void EglGbmBackend::initGbmDevice()
}
m_backend->setGbmDevice(gbmDevice);
#endif
-#endif
}
bool EglGbmBackend::initializeEgl()
diff --git a/tabletmodemanager.cpp b/tabletmodemanager.cpp
index d668ad1510..9776706093 100644
--- a/tabletmodemanager.cpp
+++ b/tabletmodemanager.cpp
@@ -24,9 +24,7 @@
#include "input_event.h"
#include "input_event_spy.h"
-#if HAVE_INPUT
#include "libinput/device.h"
-#endif
#include
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 48f307c77f..4bbe580e1b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -18,21 +18,19 @@ if (KF5Wayland_FOUND)
target_link_libraries(waylandclienttest Qt5::Core Qt5::Gui KF5::WaylandClient)
endif()
-if (HAVE_INPUT)
- set(libinputtest_SRCS
- libinputtest.cpp
- ${KWIN_SOURCE_DIR}/libinput/context.cpp
- ${KWIN_SOURCE_DIR}/libinput/connection.cpp
- ${KWIN_SOURCE_DIR}/libinput/device.cpp
- ${KWIN_SOURCE_DIR}/libinput/events.cpp
- ${KWIN_SOURCE_DIR}/libinput/libinput_logging.cpp
- ${KWIN_SOURCE_DIR}/logind.cpp
- ${KWIN_SOURCE_DIR}/udev.cpp
- )
- add_executable(libinputtest ${libinputtest_SRCS})
- add_definitions(-DKWIN_BUILD_TESTING)
- target_link_libraries(libinputtest Qt5::Core Qt5::DBus Libinput::Libinput ${UDEV_LIBS} KF5::ConfigCore KF5::GlobalAccel KF5::WindowSystem)
-endif()
+set(libinputtest_SRCS
+ libinputtest.cpp
+ ${KWIN_SOURCE_DIR}/libinput/context.cpp
+ ${KWIN_SOURCE_DIR}/libinput/connection.cpp
+ ${KWIN_SOURCE_DIR}/libinput/device.cpp
+ ${KWIN_SOURCE_DIR}/libinput/events.cpp
+ ${KWIN_SOURCE_DIR}/libinput/libinput_logging.cpp
+ ${KWIN_SOURCE_DIR}/logind.cpp
+ ${KWIN_SOURCE_DIR}/udev.cpp
+)
+add_executable(libinputtest ${libinputtest_SRCS})
+add_definitions(-DKWIN_BUILD_TESTING)
+target_link_libraries(libinputtest Qt5::Core Qt5::DBus Libinput::Libinput ${UDEV_LIBS} KF5::ConfigCore KF5::GlobalAccel KF5::WindowSystem)
add_executable(x11shadowreader x11shadowreader.cpp)
target_link_libraries(x11shadowreader XCB::XCB Qt5::Widgets Qt5::X11Extras KF5::ConfigCore KF5::WindowSystem)
diff --git a/workspace.cpp b/workspace.cpp
index 02ccf5aaa7..9b26efbecc 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -1365,12 +1365,6 @@ QString Workspace::supportInformation() const
support.append(yes);
#else
support.append(no);
-#endif
- support.append(QStringLiteral("HAVE_INPUT: "));
-#if HAVE_INPUT
- support.append(yes);
-#else
- support.append(no);
#endif
support.append(QStringLiteral("HAVE_DRM: "));
#if HAVE_DRM