libinput: add support for LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE
This is required to get Qt EGLFS in qemu working, as qemu mouse device issues only absolute mouse events. Fixes: QTBUG-69172 Change-Id: Ia9985dc01d7871fdcd856c14160d54d3ce684396 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
parent
e2906ea5c4
commit
7d646508c8
|
|
@ -205,6 +205,9 @@ void QLibInputHandler::processEvent(libinput_event *ev)
|
|||
case LIBINPUT_EVENT_POINTER_MOTION:
|
||||
m_pointer->processMotion(libinput_event_get_pointer_event(ev));
|
||||
break;
|
||||
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
m_pointer->processAbsMotion(libinput_event_get_pointer_event(ev));
|
||||
break;
|
||||
case LIBINPUT_EVENT_POINTER_AXIS:
|
||||
m_pointer->processAxis(libinput_event_get_pointer_event(ev));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -103,6 +103,24 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e)
|
|||
Qt::NoButton, QEvent::MouseMove, mods);
|
||||
}
|
||||
|
||||
void QLibInputPointer::processAbsMotion(libinput_event_pointer *e)
|
||||
{
|
||||
QScreen * const primaryScreen = QGuiApplication::primaryScreen();
|
||||
const QRect g = QHighDpi::toNativePixels(primaryScreen->virtualGeometry(), primaryScreen);
|
||||
|
||||
const double x = libinput_event_pointer_get_absolute_x_transformed(e, g.width());
|
||||
const double y = libinput_event_pointer_get_absolute_y_transformed(e, g.height());
|
||||
|
||||
m_pos.setX(qBound(g.left(), qRound(g.left() + x), g.right()));
|
||||
m_pos.setY(qBound(g.top(), qRound(g.top() + y), g.bottom()));
|
||||
|
||||
Qt::KeyboardModifiers mods = QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers();
|
||||
|
||||
QWindowSystemInterface::handleMouseEvent(nullptr, m_pos, m_pos, m_buttons,
|
||||
Qt::NoButton, QEvent::MouseMove, mods);
|
||||
|
||||
}
|
||||
|
||||
void QLibInputPointer::processAxis(libinput_event_pointer *e)
|
||||
{
|
||||
double value; // default axis value is 15 degrees per wheel click
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public:
|
|||
|
||||
void processButton(libinput_event_pointer *e);
|
||||
void processMotion(libinput_event_pointer *e);
|
||||
void processAbsMotion(libinput_event_pointer *e);
|
||||
void processAxis(libinput_event_pointer *e);
|
||||
|
||||
void setPos(const QPoint &pos);
|
||||
|
|
|
|||
Loading…
Reference in New Issue