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

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

Issue 1097393011: Revert of Ozone support for device special cases in keyboard event rewriting. (patchset #6 id:12000… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/tablet_event_converter_evdev.h" 5 #include "ui/events/ozone/evdev/tablet_event_converter_evdev.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 "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "ui/events/event.h" 11 #include "ui/events/event.h"
12 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" 12 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h"
13 13
14 namespace ui { 14 namespace ui {
15 15
16 TabletEventConverterEvdev::TabletEventConverterEvdev( 16 TabletEventConverterEvdev::TabletEventConverterEvdev(
17 int fd, 17 int fd,
18 base::FilePath path, 18 base::FilePath path,
19 int id, 19 int id,
20 InputDeviceType type, 20 InputDeviceType type,
21 CursorDelegateEvdev* cursor, 21 CursorDelegateEvdev* cursor,
22 const EventDeviceInfo& info, 22 const EventDeviceInfo& info,
23 DeviceEventDispatcherEvdev* dispatcher) 23 DeviceEventDispatcherEvdev* dispatcher)
24 : EventConverterEvdev(fd, 24 : EventConverterEvdev(fd, path, id, type),
25 path,
26 id,
27 type,
28 info.name(),
29 info.vendor_id(),
30 info.product_id()),
31 cursor_(cursor), 25 cursor_(cursor),
32 dispatcher_(dispatcher), 26 dispatcher_(dispatcher),
33 stylus_(0), 27 stylus_(0),
34 abs_value_dirty_(false) { 28 abs_value_dirty_(false) {
35 x_abs_min_ = info.GetAbsMinimum(ABS_X); 29 x_abs_min_ = info.GetAbsMinimum(ABS_X);
36 x_abs_range_ = info.GetAbsMaximum(ABS_X) - x_abs_min_ + 1; 30 x_abs_range_ = info.GetAbsMaximum(ABS_X) - x_abs_min_ + 1;
37 y_abs_min_ = info.GetAbsMinimum(ABS_Y); 31 y_abs_min_ = info.GetAbsMinimum(ABS_Y);
38 y_abs_range_ = info.GetAbsMaximum(ABS_Y) - y_abs_min_ + 1; 32 y_abs_range_ = info.GetAbsMaximum(ABS_Y) - y_abs_min_ + 1;
39 } 33 }
40 34
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 return; 138 return;
145 139
146 if (abs_value_dirty_) { 140 if (abs_value_dirty_) {
147 UpdateCursor(); 141 UpdateCursor();
148 abs_value_dirty_ = false; 142 abs_value_dirty_ = false;
149 } 143 }
150 144
151 bool down = input.value; 145 bool down = input.value;
152 146
153 dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams( 147 dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
154 input_device_.id, cursor_->GetLocation(), button, down, 148 id_, cursor_->GetLocation(), button, down, false /* allow_remap */,
155 false /* allow_remap */, TimeDeltaFromInputEvent(input))); 149 TimeDeltaFromInputEvent(input)));
156 } 150 }
157 151
158 void TabletEventConverterEvdev::FlushEvents(const input_event& input) { 152 void TabletEventConverterEvdev::FlushEvents(const input_event& input) {
159 if (!cursor_) 153 if (!cursor_)
160 return; 154 return;
161 155
162 // Prevent propagation of invalid data on stylus lift off 156 // Prevent propagation of invalid data on stylus lift off
163 if (stylus_ == 0) { 157 if (stylus_ == 0) {
164 abs_value_dirty_ = false; 158 abs_value_dirty_ = false;
165 return; 159 return;
166 } 160 }
167 161
168 if (!abs_value_dirty_) 162 if (!abs_value_dirty_)
169 return; 163 return;
170 164
171 UpdateCursor(); 165 UpdateCursor();
172 166
173 dispatcher_->DispatchMouseMoveEvent( 167 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams(
174 MouseMoveEventParams(input_device_.id, cursor_->GetLocation(), 168 id_, cursor_->GetLocation(), TimeDeltaFromInputEvent(input)));
175 TimeDeltaFromInputEvent(input)));
176 169
177 abs_value_dirty_ = false; 170 abs_value_dirty_ = false;
178 } 171 }
179 172
180 } // namespace ui 173 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698