diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,27 +176,19 @@ ) 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 @@ 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 @@ ) 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 @@ ${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 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -3,9 +3,7 @@ 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 --- 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.h b/debug_console.h --- a/debug_console.h +++ b/debug_console.h @@ -156,8 +156,6 @@ QTextEdit *m_textEdit; }; -#if HAVE_INPUT - namespace LibInput { class Device; @@ -180,7 +178,6 @@ void setupDeviceConnections(LibInput::Device *device); QVector m_devices; }; -#endif } diff --git a/debug_console.cpp b/debug_console.cpp --- a/debug_console.cpp +++ b/debug_console.cpp @@ -28,10 +28,8 @@ #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,15 +141,13 @@ } } -#if HAVE_INPUT static QString deviceRow(LibInput::Device *device) { if (!device) { return tableRow(i18n("Input Device"), i18nc("The input device of the event is not known", "Unknown")); } 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 @@ 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,19 +200,15 @@ } 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())); text.append(tableRow(i18nc("All currently pressed buttons in a mouse press/release event", "Pressed Buttons"), buttonsToString(event->buttons()))); 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 @@ 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 @@ 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,16 +454,14 @@ if (event->timestampMicroseconds() != 0) { text.append(timestampRowUsec(event->timestampMicroseconds())); } -#if HAVE_INPUT text.append(deviceRow(event->device())); QString switchName; if (event->device()->isLidSwitch()) { switchName = i18nc("Name of a hardware switch", "Notebook lid"); } else if (event->device()->isTabletModeSwitch()) { 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 @@ 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 @@ return QVariant(); } -#if HAVE_INPUT InputDeviceModel::InputDeviceModel(QObject *parent) : QAbstractItemModel(parent) , m_devices(LibInput::Connection::self()->devices()) @@ -1541,6 +1522,4 @@ ); } -#endif - } diff --git a/input.cpp b/input.cpp --- a/input.cpp +++ b/input.cpp @@ -36,10 +36,8 @@ #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 @@ } } -#if HAVE_INPUT class VirtualTerminalFilter : public InputEventFilter { public: bool keyEvent(QKeyEvent *event) override { @@ -206,7 +203,6 @@ return false; } }; -#endif class TerminateServerFilter : public InputEventFilter { public: @@ -1505,7 +1501,6 @@ qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); -#if HAVE_INPUT if (Application::usesLibinput()) { if (LogindIntegration::self()->hasSessionControl()) { setupLibInput(); @@ -1525,7 +1520,6 @@ ); } } -#endif connect(kwinApp(), &Application::workspaceCreated, this, &InputRedirection::setupWorkspace); reconfigure(); } @@ -1670,11 +1664,9 @@ 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::reconfigure() { -#if HAVE_INPUT if (Application::usesLibinput()) { auto inputConfig = kwinApp()->inputConfig(); inputConfig->reparseConfiguration(); @@ -1713,7 +1704,6 @@ waylandServer()->seat()->setKeyRepeatInfo(enabled ? rate : 0, delay); } -#endif } static KWayland::Server::SeatInterface *findSeat() @@ -1727,7 +1717,6 @@ void InputRedirection::setupLibInput() { -#if HAVE_INPUT if (!Application::usesLibinput()) { return; } @@ -1841,15 +1830,13 @@ ); } setupTouchpadShortcuts(); -#endif } 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 @@ 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 @@ void InputRedirection::setupLibInputWithScreens() { -#if HAVE_INPUT if (!screens() || !m_libInput) { return; } @@ -1911,7 +1894,6 @@ } ); 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 --- a/main.cpp +++ b/main.cpp @@ -440,7 +440,6 @@ 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 @@ } } } -#endif } } diff --git a/main_wayland.cpp b/main_wayland.cpp --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -648,11 +648,9 @@ 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 @@ 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 --- 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 --- a/plugins/platforms/virtual/egl_gbm_backend.cpp +++ b/plugins/platforms/virtual/egl_gbm_backend.cpp @@ -23,9 +23,7 @@ #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 @@ void EglGbmBackend::initGbmDevice() { -#if HAVE_UDEV if (m_backend->drmFd() != -1) { // already initialized return; @@ -92,7 +89,6 @@ } m_backend->setGbmDevice(gbmDevice); #endif -#endif } bool EglGbmBackend::initializeEgl() diff --git a/tabletmodemanager.cpp b/tabletmodemanager.cpp --- 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 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -18,21 +18,19 @@ 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 --- a/workspace.cpp +++ b/workspace.cpp @@ -1365,12 +1365,6 @@ 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