summaryrefslogtreecommitdiffstats
path: root/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-07-18 13:44:47 +0300
committerQt by Nokia <qt-info@nokia.com>2011-07-19 15:00:46 +0200
commitba1b6f16ae042e5fdeb2e2c5968e1e5b1834ab88 (patch)
tree1a4c08b41efbe4f7f5a6f9ecf89a6e03847884e6 /src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
parent9581c90395086932d2e853864bf962b0896597d5 (diff)
Implement todos in touchscreen generic plug-in.
The patch implements periodic clearing of the point states when no activity occurs (i.e. no ev_syn is coming at all, meaning that most probably all the fingers are already up) and also moves the entire functionality into a separate thread even when used as a plug-in. Change-Id: Ib1daa738085b61af9b07eb8a284416e5a3fcabe8 Reviewed-on: http://codereview.qt.nokia.com/1744 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp')
-rw-r--r--src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
index 7dff55b1bc..cd11f44bed 100644
--- a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
+++ b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
@@ -47,7 +47,11 @@
QT_BEGIN_NAMESPACE
//#define POINT_DEBUG
-//#define FORCE_TO_ACTIVE_WINDOW
+
+QTouchEventSenderQPA::QTouchEventSenderQPA(const QString &spec)
+{
+ m_forceToActiveWindow = spec.split(QLatin1Char(':')).contains(QLatin1String("force_window"));
+}
void QTouchEventSenderQPA::touch_configure(int x_min, int x_max, int y_min, int y_max)
{
@@ -60,21 +64,18 @@ void QTouchEventSenderQPA::touch_configure(int x_min, int x_max, int y_min, int
void QTouchEventSenderQPA::touch_point(QEvent::Type state,
const QList<QWindowSystemInterface::TouchPoint> &points)
{
-#ifdef FORCE_TO_ACTIVE_WINDOW
- QWidget *win = QApplication::activeWindow(); // ### migrate to QWindow later on
- if (!win) {
-#ifdef POINT_DEBUG
- qDebug("sendTouchEvent: No active window");
-#endif
- return;
+ QRect winRect;
+ if (m_forceToActiveWindow) {
+ QWidget *win = QApplication::activeWindow(); // ### migrate to QWindow later on
+ if (!win)
+ return;
+ winRect = win->geometry();
+ } else {
+ winRect = QApplication::desktop()->screenGeometry();
}
- const QRect winRect = win->geometry();
-#else
- const QRect winRect = QApplication::desktop()->screenGeometry();
-#endif
#ifdef POINT_DEBUG
- qDebug() << points.size() << "points" << winRect << state;
+ qDebug() << "QPA: Mapping" << points.size() << "points to" << winRect << state;
#endif
QList<QWindowSystemInterface::TouchPoint> touchPoints = points;