| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 | 206 |
| 207 int EventFlagsFromNative(const base::NativeEvent& native_event) { | 207 int EventFlagsFromNative(const base::NativeEvent& native_event) { |
| 208 int flags = KeyStateFlagsFromNative(native_event); | 208 int flags = KeyStateFlagsFromNative(native_event); |
| 209 if (IsMouseEvent(native_event)) | 209 if (IsMouseEvent(native_event)) |
| 210 flags |= MouseStateFlagsFromNative(native_event); | 210 flags |= MouseStateFlagsFromNative(native_event); |
| 211 | 211 |
| 212 return flags; | 212 return flags; |
| 213 } | 213 } |
| 214 | 214 |
| 215 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { | 215 base::TimeTicks EventTimeFromNative(const base::NativeEvent& native_event) { |
| 216 // On Windows, the native input event timestamp (|native_event.time|) is | 216 // On Windows, the native input event timestamp (|native_event.time|) is |
| 217 // coming from |GetTickCount()| clock [1], while in platform independent code | 217 // coming from |GetTickCount()| clock [1], while in platform independent code |
| 218 // path we get timestamps by calling |TimeTicks::Now()|, which, if using high- | 218 // path we get timestamps by calling |TimeTicks::Now()|, which, if using high- |
| 219 // resolution timer as underlying implementation, could have different time | 219 // resolution timer as underlying implementation, could have different time |
| 220 // origin than |GetTickCount()|. To avoid the mismatching, we use | 220 // origin than |GetTickCount()|. To avoid the mismatching, we use |
| 221 // |TimeTicks::Now()| for event timestamp instead of the native timestamp to | 221 // |TimeTicks::Now()| for event timestamp instead of the native timestamp to |
| 222 // ensure computed input latency and web exposed timestamp is consistent with | 222 // ensure computed input latency and web exposed timestamp is consistent with |
| 223 // other components. | 223 // other components. |
| 224 // [1] http://blogs.msdn.com/b/oldnewthing/archive/2014/01/22/10491576.aspx | 224 // [1] http://blogs.msdn.com/b/oldnewthing/archive/2014/01/22/10491576.aspx |
| 225 return EventTimeForNow(); | 225 return EventTimeForNow(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 } | 405 } |
| 406 | 406 |
| 407 LPARAM GetLParamFromScanCode(uint16_t scan_code) { | 407 LPARAM GetLParamFromScanCode(uint16_t scan_code) { |
| 408 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; | 408 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; |
| 409 if ((scan_code & 0xE000) == 0xE000) | 409 if ((scan_code & 0xE000) == 0xE000) |
| 410 l_param |= (1 << 24); | 410 l_param |= (1 << 24); |
| 411 return l_param; | 411 return l_param; |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace ui | 414 } // namespace ui |
| OLD | NEW |