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

Side by Side Diff: ui/events/ozone/evdev/event_converter_evdev_impl.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/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 13 matching lines...) Expand all
24 } // namespace 24 } // namespace
25 25
26 EventConverterEvdevImpl::EventConverterEvdevImpl( 26 EventConverterEvdevImpl::EventConverterEvdevImpl(
27 int fd, 27 int fd,
28 base::FilePath path, 28 base::FilePath path,
29 int id, 29 int id,
30 InputDeviceType type, 30 InputDeviceType type,
31 const EventDeviceInfo& devinfo, 31 const EventDeviceInfo& devinfo,
32 CursorDelegateEvdev* cursor, 32 CursorDelegateEvdev* cursor,
33 DeviceEventDispatcherEvdev* dispatcher) 33 DeviceEventDispatcherEvdev* dispatcher)
34 : EventConverterEvdev(fd, 34 : EventConverterEvdev(fd, path, id, type),
35 path,
36 id,
37 type,
38 devinfo.name(),
39 devinfo.vendor_id(),
40 devinfo.product_id()),
41 has_keyboard_(devinfo.HasKeyboard()), 35 has_keyboard_(devinfo.HasKeyboard()),
42 has_touchpad_(devinfo.HasTouchpad()), 36 has_touchpad_(devinfo.HasTouchpad()),
43 has_caps_lock_led_(devinfo.HasLedEvent(LED_CAPSL)), 37 has_caps_lock_led_(devinfo.HasLedEvent(LED_CAPSL)),
44 x_offset_(0), 38 x_offset_(0),
45 y_offset_(0), 39 y_offset_(0),
46 cursor_(cursor), 40 cursor_(cursor),
47 dispatcher_(dispatcher) { 41 dispatcher_(dispatcher) {
48 } 42 }
49 43
50 EventConverterEvdevImpl::~EventConverterEvdevImpl() { 44 EventConverterEvdevImpl::~EventConverterEvdevImpl() {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 if (down == key_state_.test(key)) 171 if (down == key_state_.test(key))
178 return; 172 return;
179 173
180 // Apply key filter (releases for previously pressed keys are excepted). 174 // Apply key filter (releases for previously pressed keys are excepted).
181 if (down && blocked_keys_.test(key)) 175 if (down && blocked_keys_.test(key))
182 return; 176 return;
183 177
184 // State transition: !(down) -> (down) 178 // State transition: !(down) -> (down)
185 key_state_.set(key, down); 179 key_state_.set(key, down);
186 180
187 dispatcher_->DispatchKeyEvent( 181 dispatcher_->DispatchKeyEvent(KeyEventParams(id_, key, down, timestamp));
188 KeyEventParams(input_device_.id, key, down, timestamp));
189 } 182 }
190 183
191 void EventConverterEvdevImpl::ReleaseKeys() { 184 void EventConverterEvdevImpl::ReleaseKeys() {
192 base::TimeDelta timestamp = ui::EventTimeForNow(); 185 base::TimeDelta timestamp = ui::EventTimeForNow();
193 for (int key = 0; key < KEY_CNT; ++key) 186 for (int key = 0; key < KEY_CNT; ++key)
194 OnKeyChange(key, false /* down */, timestamp); 187 OnKeyChange(key, false /* down */, timestamp);
195 } 188 }
196 189
197 void EventConverterEvdevImpl::ReleaseMouseButtons() { 190 void EventConverterEvdevImpl::ReleaseMouseButtons() {
198 base::TimeDelta timestamp = ui::EventTimeForNow(); 191 base::TimeDelta timestamp = ui::EventTimeForNow();
(...skipping 24 matching lines...) Expand all
223 code = BTN_BACK; 216 code = BTN_BACK;
224 else if (code == BTN_EXTRA) 217 else if (code == BTN_EXTRA)
225 code = BTN_FORWARD; 218 code = BTN_FORWARD;
226 219
227 int button_offset = code - BTN_MOUSE; 220 int button_offset = code - BTN_MOUSE;
228 if (mouse_button_state_.test(button_offset) == down) 221 if (mouse_button_state_.test(button_offset) == down)
229 return; 222 return;
230 223
231 mouse_button_state_.set(button_offset, down); 224 mouse_button_state_.set(button_offset, down);
232 225
233 dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams( 226 dispatcher_->DispatchMouseButtonEvent(
234 input_device_.id, cursor_->GetLocation(), code, down, 227 MouseButtonEventParams(id_, cursor_->GetLocation(), code, down,
235 /* allow_remap */ true, timestamp)); 228 /* allow_remap */ true, timestamp));
236 } 229 }
237 230
238 void EventConverterEvdevImpl::FlushEvents(const input_event& input) { 231 void EventConverterEvdevImpl::FlushEvents(const input_event& input) {
239 if (!cursor_ || (x_offset_ == 0 && y_offset_ == 0)) 232 if (!cursor_ || (x_offset_ == 0 && y_offset_ == 0))
240 return; 233 return;
241 234
242 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_)); 235 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_));
243 236
244 dispatcher_->DispatchMouseMoveEvent( 237 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams(
245 MouseMoveEventParams(input_device_.id, cursor_->GetLocation(), 238 id_, cursor_->GetLocation(), TimeDeltaFromInputEvent(input)));
246 TimeDeltaFromInputEvent(input)));
247 239
248 x_offset_ = 0; 240 x_offset_ = 0;
249 y_offset_ = 0; 241 y_offset_ = 0;
250 } 242 }
251 243
252 } // namespace ui 244 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_converter_evdev.cc ('k') | ui/events/ozone/evdev/event_device_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698