Index: base/win/win_util.cc |
diff --git a/base/win/win_util.cc b/base/win/win_util.cc |
index 55a4c3c334f071a0cfe279559facbea4852900d2..1fc34e27800b4f01b35edee8acb0bad64ecd826b 100644 |
--- a/base/win/win_util.cc |
+++ b/base/win/win_util.cc |
@@ -23,6 +23,9 @@ |
namespace { |
+// From MSDN. |
+#define MOUSEEVENTF_FROMTOUCH 0xFF515700 |
+ |
// TODO(gab): These definitions are temporary and should be removed once the |
// win8 SDK defines them. |
DEFINE_PROPERTYKEY(PKEY_AppUserModel_DualMode, 0x9F4C2855, 0x9F79, |
@@ -110,6 +113,15 @@ bool IsAltPressed() { |
return (::GetKeyState(VK_MENU) & 0x8000) == 0x8000; |
} |
+// 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; |
+} |
+ |
bool UserAccountControlIsEnabled() { |
// This can be slow if Windows ends up going to disk. Should watch this key |
// for changes and only read it once, preferably on the file thread. |