Require libinput version 1.9

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9930
This commit is contained in:
Martin Flöser 2018-01-16 20:54:11 +01:00
parent 68aef25934
commit 4cc1d7a245
9 changed files with 11 additions and 53 deletions

View file

@ -175,7 +175,7 @@ set_package_properties(XKB PROPERTIES
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 @@ set_package_properties(UDev PROPERTIES URL "http://www.freedesktop.org/software
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)

View file

@ -68,18 +68,16 @@ ecm_mark_as_test(testLibinputGestureEvent)
########################################################
# 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

View file

@ -221,9 +221,7 @@ void TestLibinputDevice::testDeviceType_data()
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_data()
void TestLibinputDevice::testSwitch()
{
#if HAVE_INPUT_1_9
libinput_device device;
device.switchDevice = true;
QFETCH(bool, lid);
@ -2195,9 +2192,6 @@ void TestLibinputDevice::testSwitch()
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)

View file

@ -41,10 +41,8 @@ int libinput_device_has_capability(struct libinput_device *device, enum libinput
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 @@ uint32_t libinput_device_config_scroll_get_default_button(struct libinput_device
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 @@ uint64_t libinput_event_switch_get_time_usec(struct libinput_event_switch *event
{
return event->timeMicroseconds;
}
#endif

View file

@ -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

View file

@ -460,7 +460,6 @@ void Connection::processEvents()
}
break;
}
#if HAVE_INPUT_1_9
case LIBINPUT_EVENT_SWITCH_TOGGLE: {
SwitchEvent *se = static_cast<SwitchEvent*>(event.data());
switch (se->state()) {
@ -475,7 +474,6 @@ void Connection::processEvents()
}
break;
}
#endif
default:
// nothing
break;

View file

@ -163,11 +163,9 @@ Device::Device(libinput_device *device, QObject *parent)
, 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)))

View file

@ -57,10 +57,8 @@ Event *Event::create(libinput_event *event)
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,11 +288,7 @@ SwipeGestureEvent::~SwipeGestureEvent() = default;
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
{
}
@ -302,7 +296,6 @@ 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 @@ SwitchEvent::State SwitchEvent::state() const
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;
}
}

View file

@ -24,11 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libinput.h>
#include <config-kwin.h>
#if !(HAVE_INPUT_1_9)
struct libinput_event_switch;
#endif
namespace KWin
{
namespace LibInput