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

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

Issue 889673004: ozone: evdev: Use kernel timestamps for mouse events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on MouseEvent timestamp changes & fix stime feedback 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/ozone/evdev/event_converter_evdev_impl.h" 5 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 9
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 switch (input.type) { 91 switch (input.type) {
92 case EV_KEY: 92 case EV_KEY:
93 ConvertKeyEvent(input); 93 ConvertKeyEvent(input);
94 break; 94 break;
95 case EV_REL: 95 case EV_REL:
96 ConvertMouseMoveEvent(input); 96 ConvertMouseMoveEvent(input);
97 break; 97 break;
98 case EV_SYN: 98 case EV_SYN:
99 if (input.code == SYN_DROPPED) 99 if (input.code == SYN_DROPPED)
100 LOG(WARNING) << "kernel dropped input events"; 100 LOG(WARNING) << "kernel dropped input events";
101 FlushEvents(); 101 FlushEvents(input);
102 break; 102 break;
103 } 103 }
104 } 104 }
105 } 105 }
106 106
107 void EventConverterEvdevImpl::ConvertKeyEvent(const input_event& input) { 107 void EventConverterEvdevImpl::ConvertKeyEvent(const input_event& input) {
108 // Ignore repeat events. 108 // Ignore repeat events.
109 if (input.value == kKeyRepeatValue) 109 if (input.value == kKeyRepeatValue)
110 return; 110 return;
111 111
(...skipping 23 matching lines...) Expand all
135 case REL_Y: 135 case REL_Y:
136 y_offset_ = input.value; 136 y_offset_ = input.value;
137 break; 137 break;
138 } 138 }
139 } 139 }
140 140
141 void EventConverterEvdevImpl::DispatchMouseButton(const input_event& input) { 141 void EventConverterEvdevImpl::DispatchMouseButton(const input_event& input) {
142 if (!cursor_) 142 if (!cursor_)
143 return; 143 return;
144 144
145 dispatcher_->DispatchMouseButtonEvent( 145 dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
146 MouseButtonEventParams(id_, cursor_->GetLocation(), input.code, 146 id_, cursor_->GetLocation(), input.code, input.value,
147 input.value, /* allow_remap */ true)); 147 /* allow_remap */ true, TimeDeltaFromInputEvent(input)));
148 } 148 }
149 149
150 void EventConverterEvdevImpl::FlushEvents() { 150 void EventConverterEvdevImpl::FlushEvents(const input_event& input) {
151 if (!cursor_ || (x_offset_ == 0 && y_offset_ == 0)) 151 if (!cursor_ || (x_offset_ == 0 && y_offset_ == 0))
152 return; 152 return;
153 153
154 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_)); 154 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_));
155 155
156 dispatcher_->DispatchMouseMoveEvent( 156 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams(
157 MouseMoveEventParams(id_, cursor_->GetLocation())); 157 id_, cursor_->GetLocation(), TimeDeltaFromInputEvent(input)));
158 158
159 x_offset_ = 0; 159 x_offset_ = 0;
160 y_offset_ = 0; 160 y_offset_ = 0;
161 } 161 }
162 162
163 } // namespace ui 163 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698