Adjust to newer libinput and require at least 0.10
There was API changes regarding axis event handling. CCBUG: 342893
This commit is contained in:
parent
7d797387d7
commit
e886bd7c78
4 changed files with 21 additions and 14 deletions
|
@ -137,7 +137,7 @@ set_package_properties(XKB PROPERTIES
|
|||
PURPOSE "Required for building KWin with Wayland support"
|
||||
)
|
||||
|
||||
find_package(Libinput 0.5)
|
||||
find_package(Libinput 0.10)
|
||||
set_package_properties(Libinput PROPERTIES TYPE OPTIONAL PURPOSE "Required for input handling on Wayland.")
|
||||
|
||||
find_package(UDev)
|
||||
|
@ -147,7 +147,7 @@ set_package_properties(UDev PROPERTIES URL "http://www.freedesktop.org/software
|
|||
PURPOSE "Required for input handling on Wayland."
|
||||
)
|
||||
set(HAVE_INPUT FALSE)
|
||||
if (Libinput_FOUND AND UDEV_FOUND AND Libinput_VERSION VERSION_LESS 0.8)
|
||||
if (Libinput_FOUND AND UDEV_FOUND)
|
||||
set(HAVE_INPUT TRUE)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -115,7 +115,10 @@ void Connection::handleEvent()
|
|||
}
|
||||
case LIBINPUT_EVENT_POINTER_AXIS: {
|
||||
PointerEvent *pe = static_cast<PointerEvent*>(event.data());
|
||||
emit pointerAxisChanged(pe->axis(), pe->axisValue(), pe->time());
|
||||
const auto axis = pe->axis();
|
||||
for (auto it = axis.begin(); it != axis.end(); ++it) {
|
||||
emit pointerAxisChanged(*it, pe->axisValue(*it), pe->time());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LIBINPUT_EVENT_POINTER_BUTTON: {
|
||||
|
|
|
@ -143,22 +143,26 @@ InputRedirection::PointerButtonState PointerEvent::buttonState() const
|
|||
abort();
|
||||
}
|
||||
|
||||
InputRedirection::PointerAxis PointerEvent::axis() const
|
||||
QVector<InputRedirection::PointerAxis> PointerEvent::axis() const
|
||||
{
|
||||
Q_ASSERT(type() == LIBINPUT_EVENT_POINTER_AXIS);
|
||||
switch (libinput_event_pointer_get_axis(m_pointerEvent)) {
|
||||
case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
|
||||
return InputRedirection::PointerAxisHorizontal;
|
||||
case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
|
||||
return InputRedirection::PointerAxisVertical;
|
||||
QVector<InputRedirection::PointerAxis> a;
|
||||
if (libinput_event_pointer_has_axis(m_pointerEvent, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
|
||||
a << InputRedirection::PointerAxisHorizontal;
|
||||
}
|
||||
abort();
|
||||
if (libinput_event_pointer_has_axis(m_pointerEvent, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) {
|
||||
a << InputRedirection::PointerAxisVertical;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
qreal PointerEvent::axisValue() const
|
||||
qreal PointerEvent::axisValue(InputRedirection::PointerAxis axis) const
|
||||
{
|
||||
Q_ASSERT(type() == LIBINPUT_EVENT_POINTER_AXIS);
|
||||
return libinput_event_pointer_get_axis_value(m_pointerEvent);
|
||||
const libinput_pointer_axis a = axis == InputRedirection::PointerAxisHorizontal
|
||||
? LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL
|
||||
: LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
|
||||
return libinput_event_pointer_get_axis_value(m_pointerEvent, a);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,8 +87,8 @@ public:
|
|||
uint32_t button() const;
|
||||
InputRedirection::PointerButtonState buttonState() const;
|
||||
uint32_t time() const;
|
||||
InputRedirection::PointerAxis axis() const;
|
||||
qreal axisValue() const;
|
||||
QVector<InputRedirection::PointerAxis> axis() const;
|
||||
qreal axisValue(InputRedirection::PointerAxis a) const;
|
||||
|
||||
operator libinput_event_pointer*() {
|
||||
return m_pointerEvent;
|
||||
|
|
Loading…
Reference in a new issue