summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/input')
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp2
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h2
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp6
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h2
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp3
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h5
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp30
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h4
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp6
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h3
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp7
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h2
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp2
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h2
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp7
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h2
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler.cpp22
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler_p.h8
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard_p.h3
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp23
20 files changed, 60 insertions, 81 deletions
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index d6c7173d3c..2d6426db7f 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -87,7 +87,7 @@ QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer
// socket notifier for events on the keyboard device
m_notify = new QSocketNotifier(m_fd.get(), QSocketNotifier::Read, this);
- connect(m_notify, SIGNAL(activated(int)), this, SLOT(readKeycode()));
+ connect(m_notify, &QSocketNotifier::activated, this, &QEvdevKeyboardHandler::readKeycode);
}
QEvdevKeyboardHandler::~QEvdevKeyboardHandler()
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
index 1ec4915855..7c64c4febb 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
@@ -145,7 +145,6 @@ public:
class QEvdevKeyboardHandler : public QObject
{
- Q_OBJECT
public:
QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile);
~QEvdevKeyboardHandler();
@@ -190,7 +189,6 @@ public:
bool loadKeymap(const QString &file);
void unloadKeymap();
-private slots:
void readKeycode();
KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat);
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
index 94ebae8f42..85e6a80879 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
@@ -88,8 +88,10 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
for (const QString &device : devices)
addKeyboard(device);
- connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addKeyboard(QString)));
- connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeKeyboard(QString)));
+ connect(m_deviceDiscovery, &QDeviceDiscovery::deviceDetected,
+ this, &QEvdevKeyboardManager::addKeyboard);
+ connect(m_deviceDiscovery, &QDeviceDiscovery::deviceRemoved,
+ this, &QEvdevKeyboardManager::removeKeyboard);
}
}
}
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h
index d2e34fead3..27ea7e468e 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h
@@ -63,14 +63,12 @@ QT_BEGIN_NAMESPACE
class QEvdevKeyboardManager : public QObject
{
- Q_OBJECT
public:
QEvdevKeyboardManager(const QString &key, const QString &specification, QObject *parent = 0);
~QEvdevKeyboardManager();
void loadKeymap(const QString &file);
-private slots:
void addKeyboard(const QString &deviceNode = QString());
void removeKeyboard(const QString &deviceNode);
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
index bcc5a21669..cd7eec3861 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
@@ -116,7 +116,8 @@ QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool abs,
// socket notifier for events on the mouse device
m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
- connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
+ connect(m_notify, &QSocketNotifier::activated,
+ this, &QEvdevMouseHandler::readMouseData);
}
QEvdevMouseHandler::~QEvdevMouseHandler()
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h
index 79156645da..6cad4b9173 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h
+++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h
@@ -66,13 +66,12 @@ public:
static QEvdevMouseHandler *create(const QString &device, const QString &specification);
~QEvdevMouseHandler();
+ void readMouseData();
+
signals:
void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons);
void handleWheelEvent(QPoint delta);
-private slots:
- void readMouseData();
-
private:
QEvdevMouseHandler(const QString &device, int fd, bool abs, bool compression, int jitterLimit);
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
index 6264e4ada2..ba94bcd460 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
@@ -94,13 +94,19 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
for (const QString &device : devices)
addMouse(device);
- connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addMouse(QString)));
- connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeMouse(QString)));
+ connect(m_deviceDiscovery, &QDeviceDiscovery::deviceDetected,
+ this, &QEvdevMouseManager::addMouse);
+ connect(m_deviceDiscovery, &QDeviceDiscovery::deviceRemoved,
+ this, &QEvdevMouseManager::removeMouse);
}
}
- connect(QGuiApplicationPrivate::inputDeviceManager(), SIGNAL(cursorPositionChangeRequested(QPoint)),
- this, SLOT(handleCursorPositionChange(QPoint)));
+ QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
+ connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [=](const QPoint &pos) {
+ m_x = pos.x();
+ m_y = pos.y();
+ clampPosition();
+ });
}
QEvdevMouseManager::~QEvdevMouseManager()
@@ -153,11 +159,12 @@ void QEvdevMouseManager::handleWheelEvent(QPoint delta)
void QEvdevMouseManager::addMouse(const QString &deviceNode)
{
qCDebug(qLcEvdevMouse) << "Adding mouse at" << deviceNode;
- QEvdevMouseHandler *handler;
- handler = QEvdevMouseHandler::create(deviceNode, m_spec);
+ QEvdevMouseHandler *handler = QEvdevMouseHandler::create(deviceNode, m_spec);
if (handler) {
- connect(handler, SIGNAL(handleMouseEvent(int,int,bool,Qt::MouseButtons)), this, SLOT(handleMouseEvent(int,int,bool,Qt::MouseButtons)));
- connect(handler, SIGNAL(handleWheelEvent(QPoint)), this, SLOT(handleWheelEvent(QPoint)));
+ connect(handler, &QEvdevMouseHandler::handleMouseEvent,
+ this, &QEvdevMouseManager::handleMouseEvent);
+ connect(handler, &QEvdevMouseHandler::handleWheelEvent,
+ this, &QEvdevMouseManager::handleWheelEvent);
m_mice.insert(deviceNode, handler);
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
QInputDeviceManager::DeviceTypePointer, m_mice.count());
@@ -178,11 +185,4 @@ void QEvdevMouseManager::removeMouse(const QString &deviceNode)
}
}
-void QEvdevMouseManager::handleCursorPositionChange(const QPoint &pos)
-{
- m_x = pos.x();
- m_y = pos.y();
- clampPosition();
-}
-
QT_END_NAMESPACE
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
index 7cabfac0d8..10703655b3 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
@@ -64,19 +64,15 @@ class QDeviceDiscovery;
class QEvdevMouseManager : public QObject
{
- Q_OBJECT
public:
QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent = 0);
~QEvdevMouseManager();
-public slots:
void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons);
void handleWheelEvent(QPoint delta);
-private slots:
void addMouse(const QString &deviceNode = QString());
void removeMouse(const QString &deviceNode);
- void handleCursorPositionChange(const QPoint &pos);
private:
void clampPosition();
diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp
index cfc17a79c3..dbab2f6a24 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp
+++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp
@@ -149,9 +149,11 @@ void QEvdevTabletData::report()
qreal pressure = pressureRange ? (state.p - minValues.p) / qreal(pressureRange) : qreal(1);
if (state.down || state.lastReportDown) {
- QWindowSystemInterface::handleTabletEvent(0, state.down, QPointF(), globalPos,
+ QWindowSystemInterface::handleTabletEvent(0, QPointF(), globalPos,
QTabletEvent::Stylus, pointer,
- pressure, 0, 0, 0, 0, 0, q->deviceId(), qGuiApp->keyboardModifiers());
+ state.down ? Qt::LeftButton : Qt::NoButton,
+ pressure, 0, 0, 0, 0, 0, q->deviceId(),
+ qGuiApp->keyboardModifiers());
}
if (state.lastReportTool && !state.tool)
diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h
index cd760ba40a..66e821117a 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h
+++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h
@@ -63,15 +63,12 @@ class QEvdevTabletData;
class QEvdevTabletHandler : public QObject
{
- Q_OBJECT
-
public:
explicit QEvdevTabletHandler(const QString &device, const QString &spec = QString(), QObject *parent = 0);
~QEvdevTabletHandler();
qint64 deviceId() const;
-private slots:
void readData();
private:
diff --git a/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
index 4b00424e92..90949408ac 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
+++ b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
@@ -88,8 +88,11 @@ QEvdevTabletManager::QEvdevTabletManager(const QString &key, const QString &spec
const QStringList devices = m_deviceDiscovery->scanConnectedDevices();
for (const QString &device : devices)
addDevice(device);
- connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addDevice(QString)));
- connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeDevice(QString)));
+
+ connect(m_deviceDiscovery, &QDeviceDiscovery::deviceDetected,
+ this, &QEvdevTabletManager::addDevice);
+ connect(m_deviceDiscovery, &QDeviceDiscovery::deviceRemoved,
+ this, &QEvdevTabletManager::removeDevice);
}
}
}
diff --git a/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h b/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h
index d166c06cf3..cde91c55aa 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h
+++ b/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h
@@ -62,12 +62,10 @@ class QEvdevTabletHandlerThread;
class QEvdevTabletManager : public QObject
{
- Q_OBJECT
public:
QEvdevTabletManager(const QString &key, const QString &spec, QObject *parent = 0);
~QEvdevTabletManager();
-private slots:
void addDevice(const QString &deviceNode);
void removeDevice(const QString &deviceNode);
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index 15e00cea82..c889965805 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -229,7 +229,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
if (m_fd >= 0) {
m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
- connect(m_notify, SIGNAL(activated(int)), this, SLOT(readData()));
+ connect(m_notify, &QSocketNotifier::activated, this, &QEvdevTouchScreenHandler::readData);
} else {
qErrnoWarning(errno, "evdevtouch: Cannot open input device %s", qPrintable(device));
return;
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
index 04e22e1b5e..56308d0352 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
@@ -82,7 +82,6 @@ public:
bool isFiltered() const;
-private slots:
void readData();
signals:
@@ -116,7 +115,6 @@ public:
bool eventFilter(QObject *object, QEvent *event) override;
-public slots:
void scheduleTouchPointUpdate();
signals:
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
index ab71d08fb1..4cacbf03e5 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
@@ -88,8 +88,11 @@ QEvdevTouchManager::QEvdevTouchManager(const QString &key, const QString &specif
const QStringList devices = m_deviceDiscovery->scanConnectedDevices();
for (const QString &device : devices)
addDevice(device);
- connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addDevice(QString)));
- connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeDevice(QString)));
+
+ connect(m_deviceDiscovery, &QDeviceDiscovery::deviceDetected,
+ this, &QEvdevTouchManager::addDevice);
+ connect(m_deviceDiscovery, &QDeviceDiscovery::deviceRemoved,
+ this, &QEvdevTouchManager::removeDevice);
}
}
}
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h
index 84e857ca57..e524c516f1 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h
@@ -62,12 +62,10 @@ class QEvdevTouchScreenHandlerThread;
class QEvdevTouchManager : public QObject
{
- Q_OBJECT
public:
QEvdevTouchManager(const QString &key, const QString &spec, QObject *parent = 0);
~QEvdevTouchManager();
-private slots:
void addDevice(const QString &deviceNode);
void removeDevice(const QString &deviceNode);
diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp
index 4775eb0724..52eaa18f4b 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler.cpp
+++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp
@@ -107,14 +107,17 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
m_liFd = libinput_get_fd(m_li);
m_notifier.reset(new QSocketNotifier(m_liFd, QSocketNotifier::Read));
- connect(m_notifier.data(), SIGNAL(activated(int)), SLOT(onReadyRead()));
+
+ connect(m_notifier.data(), &QSocketNotifier::activated, this, &QLibInputHandler::onReadyRead);
m_pointer.reset(new QLibInputPointer);
m_keyboard.reset(new QLibInputKeyboard);
m_touch.reset(new QLibInputTouch);
- connect(QGuiApplicationPrivate::inputDeviceManager(), SIGNAL(cursorPositionChangeRequested(QPoint)),
- this, SLOT(onCursorPositionChangeRequested(QPoint)));
+ QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
+ connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [=](const QPoint &pos) {
+ m_pointer->setPos(pos);
+ });
// Process the initial burst of DEVICE_ADDED events.
onReadyRead();
@@ -154,10 +157,6 @@ void QLibInputHandler::processEvent(libinput_event *ev)
// This is not just for hotplugging, it is also called for each input
// device libinput reads from on startup. Hence it is suitable for doing
// touch device registration.
- const char *sysname = libinput_device_get_sysname(dev); // node name without path
- const char *name = libinput_device_get_name(dev);
- emit deviceAdded(QString::fromUtf8(sysname), QString::fromUtf8(name));
-
QInputDeviceManagerPrivate *inputManagerPriv = QInputDeviceManagerPrivate::get(
QGuiApplicationPrivate::inputDeviceManager());
if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TOUCH)) {
@@ -180,10 +179,6 @@ void QLibInputHandler::processEvent(libinput_event *ev)
}
case LIBINPUT_EVENT_DEVICE_REMOVED:
{
- const char *sysname = libinput_device_get_sysname(dev);
- const char *name = libinput_device_get_name(dev);
- emit deviceRemoved(QString::fromUtf8(sysname), QString::fromUtf8(name));
-
QInputDeviceManagerPrivate *inputManagerPriv = QInputDeviceManagerPrivate::get(
QGuiApplicationPrivate::inputDeviceManager());
if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TOUCH)) {
@@ -236,9 +231,4 @@ void QLibInputHandler::processEvent(libinput_event *ev)
}
}
-void QLibInputHandler::onCursorPositionChangeRequested(const QPoint &pos)
-{
- m_pointer->setPos(pos);
-}
-
QT_END_NAMESPACE
diff --git a/src/platformsupport/input/libinput/qlibinputhandler_p.h b/src/platformsupport/input/libinput/qlibinputhandler_p.h
index f3dcf0f0be..ac7a267a4d 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler_p.h
+++ b/src/platformsupport/input/libinput/qlibinputhandler_p.h
@@ -68,19 +68,11 @@ class QLibInputTouch;
class QLibInputHandler : public QObject
{
- Q_OBJECT
-
public:
QLibInputHandler(const QString &key, const QString &spec);
~QLibInputHandler();
-signals:
- void deviceAdded(const QString &sysname, const QString &name);
- void deviceRemoved(const QString &sysname, const QString &name);
-
-private slots:
void onReadyRead();
- void onCursorPositionChangeRequested(const QPoint &pos);
private:
void processEvent(libinput_event *ev);
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
index 12a3eb06eb..b7ee8a363f 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
@@ -64,8 +64,6 @@ QT_BEGIN_NAMESPACE
class QLibInputKeyboard : public QObject
{
- Q_OBJECT
-
public:
QLibInputKeyboard();
~QLibInputKeyboard();
@@ -73,7 +71,6 @@ public:
void processKey(libinput_event_keyboard *e);
#ifndef QT_NO_XKBCOMMON_EVDEV
-private slots:
void handleRepeat();
private:
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index b20cc4c095..d85a01b7d7 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -96,21 +96,28 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e)
void QLibInputPointer::processAxis(libinput_event_pointer *e)
{
+ double value; // default axis value is 15 degrees per wheel click
+ QPoint angleDelta;
#if !QT_CONFIG(libinput_axis_api)
- const double v = libinput_event_pointer_get_axis_value(e) * 120;
- const Qt::Orientation ori = libinput_event_pointer_get_axis(e) == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL
- ? Qt::Vertical : Qt::Horizontal;
- QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, qRound(-v), ori, QGuiApplication::keyboardModifiers());
+ value = libinput_event_pointer_get_axis_value(e);
+ if (libinput_event_pointer_get_axis(e) == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)
+ angleDelta.setY(qRound(value));
+ else
+ angleDelta.setX(qRound(value));
#else
if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) {
- const double v = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL) * 120;
- QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, qRound(-v), Qt::Vertical, QGuiApplication::keyboardModifiers());
+ value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
+ angleDelta.setY(qRound(value));
}
if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
- const double v = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL) * 120;
- QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, qRound(-v), Qt::Horizontal, QGuiApplication::keyboardModifiers());
+ value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
+ angleDelta.setX(qRound(value));
}
#endif
+ const int factor = 8;
+ angleDelta *= -factor;
+ Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers();
+ QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, QPoint(), angleDelta, mods);
}
void QLibInputPointer::setPos(const QPoint &pos)