diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,7 +175,7 @@ PURPOSE "Required for building KWin with Wayland support" ) -find_package(Libinput 1.5) +find_package(Libinput 1.9) set_package_properties(Libinput PROPERTIES TYPE OPTIONAL PURPOSE "Required for input handling on Wayland.") find_package(UDev) @@ -185,12 +185,8 @@ PURPOSE "Required for input handling on Wayland." ) set(HAVE_INPUT FALSE) -set(HAVE_INPUT_1_9 FALSE) if (Libinput_FOUND AND UDEV_FOUND) set(HAVE_INPUT TRUE) - if(${Libinput_VERSION} VERSION_GREATER "1.9.0" OR ${Libinput_VERSION} VERSION_EQUAL "1.9.0") - set(HAVE_INPUT_1_9 TRUE) - endif() endif() set(HAVE_UDEV FALSE) if (UDEV_FOUND) diff --git a/autotests/libinput/CMakeLists.txt b/autotests/libinput/CMakeLists.txt --- a/autotests/libinput/CMakeLists.txt +++ b/autotests/libinput/CMakeLists.txt @@ -68,18 +68,16 @@ ######################################################## # Test Switch Event ######################################################## -if(HAVE_INPUT_1_9) - set( testLibinputSwitchEvent_SRCS - switch_event_test.cpp - mock_libinput.cpp - ../../libinput/device.cpp - ../../libinput/events.cpp - ) - add_executable(testLibinputSwitchEvent ${testLibinputSwitchEvent_SRCS}) - target_link_libraries(testLibinputSwitchEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore) - add_test(NAME kwin-testLibinputSwitchEvent COMMAND testLibinputSwitchEvent) - ecm_mark_as_test(testLibinputSwitchEvent) -endif() +set( testLibinputSwitchEvent_SRCS + switch_event_test.cpp + mock_libinput.cpp + ../../libinput/device.cpp + ../../libinput/events.cpp + ) +add_executable(testLibinputSwitchEvent ${testLibinputSwitchEvent_SRCS}) +target_link_libraries(testLibinputSwitchEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore) +add_test(NAME kwin-testLibinputSwitchEvent COMMAND testLibinputSwitchEvent) +ecm_mark_as_test(testLibinputSwitchEvent) ######################################################## # Test Context diff --git a/autotests/libinput/device_test.cpp b/autotests/libinput/device_test.cpp --- a/autotests/libinput/device_test.cpp +++ b/autotests/libinput/device_test.cpp @@ -221,9 +221,7 @@ QTest::newRow("pointer/touch") << false << true << true << false << false; QTest::newRow("keyboard/pointer/touch") << true << true << true << false << false; QTest::newRow("tabletTool") << false << false << false << true << false; -#if HAVE_INPUT_1_9 QTest::newRow("switch") << false << false << false << false << true; -#endif } void TestLibinputDevice::testDeviceType() @@ -2181,7 +2179,6 @@ void TestLibinputDevice::testSwitch() { -#if HAVE_INPUT_1_9 libinput_device device; device.switchDevice = true; QFETCH(bool, lid); @@ -2195,9 +2192,6 @@ QCOMPARE(d.property("lidSwitch").toBool(), lid); QCOMPARE(d.isTabletModeSwitch(), tablet); QCOMPARE(d.property("tabletModeSwitch").toBool(), tablet); -#else - QSKIP("Requires libinput 1.9"); -#endif } QTEST_GUILESS_MAIN(TestLibinputDevice) diff --git a/autotests/libinput/mock_libinput.cpp b/autotests/libinput/mock_libinput.cpp --- a/autotests/libinput/mock_libinput.cpp +++ b/autotests/libinput/mock_libinput.cpp @@ -41,10 +41,8 @@ return device->gestureSupported; case LIBINPUT_DEVICE_CAP_TABLET_TOOL: return device->tabletTool; -#if HAVE_INPUT_1_9 case LIBINPUT_DEVICE_CAP_SWITCH: return device->switchDevice; -#endif default: return 0; } @@ -815,8 +813,6 @@ return device->defaultScrollButton; } -#if HAVE_INPUT_1_9 - int libinput_device_switch_has_switch(struct libinput_device *device, enum libinput_switch sw) { switch (sw) { @@ -860,5 +856,3 @@ { return event->timeMicroseconds; } - -#endif diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake --- a/config-kwin.h.cmake +++ b/config-kwin.h.cmake @@ -10,7 +10,6 @@ #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_INPUT_1_9 #cmakedefine01 HAVE_X11_XCB #cmakedefine01 HAVE_X11_XINPUT #cmakedefine01 HAVE_DRM diff --git a/libinput/connection.cpp b/libinput/connection.cpp --- a/libinput/connection.cpp +++ b/libinput/connection.cpp @@ -460,7 +460,6 @@ } break; } -#if HAVE_INPUT_1_9 case LIBINPUT_EVENT_SWITCH_TOGGLE: { SwitchEvent *se = static_cast(event.data()); switch (se->state()) { @@ -475,7 +474,6 @@ } break; } -#endif default: // nothing break; diff --git a/libinput/device.cpp b/libinput/device.cpp --- a/libinput/device.cpp +++ b/libinput/device.cpp @@ -163,11 +163,9 @@ , m_tabletPad(false) #endif , m_supportsGesture(libinput_device_has_capability(m_device, LIBINPUT_DEVICE_CAP_GESTURE)) -#if HAVE_INPUT_1_9 , m_switch(libinput_device_has_capability(m_device, LIBINPUT_DEVICE_CAP_SWITCH)) , m_lidSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_LID) : false) , m_tabletSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_TABLET_MODE) : false) -#endif , m_name(QString::fromLocal8Bit(libinput_device_get_name(m_device))) , m_sysName(QString::fromLocal8Bit(libinput_device_get_sysname(m_device))) , m_outputName(QString::fromLocal8Bit(libinput_device_get_output_name(m_device))) diff --git a/libinput/events.h b/libinput/events.h --- a/libinput/events.h +++ b/libinput/events.h @@ -24,11 +24,6 @@ #include -#include -#if !(HAVE_INPUT_1_9) -struct libinput_event_switch; -#endif - namespace KWin { namespace LibInput diff --git a/libinput/events.cpp b/libinput/events.cpp --- a/libinput/events.cpp +++ b/libinput/events.cpp @@ -57,10 +57,8 @@ case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: case LIBINPUT_EVENT_GESTURE_PINCH_END: return new PinchGestureEvent(event, t); -#if HAVE_INPUT_1_9 case LIBINPUT_EVENT_SWITCH_TOGGLE: return new SwitchEvent(event, t); -#endif default: return new Event(event, t); } @@ -290,19 +288,14 @@ SwitchEvent::SwitchEvent(libinput_event *event, libinput_event_type type) : Event(event, type) -#if HAVE_INPUT_1_9 , m_switchEvent(libinput_event_get_switch_event(event)) -#else - , m_switchEvent(nullptr) -#endif { } SwitchEvent::~SwitchEvent() = default; SwitchEvent::State SwitchEvent::state() const { -#if HAVE_INPUT_1_9 switch (libinput_event_switch_get_switch_state(m_switchEvent)) { case LIBINPUT_SWITCH_STATE_OFF: @@ -312,24 +305,17 @@ default: Q_UNREACHABLE(); } -#endif return State::Off; } quint32 SwitchEvent::time() const { -#if HAVE_INPUT_1_9 return libinput_event_switch_get_time(m_switchEvent); -#endif - return 0; } quint64 SwitchEvent::timeMicroseconds() const { -#if HAVE_INPUT_1_9 return libinput_event_switch_get_time_usec(m_switchEvent); -#endif - return 0; } }