changeset 6421:b8a1db3d5a8b

Fix to RT-21702: [Touch, Windows] MouseEvents generated from touch-screen action have isSynthesized() == false Reviewed by Anthony Petrov
author Chien Yang <chien.yang@oracle.com>
date Tue, 04 Mar 2014 09:53:18 -0800
parents e8e29c6f29ba
children c896cd34e781
files modules/graphics/src/main/native-glass/win/ViewContainer.cpp
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-glass/win/ViewContainer.cpp	Tue Mar 04 10:00:24 2014 -0700
+++ b/modules/graphics/src/main/native-glass/win/ViewContainer.cpp	Tue Mar 04 09:53:18 2014 -0800
@@ -59,14 +59,17 @@
 
 bool IsTouchEvent()
 {
+    // Read this link if you wonder why we need to hard code the mask and signature:
     // http://msdn.microsoft.com/en-us/library/windows/desktop/ms703320(v=vs.85).aspx
+    //"The lower 8 bits returned from GetMessageExtraInfo are variable.
+    // Of those bits, 7 (the lower 7, masked by 0x7F) are used to represent the cursor ID,
+    // zero for the mouse or a variable value for the pen ID.
+    // Additionally, in Windows Vista, the eighth bit, masked by 0x80, is used to
+    // differentiate touch input from pen input (0 = pen, 1 = touch)."
+    UINT SIGNATURE = 0xFF515780;
+    UINT MASK = 0xFFFFFF80;
 
-    enum {
-        SIGNATURE = 0xFF515780,
-        MASK = 0xFFFFFF80
-    };
-
-    const LPARAM v = GetMessageExtraInfo();
+    UINT v = (UINT) GetMessageExtraInfo();
 
     return ((v & MASK) == SIGNATURE);
 }