OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/events/event.h" | 5 #include "ui/events/event.h" |
6 #include "ui/events/event_utils.h" | 6 #include "ui/events/event_utils.h" |
7 #include "ui/events/keycodes/dom/dom_code.h" | 7 #include "ui/events/keycodes/dom/dom_code.h" |
8 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 8 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
9 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" | 9 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" |
10 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" | 10 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 break; | 40 break; |
41 case EF_MIDDLE_MOUSE_BUTTON: | 41 case EF_MIDDLE_MOUSE_BUTTON: |
42 code = BTN_MIDDLE; | 42 code = BTN_MIDDLE; |
43 default: | 43 default: |
44 LOG(WARNING) << "Invalid flag: " << button << " for the button parameter"; | 44 LOG(WARNING) << "Invalid flag: " << button << " for the button parameter"; |
45 return; | 45 return; |
46 } | 46 } |
47 | 47 |
48 dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams( | 48 dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams( |
49 kDeviceIdForInjection, cursor_->GetLocation(), code, down, | 49 kDeviceIdForInjection, cursor_->GetLocation(), code, down, |
50 false /* allow_remap */, EventTimeForNow())); | 50 false /* allow_remap */, |
| 51 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), EventTimeForNow())); |
51 } | 52 } |
52 | 53 |
53 void InputInjectorEvdev::InjectMouseWheel(int delta_x, int delta_y) { | 54 void InputInjectorEvdev::InjectMouseWheel(int delta_x, int delta_y) { |
54 dispatcher_->DispatchMouseWheelEvent(MouseWheelEventParams( | 55 dispatcher_->DispatchMouseWheelEvent(MouseWheelEventParams( |
55 kDeviceIdForInjection, cursor_->GetLocation(), | 56 kDeviceIdForInjection, cursor_->GetLocation(), |
56 gfx::Vector2d(delta_x, delta_y), EventTimeForNow())); | 57 gfx::Vector2d(delta_x, delta_y), EventTimeForNow())); |
57 } | 58 } |
58 | 59 |
59 void InputInjectorEvdev::MoveCursorTo(const gfx::PointF& location) { | 60 void InputInjectorEvdev::MoveCursorTo(const gfx::PointF& location) { |
60 if (!cursor_) | 61 if (!cursor_) |
61 return; | 62 return; |
62 | 63 |
63 cursor_->MoveCursorTo(location); | 64 cursor_->MoveCursorTo(location); |
64 | 65 |
65 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams( | 66 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams( |
66 kDeviceIdForInjection, cursor_->GetLocation(), EventTimeForNow())); | 67 kDeviceIdForInjection, cursor_->GetLocation(), |
| 68 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), EventTimeForNow())); |
67 } | 69 } |
68 | 70 |
69 void InputInjectorEvdev::InjectKeyEvent(DomCode physical_key, | 71 void InputInjectorEvdev::InjectKeyEvent(DomCode physical_key, |
70 bool down, | 72 bool down, |
71 bool suppress_auto_repeat) { | 73 bool suppress_auto_repeat) { |
72 if (physical_key == DomCode::NONE) | 74 if (physical_key == DomCode::NONE) |
73 return; | 75 return; |
74 | 76 |
75 int native_keycode = KeycodeConverter::DomCodeToNativeKeycode(physical_key); | 77 int native_keycode = KeycodeConverter::DomCodeToNativeKeycode(physical_key); |
76 int evdev_code = NativeCodeToEvdevCode(native_keycode); | 78 int evdev_code = NativeCodeToEvdevCode(native_keycode); |
77 | 79 |
78 dispatcher_->DispatchKeyEvent( | 80 dispatcher_->DispatchKeyEvent( |
79 KeyEventParams(kDeviceIdForInjection, evdev_code, down, | 81 KeyEventParams(kDeviceIdForInjection, evdev_code, down, |
80 suppress_auto_repeat, EventTimeForNow())); | 82 suppress_auto_repeat, EventTimeForNow())); |
81 } | 83 } |
82 | 84 |
83 } // namespace ui | 85 } // namespace ui |
84 | 86 |
OLD | NEW |