| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 285 } |
| 286 | 286 |
| 287 gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& native_event) { | 287 gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& native_event) { |
| 288 DCHECK(native_event.message == WM_MOUSEWHEEL || | 288 DCHECK(native_event.message == WM_MOUSEWHEEL || |
| 289 native_event.message == WM_MOUSEHWHEEL); | 289 native_event.message == WM_MOUSEHWHEEL); |
| 290 if (native_event.message == WM_MOUSEWHEEL) | 290 if (native_event.message == WM_MOUSEWHEEL) |
| 291 return gfx::Vector2d(0, GET_WHEEL_DELTA_WPARAM(native_event.wParam)); | 291 return gfx::Vector2d(0, GET_WHEEL_DELTA_WPARAM(native_event.wParam)); |
| 292 return gfx::Vector2d(GET_WHEEL_DELTA_WPARAM(native_event.wParam), 0); | 292 return gfx::Vector2d(GET_WHEEL_DELTA_WPARAM(native_event.wParam), 0); |
| 293 } | 293 } |
| 294 | 294 |
| 295 base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) { | |
| 296 return event; | |
| 297 } | |
| 298 | |
| 299 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { | |
| 300 } | |
| 301 | |
| 302 void IncrementTouchIdRefCount(const base::NativeEvent& event) { | 295 void IncrementTouchIdRefCount(const base::NativeEvent& event) { |
| 303 NOTIMPLEMENTED(); | 296 NOTIMPLEMENTED(); |
| 304 } | 297 } |
| 305 | 298 |
| 306 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { | 299 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { |
| 307 NOTIMPLEMENTED(); | 300 NOTIMPLEMENTED(); |
| 308 } | 301 } |
| 309 | 302 |
| 310 int GetTouchId(const base::NativeEvent& xev) { | 303 int GetTouchId(const base::NativeEvent& xev) { |
| 311 NOTIMPLEMENTED(); | 304 NOTIMPLEMENTED(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 float* vx, | 342 float* vx, |
| 350 float* vy, | 343 float* vy, |
| 351 float* vx_ordinal, | 344 float* vx_ordinal, |
| 352 float* vy_ordinal, | 345 float* vy_ordinal, |
| 353 bool* is_cancel) { | 346 bool* is_cancel) { |
| 354 // Not supported in Windows. | 347 // Not supported in Windows. |
| 355 NOTIMPLEMENTED(); | 348 NOTIMPLEMENTED(); |
| 356 return false; | 349 return false; |
| 357 } | 350 } |
| 358 | 351 |
| 359 int GetModifiersFromACCEL(const ACCEL& accel) { | |
| 360 int modifiers = EF_NONE; | |
| 361 if (accel.fVirt & FSHIFT) | |
| 362 modifiers |= EF_SHIFT_DOWN; | |
| 363 if (accel.fVirt & FCONTROL) | |
| 364 modifiers |= EF_CONTROL_DOWN; | |
| 365 if (accel.fVirt & FALT) | |
| 366 modifiers |= EF_ALT_DOWN; | |
| 367 return modifiers; | |
| 368 } | |
| 369 | |
| 370 int GetModifiersFromKeyState() { | |
| 371 int modifiers = EF_NONE; | |
| 372 if (base::win::IsShiftPressed()) | |
| 373 modifiers |= EF_SHIFT_DOWN; | |
| 374 if (base::win::IsCtrlPressed()) | |
| 375 modifiers |= EF_CONTROL_DOWN; | |
| 376 if (base::win::IsAltPressed()) | |
| 377 modifiers |= EF_ALT_DOWN; | |
| 378 if (base::win::IsAltGrPressed()) | |
| 379 modifiers |= EF_ALTGR_DOWN; | |
| 380 return modifiers; | |
| 381 } | |
| 382 | |
| 383 // Windows emulates mouse messages for touch events. | 352 // Windows emulates mouse messages for touch events. |
| 384 bool IsMouseEventFromTouch(UINT message) { | 353 bool IsMouseEventFromTouch(UINT message) { |
| 385 return (message >= WM_MOUSEFIRST) && (message <= WM_MOUSELAST) && | 354 return (message >= WM_MOUSEFIRST) && (message <= WM_MOUSELAST) && |
| 386 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == | 355 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == |
| 387 MOUSEEVENTF_FROMTOUCH; | 356 MOUSEEVENTF_FROMTOUCH; |
| 388 } | 357 } |
| 389 | 358 |
| 390 // Conversion scan_code and LParam each other. | 359 // Conversion scan_code and LParam each other. |
| 391 // uint16 scan_code: | 360 // uint16 scan_code: |
| 392 // ui/events/keycodes/dom4/keycode_converter_data.h | 361 // ui/events/keycodes/dom4/keycode_converter_data.h |
| (...skipping 12 matching lines...) Expand all Loading... |
| 405 } | 374 } |
| 406 | 375 |
| 407 LPARAM GetLParamFromScanCode(uint16 scan_code) { | 376 LPARAM GetLParamFromScanCode(uint16 scan_code) { |
| 408 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; | 377 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; |
| 409 if ((scan_code & 0xE000) == 0xE000) | 378 if ((scan_code & 0xE000) == 0xE000) |
| 410 l_param |= (1 << 24); | 379 l_param |= (1 << 24); |
| 411 return l_param; | 380 return l_param; |
| 412 } | 381 } |
| 413 | 382 |
| 414 } // namespace ui | 383 } // namespace ui |
| OLD | NEW |