Chromium Code Reviews| Index: ui/events/win/events_win.cc |
| diff --git a/ui/events/win/events_win.cc b/ui/events/win/events_win.cc |
| index cd8dbc72c99e12385a6f6bfe9df9a79b865bdd8d..4c47df431b4909ec2e91026aecc8cc07ffba5c3a 100644 |
| --- a/ui/events/win/events_win.cc |
| +++ b/ui/events/win/events_win.cc |
| @@ -19,9 +19,12 @@ namespace ui { |
| namespace { |
| // From MSDN: "Mouse" events are flagged with 0xFF515700 if they come |
| -// from a touch or stylus device. In Vista or later, they are also flagged |
| -// with 0x80 if they come from touch. |
| +// from a touch or stylus device. In Vista or later, the eighth bit, |
| +// masked by 0x80, is used to differentiate touch input from pen input |
| +// (0 = pen, 1 = touch). |
| #define MOUSEEVENTF_FROMTOUCH (0xFF515700 | 0x80) |
| +#define MOUSEEVENTF_FROMTOUCHPEN 0xFF515700 |
|
mustaq
2016/06/02 15:28:24
Please move FROMTOUCHPEN above FROMTOUCH to avoid
lanwei
2016/06/02 16:07:06
Done.
|
| +#define SIGNATURE_MASK 0xFFFFFF00 |
| // Get the native mouse key state from the native event message type. |
| int GetNativeMouseKey(const base::NativeEvent& native_event) { |
| @@ -292,7 +295,14 @@ int GetChangedMouseButtonFlagsFromNative( |
| PointerDetails GetMousePointerDetailsFromNative( |
| const base::NativeEvent& native_event) { |
| - return PointerDetails(EventPointerType::POINTER_TYPE_MOUSE); |
| + LPARAM message = ::GetMessageExtraInfo(); |
|
Navid Zolghadr
2016/06/01 19:15:29
Do we have any sort of unique id for each pen devi
lanwei
2016/06/01 22:54:31
"The lower 8 bits returned from GetMessageExtraInf
Navid Zolghadr
2016/06/02 14:29:37
Although it is not complete and that does not diff
|
| + if ((message & SIGNATURE_MASK) != MOUSEEVENTF_FROMTOUCHPEN) |
| + return PointerDetails(EventPointerType::POINTER_TYPE_MOUSE); |
| + |
| + if ((message & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) |
| + return PointerDetails(EventPointerType::POINTER_TYPE_TOUCH); |
|
Navid Zolghadr
2016/06/01 19:15:29
Is this possible for this touch if to run? I mean
lanwei
2016/06/01 22:54:31
I am not sure if there are some cases the events a
tdresser
2016/06/02 13:40:40
https://code.google.com/p/chromium/codesearch#chro
lanwei
2016/06/02 16:07:06
The mouseevent from touch will set a flag EF_FROM_
|
| + |
| + return PointerDetails(EventPointerType::POINTER_TYPE_PEN); |
| } |
| gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& native_event) { |