Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1074)

Unified Diff: ui/events/win/events_win.cc

Issue 2020143003: Identity the mouse pointer type from low-level events for Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove touch pointer type for mouse event Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..315d99349da5c6e1b1625b24058b0eb516b63ad4 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.
-#define MOUSEEVENTF_FROMTOUCH (0xFF515700 | 0x80)
+// 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_FROMTOUCHPEN 0xFF515700
+#define MOUSEEVENTF_FROMTOUCH (MOUSEEVENTF_FROMTOUCHPEN | 0x80)
+#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,12 @@ int GetChangedMouseButtonFlagsFromNative(
PointerDetails GetMousePointerDetailsFromNative(
const base::NativeEvent& native_event) {
- return PointerDetails(EventPointerType::POINTER_TYPE_MOUSE);
+ // We should filter out all the mouse events Synthesized from touch events.
+ // TODO(lanwei): Will set the pointer ID, see https://crbug.com/616771.
+ if ((GetMessageExtraInfo() & SIGNATURE_MASK) != MOUSEEVENTF_FROMTOUCHPEN)
+ return PointerDetails(EventPointerType::POINTER_TYPE_MOUSE);
+
+ return PointerDetails(EventPointerType::POINTER_TYPE_PEN);
}
gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& native_event) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698