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

Unified Diff: base/win/win_util.cc

Issue 10802085: Correct behaviour of touch wrt mouse capture. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Clean-up 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
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.

Powered by Google App Engine
This is Rietveld 408576698