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

Side by Side 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, 4 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <windowsx.h> 5 #include <windowsx.h>
6 6
7 #include "ui/base/events.h" 7 #include "ui/base/events.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "base/win/win_util.h" 11 #include "base/win/win_util.h"
12 #include "ui/base/keycodes/keyboard_code_conversion_win.h" 12 #include "ui/base/keycodes/keyboard_code_conversion_win.h"
13 #include "ui/gfx/point.h" 13 #include "ui/gfx/point.h"
14 14
15 namespace { 15 namespace {
16 16
17 // From MSDN.
18 #define MOUSEEVENTF_FROMTOUCH 0xFF515700
19
17 // Get the native mouse key state from the native event message type. 20 // Get the native mouse key state from the native event message type.
18 int GetNativeMouseKey(const base::NativeEvent& native_event) { 21 int GetNativeMouseKey(const base::NativeEvent& native_event) {
19 switch (native_event.message) { 22 switch (native_event.message) {
20 case WM_LBUTTONDBLCLK: 23 case WM_LBUTTONDBLCLK:
21 case WM_LBUTTONDOWN: 24 case WM_LBUTTONDOWN:
22 case WM_LBUTTONUP: 25 case WM_LBUTTONUP:
23 case WM_NCLBUTTONDBLCLK: 26 case WM_NCLBUTTONDBLCLK:
24 case WM_NCLBUTTONDOWN: 27 case WM_NCLBUTTONDOWN:
25 case WM_NCLBUTTONUP: 28 case WM_NCLBUTTONUP:
26 return MK_LBUTTON; 29 return MK_LBUTTON;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 int modifiers = ui::EF_NONE; 308 int modifiers = ui::EF_NONE;
306 if (accel.fVirt & FSHIFT) 309 if (accel.fVirt & FSHIFT)
307 modifiers |= ui::EF_SHIFT_DOWN; 310 modifiers |= ui::EF_SHIFT_DOWN;
308 if (accel.fVirt & FCONTROL) 311 if (accel.fVirt & FCONTROL)
309 modifiers |= ui::EF_CONTROL_DOWN; 312 modifiers |= ui::EF_CONTROL_DOWN;
310 if (accel.fVirt & FALT) 313 if (accel.fVirt & FALT)
311 modifiers |= ui::EF_ALT_DOWN; 314 modifiers |= ui::EF_ALT_DOWN;
312 return modifiers; 315 return modifiers;
313 } 316 }
314 317
318 // Windows emulates mouse messages for touch events.
319 bool IsMouseEventFromTouch(UINT message) {
320 return (message == WM_MOUSEMOVE ||
321 message == WM_LBUTTONDOWN || message == WM_LBUTTONUP ||
322 message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) &&
323 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) ==
324 MOUSEEVENTF_FROMTOUCH;
325 }
326
315 } // namespace ui 327 } // namespace ui
OLDNEW
« 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