diff options
author | Andrew Gatt <andrew.gatt@springltd.co> | 2014-03-24 14:15:23 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-24 20:25:45 +0100 |
commit | 1d4a1be1af8ba3cd1965da0e32754067d2a6d1f6 (patch) | |
tree | 7ea1129a9b90893a4cffa87fa3dce94426429d11 /src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp | |
parent | c79918733a194ebbe5a2fe1617c884659f3e4b9f (diff) |
Add: absolute touch screen handling in evdevmouse
Some touch screen drivers present themselves as mice with absolute
coordinates. Setting QT_QPA_EVDEV_MOUSE_PARAMETERS=abs will force
qevdevmousehandler to use absolute coordinates, mapped to the screen
from the hardware maximums. These maximum values are read from the
driver using ioctls.
This feature can be safely used with mice, as the features checks will
fail and qevdevmouse will revert back to using relative coordinates.
This way touch screens and mice can work together.
Change-Id: Ic27bda02aa2199f008bac26db75c1f896696f9f5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp')
-rw-r--r-- | src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp index 6c430091c1..7b834a5c61 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp @@ -111,11 +111,16 @@ QEvdevMouseManager::~QEvdevMouseManager() m_mice.clear(); } -void QEvdevMouseManager::handleMouseEvent(int x, int y, Qt::MouseButtons buttons) +void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons) { // update current absolute coordinates - m_x += x; - m_y += y; + if (!abs) { + m_x += x; + m_y += y; + } else { + m_x = x; + m_y = y; + } // clamp to screen geometry QRect g = QGuiApplication::primaryScreen()->virtualGeometry(); @@ -156,7 +161,7 @@ void QEvdevMouseManager::addMouse(const QString &deviceNode) QEvdevMouseHandler *handler; handler = QEvdevMouseHandler::create(deviceNode, m_spec); if (handler) { - connect(handler, SIGNAL(handleMouseEvent(int,int,Qt::MouseButtons)), this, SLOT(handleMouseEvent(int,int,Qt::MouseButtons))); + connect(handler, SIGNAL(handleMouseEvent(int,int,bool,Qt::MouseButtons)), this, SLOT(handleMouseEvent(int,int,bool,Qt::MouseButtons))); connect(handler, SIGNAL(handleWheelEvent(int,Qt::Orientation)), this, SLOT(handleWheelEvent(int,Qt::Orientation))); m_mice.insert(deviceNode, handler); } else { |