Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: ui/events/ozone/evdev/input_injector_evdev.cc

Issue 2248933002: Support pen in TouchEventConverterEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ozone/evdev/input_injector_evdev.h" 5 #include "ui/events/ozone/evdev/input_injector_evdev.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/events/event_utils.h" 10 #include "ui/events/event_utils.h"
(...skipping 30 matching lines...) Expand all
41 code = BTN_RIGHT; 41 code = BTN_RIGHT;
42 break; 42 break;
43 case EF_MIDDLE_MOUSE_BUTTON: 43 case EF_MIDDLE_MOUSE_BUTTON:
44 code = BTN_MIDDLE; 44 code = BTN_MIDDLE;
45 default: 45 default:
46 LOG(WARNING) << "Invalid flag: " << button << " for the button parameter"; 46 LOG(WARNING) << "Invalid flag: " << button << " for the button parameter";
47 return; 47 return;
48 } 48 }
49 49
50 dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams( 50 dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
51 kDeviceIdForInjection, cursor_->GetLocation(), code, down, 51 kDeviceIdForInjection, EF_NONE, cursor_->GetLocation(), code, down,
52 false /* allow_remap */, 52 false /* allow_remap */,
53 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), EventTimeForNow())); 53 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), EventTimeForNow()));
54 } 54 }
55 55
56 void InputInjectorEvdev::InjectMouseWheel(int delta_x, int delta_y) { 56 void InputInjectorEvdev::InjectMouseWheel(int delta_x, int delta_y) {
57 dispatcher_->DispatchMouseWheelEvent(MouseWheelEventParams( 57 dispatcher_->DispatchMouseWheelEvent(MouseWheelEventParams(
58 kDeviceIdForInjection, cursor_->GetLocation(), 58 kDeviceIdForInjection, cursor_->GetLocation(),
59 gfx::Vector2d(delta_x, delta_y), EventTimeForNow())); 59 gfx::Vector2d(delta_x, delta_y), EventTimeForNow()));
60 } 60 }
61 61
62 void InputInjectorEvdev::MoveCursorTo(const gfx::PointF& location) { 62 void InputInjectorEvdev::MoveCursorTo(const gfx::PointF& location) {
63 if (!cursor_) 63 if (!cursor_)
64 return; 64 return;
65 65
66 cursor_->MoveCursorTo(location); 66 cursor_->MoveCursorTo(location);
67 67
68 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams( 68 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams(
69 kDeviceIdForInjection, cursor_->GetLocation(), 69 kDeviceIdForInjection, EF_NONE, cursor_->GetLocation(),
70 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), EventTimeForNow())); 70 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), EventTimeForNow()));
71 } 71 }
72 72
73 void InputInjectorEvdev::InjectKeyEvent(DomCode physical_key, 73 void InputInjectorEvdev::InjectKeyEvent(DomCode physical_key,
74 bool down, 74 bool down,
75 bool suppress_auto_repeat) { 75 bool suppress_auto_repeat) {
76 if (physical_key == DomCode::NONE) 76 if (physical_key == DomCode::NONE)
77 return; 77 return;
78 78
79 int native_keycode = KeycodeConverter::DomCodeToNativeKeycode(physical_key); 79 int native_keycode = KeycodeConverter::DomCodeToNativeKeycode(physical_key);
80 int evdev_code = NativeCodeToEvdevCode(native_keycode); 80 int evdev_code = NativeCodeToEvdevCode(native_keycode);
81 81
82 dispatcher_->DispatchKeyEvent( 82 dispatcher_->DispatchKeyEvent(
83 KeyEventParams(kDeviceIdForInjection, evdev_code, down, 83 KeyEventParams(kDeviceIdForInjection, evdev_code, down,
84 suppress_auto_repeat, EventTimeForNow())); 84 suppress_auto_repeat, EventTimeForNow()));
85 } 85 }
86 86
87 } // namespace ui 87 } // namespace ui
88 88
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698