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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // LPARAM, and is in screen coordinates so we have to convert to client. | 234 // LPARAM, and is in screen coordinates so we have to convert to client. |
235 native_point.x = GET_X_LPARAM(native_event.lParam); | 235 native_point.x = GET_X_LPARAM(native_event.lParam); |
236 native_point.y = GET_Y_LPARAM(native_event.lParam); | 236 native_point.y = GET_Y_LPARAM(native_event.lParam); |
237 } | 237 } |
238 ScreenToClient(native_event.hwnd, &native_point); | 238 ScreenToClient(native_event.hwnd, &native_point); |
239 return gfx::Point(native_point); | 239 return gfx::Point(native_point); |
240 } | 240 } |
241 | 241 |
242 gfx::Point EventSystemLocationFromNative( | 242 gfx::Point EventSystemLocationFromNative( |
243 const base::NativeEvent& native_event) { | 243 const base::NativeEvent& native_event) { |
244 // TODO(ben): Needs to always return screen position here. Returning normal | 244 POINT global_point = { static_cast<short>(LOWORD(native_event.lParam)), |
245 // origin for now since that's obviously wrong. | 245 static_cast<short>(HIWORD(native_event.lParam)) }; |
246 return gfx::Point(0, 0); | 246 ClientToScreen(native_event.hwnd, &global_point); |
| 247 return gfx::Point(global_point); |
247 } | 248 } |
248 | 249 |
249 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { | 250 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { |
250 return KeyboardCodeForWindowsKeyCode(native_event.wParam); | 251 return KeyboardCodeForWindowsKeyCode(native_event.wParam); |
251 } | 252 } |
252 | 253 |
253 const char* CodeFromNative(const base::NativeEvent& native_event) { | 254 const char* CodeFromNative(const base::NativeEvent& native_event) { |
254 const uint16 scan_code = GetScanCodeFromLParam(native_event.lParam); | 255 const uint16 scan_code = GetScanCodeFromLParam(native_event.lParam); |
255 return CodeForWindowsScanCode(scan_code); | 256 return CodeForWindowsScanCode(scan_code); |
256 } | 257 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 410 } |
410 | 411 |
411 LPARAM GetLParamFromScanCode(uint16 scan_code) { | 412 LPARAM GetLParamFromScanCode(uint16 scan_code) { |
412 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; | 413 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; |
413 if ((scan_code & 0xE000) == 0xE000) | 414 if ((scan_code & 0xE000) == 0xE000) |
414 l_param |= (1 << 24); | 415 l_param |= (1 << 24); |
415 return l_param; | 416 return l_param; |
416 } | 417 } |
417 | 418 |
418 } // namespace ui | 419 } // namespace ui |
OLD | NEW |