| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 IsMouseWheelEvent(native_event) || IsScrollEvent(native_event)); | 248 IsMouseWheelEvent(native_event) || IsScrollEvent(native_event)); |
| 249 // Non-client message. The position is contained in a POINTS structure in | 249 // Non-client message. The position is contained in a POINTS structure in |
| 250 // LPARAM, and is in screen coordinates so we have to convert to client. | 250 // LPARAM, and is in screen coordinates so we have to convert to client. |
| 251 native_point.x = GET_X_LPARAM(native_event.lParam); | 251 native_point.x = GET_X_LPARAM(native_event.lParam); |
| 252 native_point.y = GET_Y_LPARAM(native_event.lParam); | 252 native_point.y = GET_Y_LPARAM(native_event.lParam); |
| 253 } | 253 } |
| 254 ScreenToClient(native_event.hwnd, &native_point); | 254 ScreenToClient(native_event.hwnd, &native_point); |
| 255 return gfx::Point(native_point); | 255 return gfx::Point(native_point); |
| 256 } | 256 } |
| 257 | 257 |
| 258 gfx::PointF EventLocationFromNativeF(const base::NativeEvent& native_event) { |
| 259 return gfx::PointF(EventLocationFromNative(native_event)); |
| 260 } |
| 261 |
| 258 gfx::Point EventSystemLocationFromNative( | 262 gfx::Point EventSystemLocationFromNative( |
| 259 const base::NativeEvent& native_event) { | 263 const base::NativeEvent& native_event) { |
| 260 POINT global_point = { static_cast<short>(LOWORD(native_event.lParam)), | 264 POINT global_point = { static_cast<short>(LOWORD(native_event.lParam)), |
| 261 static_cast<short>(HIWORD(native_event.lParam)) }; | 265 static_cast<short>(HIWORD(native_event.lParam)) }; |
| 262 // Wheel events have position in screen coordinates. | 266 // Wheel events have position in screen coordinates. |
| 263 if (!IsMouseWheelEvent(native_event)) | 267 if (!IsMouseWheelEvent(native_event)) |
| 264 ClientToScreen(native_event.hwnd, &global_point); | 268 ClientToScreen(native_event.hwnd, &global_point); |
| 265 return gfx::Point(global_point); | 269 return gfx::Point(global_point); |
| 266 } | 270 } |
| 267 | 271 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } | 419 } |
| 416 | 420 |
| 417 LPARAM GetLParamFromScanCode(uint16_t scan_code) { | 421 LPARAM GetLParamFromScanCode(uint16_t scan_code) { |
| 418 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; | 422 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; |
| 419 if ((scan_code & 0xE000) == 0xE000) | 423 if ((scan_code & 0xE000) == 0xE000) |
| 420 l_param |= (1 << 24); | 424 l_param |= (1 << 24); |
| 421 return l_param; | 425 return l_param; |
| 422 } | 426 } |
| 423 | 427 |
| 424 } // namespace ui | 428 } // namespace ui |
| OLD | NEW |