OLD | NEW |
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 <stdint.h> | 5 #include <stdint.h> |
6 #include <windowsx.h> | 6 #include <windowsx.h> |
7 | 7 |
8 #include "ui/events/event_constants.h" | 8 #include "ui/events/event_constants.h" |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 base::TimeTicks EventTimeFromNative(const base::NativeEvent& native_event) { | 218 base::TimeTicks EventTimeFromNative(const base::NativeEvent& native_event) { |
219 // On Windows, the native input event timestamp (|native_event.time|) is | 219 // On Windows, the native input event timestamp (|native_event.time|) is |
220 // coming from |GetTickCount()| clock [1], while in platform independent code | 220 // coming from |GetTickCount()| clock [1], while in platform independent code |
221 // path we get timestamps by calling |TimeTicks::Now()|, which, if using high- | 221 // path we get timestamps by calling |TimeTicks::Now()|, which, if using high- |
222 // resolution timer as underlying implementation, could have different time | 222 // resolution timer as underlying implementation, could have different time |
223 // origin than |GetTickCount()|. To avoid the mismatching, we use | 223 // origin than |GetTickCount()|. To avoid the mismatching, we use |
224 // |TimeTicks::Now()| for event timestamp instead of the native timestamp to | 224 // |TimeTicks::Now()| for event timestamp instead of the native timestamp to |
225 // ensure computed input latency and web exposed timestamp is consistent with | 225 // ensure computed input latency and web exposed timestamp is consistent with |
226 // other components. | 226 // other components. |
| 227 // It is unnecessary to invoke |ValidateEventTimeClock| here because of above. |
227 // [1] http://blogs.msdn.com/b/oldnewthing/archive/2014/01/22/10491576.aspx | 228 // [1] http://blogs.msdn.com/b/oldnewthing/archive/2014/01/22/10491576.aspx |
228 return EventTimeForNow(); | 229 return EventTimeForNow(); |
229 } | 230 } |
230 | 231 |
231 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { | 232 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { |
232 POINT native_point; | 233 POINT native_point; |
233 if ((native_event.message == WM_MOUSELEAVE || | 234 if ((native_event.message == WM_MOUSELEAVE || |
234 native_event.message == WM_NCMOUSELEAVE) || | 235 native_event.message == WM_NCMOUSELEAVE) || |
235 IsScrollEvent(native_event)) { | 236 IsScrollEvent(native_event)) { |
236 // These events have no coordinates. For sanity with rest of events grab | 237 // These events have no coordinates. For sanity with rest of events grab |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 414 } |
414 | 415 |
415 LPARAM GetLParamFromScanCode(uint16_t scan_code) { | 416 LPARAM GetLParamFromScanCode(uint16_t scan_code) { |
416 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; | 417 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; |
417 if ((scan_code & 0xE000) == 0xE000) | 418 if ((scan_code & 0xE000) == 0xE000) |
418 l_param |= (1 << 24); | 419 l_param |= (1 << 24); |
419 return l_param; | 420 return l_param; |
420 } | 421 } |
421 | 422 |
422 } // namespace ui | 423 } // namespace ui |
OLD | NEW |