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 <laszlo.agocs@digia.com>
This commit is contained in:
parent
50e8e95385
commit
4532669285
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user