From 45326692857c558bea4b263899bcae7ec88535aa Mon Sep 17 00:00:00 2001 From: Takumi Asaki Date: Wed, 7 May 2014 14:07:13 +0900 Subject: EvdevTouch: Added "invertx" and "inverty" parameters In some cases the event axises reported by evdev are inverted. This commit adds plugin parameters invertx and inverty to invert X- and Y-axis. Change-Id: Idaa63affd8321aa47974788c32d978fc21eb3dec Reviewed-by: Laszlo Agocs --- src/platformsupport/input/evdevtouch/qevdevtouch.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/platformsupport') diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index 563edf4fd7..6ed4abaeee 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -184,6 +184,8 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, QString dev; int rotationAngle = 0; + bool invertx = false; + bool inverty = false; for (int i = 0; i < args.count(); ++i) { if (args.at(i).startsWith(QLatin1String("/dev/")) && dev.isEmpty()) { dev = args.at(i); @@ -201,6 +203,10 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, break; } } + } else if (args.at(i) == QLatin1String("invertx")) { + invertx = true; + } else if (args.at(i) == QLatin1String("inverty")) { + inverty = true; } } @@ -326,6 +332,12 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, if (rotationAngle) d->m_rotate = QTransform::fromTranslate(0.5, 0.5).rotate(rotationAngle).translate(-0.5, -0.5); + if (invertx) + d->m_rotate *= QTransform::fromTranslate(0.5, 0.5).scale(-1.0, 1.0).translate(-0.5, -0.5); + + if (inverty) + d->m_rotate *= QTransform::fromTranslate(0.5, 0.5).scale(1.0, -1.0).translate(-0.5, -0.5); + d->registerDevice(); } -- cgit v1.2.3