| 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/base/events.h" | 7 #include "ui/base/events.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 DCHECK(IsNonClientMouseEvent(native_event) || | 208 DCHECK(IsNonClientMouseEvent(native_event) || |
| 209 IsMouseWheelEvent(native_event)); | 209 IsMouseWheelEvent(native_event)); |
| 210 // Non-client message. The position is contained in a POINTS structure in | 210 // Non-client message. The position is contained in a POINTS structure in |
| 211 // LPARAM, and is in screen coordinates so we have to convert to client. | 211 // LPARAM, and is in screen coordinates so we have to convert to client. |
| 212 POINT native_point = { GET_X_LPARAM(native_event.lParam), | 212 POINT native_point = { GET_X_LPARAM(native_event.lParam), |
| 213 GET_Y_LPARAM(native_event.lParam) }; | 213 GET_Y_LPARAM(native_event.lParam) }; |
| 214 ScreenToClient(native_event.hwnd, &native_point); | 214 ScreenToClient(native_event.hwnd, &native_point); |
| 215 return gfx::Point(native_point); | 215 return gfx::Point(native_point); |
| 216 } | 216 } |
| 217 | 217 |
| 218 gfx::Point EventSystemLocationFromNative( |
| 219 const base::NativeEvent& native_event) { |
| 220 // TODO(ben): Needs to always return screen position here. Returning normal |
| 221 // origin for now since that's obviously wrong. |
| 222 return gfx::Point(0, 0); |
| 223 } |
| 224 |
| 218 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { | 225 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { |
| 219 return KeyboardCodeForWindowsKeyCode(native_event.wParam); | 226 return KeyboardCodeForWindowsKeyCode(native_event.wParam); |
| 220 } | 227 } |
| 221 | 228 |
| 222 bool IsMouseEvent(const base::NativeEvent& native_event) { | 229 bool IsMouseEvent(const base::NativeEvent& native_event) { |
| 223 return IsClientMouseEvent(native_event) || | 230 return IsClientMouseEvent(native_event) || |
| 224 IsNonClientMouseEvent(native_event); | 231 IsNonClientMouseEvent(native_event); |
| 225 } | 232 } |
| 226 | 233 |
| 227 int GetChangedMouseButtonFlagsFromNative( | 234 int GetChangedMouseButtonFlagsFromNative( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 // Windows emulates mouse messages for touch events. | 331 // Windows emulates mouse messages for touch events. |
| 325 bool IsMouseEventFromTouch(UINT message) { | 332 bool IsMouseEventFromTouch(UINT message) { |
| 326 return (message == WM_MOUSEMOVE || | 333 return (message == WM_MOUSEMOVE || |
| 327 message == WM_LBUTTONDOWN || message == WM_LBUTTONUP || | 334 message == WM_LBUTTONDOWN || message == WM_LBUTTONUP || |
| 328 message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) && | 335 message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) && |
| 329 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == | 336 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == |
| 330 MOUSEEVENTF_FROMTOUCH; | 337 MOUSEEVENTF_FROMTOUCH; |
| 331 } | 338 } |
| 332 | 339 |
| 333 } // namespace ui | 340 } // namespace ui |
| OLD | NEW |