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

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

Issue 889673004: ozone: evdev: Use kernel timestamps for mouse events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase error Created 5 years, 10 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/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/dom3/dom_code.h" 7 #include "ui/events/keycodes/dom3/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 27 matching lines...) Expand all
38 case EF_RIGHT_MOUSE_BUTTON: 38 case EF_RIGHT_MOUSE_BUTTON:
39 code = BTN_RIGHT; 39 code = BTN_RIGHT;
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( 48 dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
49 MouseButtonEventParams(kDeviceIdForInjection, cursor_->GetLocation(), 49 kDeviceIdForInjection, cursor_->GetLocation(), code, down,
50 code, down, false /* allow_remap */)); 50 false /* allow_remap */, EventTimeForNow()));
51 } 51 }
52 52
53 void InputInjectorEvdev::InjectMouseWheel(int delta_x, int delta_y) { 53 void InputInjectorEvdev::InjectMouseWheel(int delta_x, int delta_y) {
54 dispatcher_->DispatchMouseWheelEvent( 54 dispatcher_->DispatchMouseWheelEvent(MouseWheelEventParams(
55 MouseWheelEventParams(kDeviceIdForInjection, cursor_->GetLocation(), 55 kDeviceIdForInjection, cursor_->GetLocation(),
56 gfx::Vector2d(delta_x, delta_y))); 56 gfx::Vector2d(delta_x, delta_y), EventTimeForNow()));
57 } 57 }
58 58
59 void InputInjectorEvdev::MoveCursorTo(const gfx::PointF& location) { 59 void InputInjectorEvdev::MoveCursorTo(const gfx::PointF& location) {
60 if (!cursor_) 60 if (!cursor_)
61 return; 61 return;
62 62
63 cursor_->MoveCursorTo(location); 63 cursor_->MoveCursorTo(location);
64 64
65 dispatcher_->DispatchMouseMoveEvent( 65 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams(
66 MouseMoveEventParams(kDeviceIdForInjection, cursor_->GetLocation())); 66 kDeviceIdForInjection, cursor_->GetLocation(), EventTimeForNow()));
67 } 67 }
68 68
69 void InputInjectorEvdev::InjectKeyPress(DomCode physical_key, bool down) { 69 void InputInjectorEvdev::InjectKeyPress(DomCode physical_key, bool down) {
70 if (physical_key == DomCode::NONE) { 70 if (physical_key == DomCode::NONE) {
71 return; 71 return;
72 } 72 }
73 73
74 int native_keycode = KeycodeConverter::DomCodeToNativeKeycode(physical_key); 74 int native_keycode = KeycodeConverter::DomCodeToNativeKeycode(physical_key);
75 int evdev_code = NativeCodeToEvdevCode(native_keycode); 75 int evdev_code = NativeCodeToEvdevCode(native_keycode);
76 76
77 dispatcher_->DispatchKeyEvent(KeyEventParams( 77 dispatcher_->DispatchKeyEvent(KeyEventParams(
78 kDeviceIdForInjection, evdev_code, down, EventTimeForNow())); 78 kDeviceIdForInjection, evdev_code, down, EventTimeForNow()));
79 } 79 }
80 80
81 } // namespace ui 81 } // namespace ui
82 82
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698