changeset 5880:5da49a57a37f

RT-34624 [Lens] [Touch] Control not always respond to a tap Summary:Sometime when taping over a control it doesn't get selected, but rather just get the internal focus (painted in blue, for example) and another tap needed to actually select/activate it.sending a MouseEvent.MOVE before MouseEvent.PRESS solve this issue. Tested-with: HelloSanity, LensInputTest, Ensemble8 Reviewed-by: dblaukop
author Assaf Yavnai
date Tue, 03 Dec 2013 12:38:49 +0200
parents 268fe91a74e0
children 2698d86919d4
files modules/graphics/src/main/native-glass/lens/input/udev/udevInput.c modules/graphics/src/main/native-glass/lens/wm/LensWindowManager.c
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-glass/lens/input/udev/udevInput.c	Tue Dec 03 12:24:50 2013 +0400
+++ b/modules/graphics/src/main/native-glass/lens/input/udev/udevInput.c	Tue Dec 03 12:38:49 2013 +0200
@@ -655,8 +655,7 @@
         //lens_input_deviceInitCapabilities()
         device->touchProtocolType = TOUCH_PROTOCOL_ST;
         isValidDevice = JNI_TRUE;
-        TRACE("[properties check] Device is marked as touch",
-              device->info->name);
+        TRACE("[properties check] Device is marked as touch");
     }
     return isValidDevice;
 }
--- a/modules/graphics/src/main/native-glass/lens/wm/LensWindowManager.c	Tue Dec 03 12:24:50 2013 +0400
+++ b/modules/graphics/src/main/native-glass/lens/wm/LensWindowManager.c	Tue Dec 03 12:38:49 2013 +0200
@@ -1096,7 +1096,7 @@
 
     int i;
     int dx, dy, relX, relY, absX, absY;
-    jboolean allReleased;    
+    jboolean allReleased;
 
     //set the touch window on first touch event
     if (touchWindow == NULL && primaryPointIndex >= 0 && !_onDraggingAction) {
@@ -1156,9 +1156,16 @@
         absY = yabs[primaryPointIndex];
         switch (states[primaryPointIndex]) {
             case com_sun_glass_events_TouchEvent_TOUCH_PRESSED:
+                
+                if (absX != _mousePosX  || absY != _mousePosY) {
+                    //RT-34624 - need to report move before press (if not already reported)
+                    lens_wm_notifyMotionEvent(env,
+                                          absX,
+                                          absY);
+                }
+
                 //send button pressed
                 GLASS_LOG_FINEST("touch -> mouse - pressed");
-
                 lens_wm_notifyButtonEvent(env,
                                           JNI_TRUE, //preseed
                                           com_sun_glass_events_MouseEvent_BUTTON_LEFT,
@@ -1179,6 +1186,10 @@
                 GLASS_LOG_FINEST("touch -> mouse - still, ignoring");
                 break;
             case com_sun_glass_events_TouchEvent_TOUCH_RELEASED:
+                //if more then one fingers is used, then a new primary point will
+                //be assigned and we will not get TOUCH_RELEASED , if a single 
+                //point is used then then all points will be released
+                //primaryPointIndex will be -1 and we shouldn't got here
                 GLASS_LOG_WARNING("touch -> mouse - release, illegal state");
                 break;
         }