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 <windowsx.h> | 5 #include <windowsx.h> |
6 | 6 |
7 #include "ui/events/event_constants.h" | 7 #include "ui/events/event_constants.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 gfx::Point EventSystemLocationFromNative( | 246 gfx::Point EventSystemLocationFromNative( |
247 const base::NativeEvent& native_event) { | 247 const base::NativeEvent& native_event) { |
248 POINT global_point = { static_cast<short>(LOWORD(native_event.lParam)), | 248 POINT global_point = { static_cast<short>(LOWORD(native_event.lParam)), |
249 static_cast<short>(HIWORD(native_event.lParam)) }; | 249 static_cast<short>(HIWORD(native_event.lParam)) }; |
250 ClientToScreen(native_event.hwnd, &global_point); | 250 ClientToScreen(native_event.hwnd, &global_point); |
251 return gfx::Point(global_point); | 251 return gfx::Point(global_point); |
252 } | 252 } |
253 | 253 |
254 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { | 254 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { |
255 return KeyboardCodeForWindowsKeyCode(native_event.wParam); | 255 return KeyboardCodeForWindowsKeyCode(static_cast<WORD>(native_event.wParam)); |
256 } | 256 } |
257 | 257 |
258 const char* CodeFromNative(const base::NativeEvent& native_event) { | 258 const char* CodeFromNative(const base::NativeEvent& native_event) { |
259 const uint16 scan_code = GetScanCodeFromLParam(native_event.lParam); | 259 const uint16 scan_code = GetScanCodeFromLParam(native_event.lParam); |
260 return CodeForWindowsScanCode(scan_code); | 260 return CodeForWindowsScanCode(scan_code); |
261 } | 261 } |
262 | 262 |
263 uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) { | 263 uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) { |
264 return static_cast<uint32>(native_event.wParam); | 264 return static_cast<uint32>(native_event.wParam); |
265 } | 265 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 405 } |
406 | 406 |
407 LPARAM GetLParamFromScanCode(uint16 scan_code) { | 407 LPARAM GetLParamFromScanCode(uint16 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 |