multi-touch: added device initializing checking
authorGiWoong Kim <giwoong.kim@samsung.com>
Fri, 16 Oct 2015 04:28:47 +0000 (13:28 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 19 Oct 2015 05:44:45 +0000 (14:44 +0900)
Multi-touch events should be ignored when
the touchscreen device is not ready yet.

Change-Id: I7486e1bc91bf9a4519a9e27a6c331aca65b03b39
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/hw/virtio/maru_virtio_touchscreen.c
tizen/src/hw/virtio/maru_virtio_touchscreen.h
tizen/src/ui/input/keyboardhelper.cpp
tizen/src/ui/input/multitouchtracker.cpp
tizen/src/ui/input/multitouchtracker.h

index e07c30b38c7a56519777eca3918a33f7575fec5c..910afab41557f424d1b2c9d8680b586706909a4a 100644 (file)
@@ -82,6 +82,14 @@ VirtIOTouchscreen *ts;
 static pthread_mutex_t event_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t elem_mutex = PTHREAD_MUTEX_INITIALIZER;
 
+bool virtio_touchscreen_ready(void)
+{
+    if (ts == NULL) {
+        return false;
+    }
+
+    return virtio_queue_ready(ts->vq) != 0;
+}
 
 void virtio_touchscreen_event(int x, int y, int z, int buttons_state)
 {
index 4a6c7da97476efc9f211552c9673199e4dc76723..2cabc5653de881aa58ec121c5b54d1adf87bae61 100644 (file)
@@ -58,6 +58,7 @@ typedef struct EmulTouchEvent {
     uint8_t state;
 } EmulTouchEvent;
 
+bool virtio_touchscreen_ready(void);
 void virtio_touchscreen_event(int x, int y, int z, int buttons_state);
 void maru_virtio_touchscreen_notify(void);
 
index 39fc01fc3608afe03d9ac6ac10d2981370ef0653..4fe8d3fc2211b66faf4837f9f579763081f218d5 100644 (file)
@@ -351,8 +351,10 @@ void KeyboardHelper::keyPressed(QKeyEvent *event)
         event->nativeScanCode() << event->modifiers() << event->nativeModifiers();
 
     /* multi-touch checking */
-    if (mtTracker != NULL && get_max_touch_point() > 1) {
-        pressFilterMtChecking(event);
+    if (mtTracker != NULL && mtTracker->isTrackingReady() == true) {
+        if (get_max_touch_point() > 1) {
+            pressFilterMtChecking(event);
+        }
         /* fall through */
     }
 
index 690424e83b47e7ce17fdfcf83ee6bac3c2e7bdb5..67d82e48794be2ba83937a7e0f6b5d50eba6e75a 100644 (file)
@@ -40,6 +40,7 @@ int qt5_mt_width = 0;
 int qt5_mt_height = 0;
 
 extern "C" {
+bool virtio_touchscreen_ready(void);
 void virtio_touchscreen_event(int x, int y, int z, int buttons_state);
 }
 
@@ -131,6 +132,16 @@ QList<TouchPoint *> MultiTouchTracker::getTouchPointList()
     return touchPointList;
 }
 
+bool MultiTouchTracker::isTrackingReady()
+{
+    if (touchPointImage.isNull() == true) {
+        qWarning() << "touch point image is null";
+        return false;
+    }
+
+    return virtio_touchscreen_ready();
+}
+
 int MultiTouchTracker::addTouchPoint(QPoint hostPos, QPoint guestPos)
 {
     const int touchCnt = touchPointList.count();
index 0a74afeee40af5ffce2176700a4fa9e12081bd2d..bbf3d3f8e452aa00c6e4ecd721eece111a120bc7 100644 (file)
@@ -63,6 +63,7 @@ public:
     const QImage &getPointImage();
     int getMaxTouchPoint();
     QList<TouchPoint *> getTouchPointList();
+    bool isTrackingReady();
 
     int addTouchPoint(QPoint hostPos, QPoint guestPos);
     TouchPoint *searchTouchPoint(QPoint targetPos);