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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // Windows emulates mouse messages for touch events. | 342 // Windows emulates mouse messages for touch events. |
336 bool IsMouseEventFromTouch(UINT message) { | 343 bool IsMouseEventFromTouch(UINT message) { |
337 return (message == WM_MOUSEMOVE || | 344 return (message == WM_MOUSEMOVE || |
338 message == WM_LBUTTONDOWN || message == WM_LBUTTONUP || | 345 message == WM_LBUTTONDOWN || message == WM_LBUTTONUP || |
339 message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) && | 346 message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) && |
340 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == | 347 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == |
341 MOUSEEVENTF_FROMTOUCH; | 348 MOUSEEVENTF_FROMTOUCH; |
342 } | 349 } |
343 | 350 |
344 } // namespace ui | 351 } // namespace ui |
OLD | NEW |