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

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

Issue 10802085: Correct behaviour of touch wrt mouse capture. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moved IsMouseEventFromTouch from base/win to ui/base/win Created 8 years, 5 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 | « ui/base/events.h ('k') | ui/views/widget/native_widget_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/events_win.cc
diff --git a/ui/base/win/events_win.cc b/ui/base/win/events_win.cc
index 3afddc293daf1d04851a62058b83f96778feb3df..212002597b22b0f23bdff88b2e93df532f84414a 100644
--- a/ui/base/win/events_win.cc
+++ b/ui/base/win/events_win.cc
@@ -14,6 +14,9 @@
namespace {
+// From MSDN.
+#define MOUSEEVENTF_FROMTOUCH 0xFF515700
+
// Get the native mouse key state from the native event message type.
int GetNativeMouseKey(const base::NativeEvent& native_event) {
switch (native_event.message) {
@@ -312,4 +315,13 @@ int GetModifiersFromACCEL(const ACCEL& accel) {
return modifiers;
}
+// Windows emulates mouse messages for touch events.
+bool IsMouseEventFromTouch(UINT message) {
+ return (message == WM_MOUSEMOVE ||
+ message == WM_LBUTTONDOWN || message == WM_LBUTTONUP ||
+ message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) &&
+ (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) ==
+ MOUSEEVENTF_FROMTOUCH;
+}
+
} // namespace ui
« no previous file with comments | « ui/base/events.h ('k') | ui/views/widget/native_widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698