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

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

Issue 797483002: ozone: evdev: Populate keyboard list on DeviceDataManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 "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/keycodes/dom4/keycode_converter.h" 12 #include "ui/events/keycodes/dom4/keycode_converter.h"
13 #include "ui/events/keycodes/keyboard_codes.h" 13 #include "ui/events/keycodes/keyboard_codes.h"
14 14
15 namespace ui { 15 namespace ui {
16 16
17 EventConverterEvdevImpl::EventConverterEvdevImpl( 17 EventConverterEvdevImpl::EventConverterEvdevImpl(
18 int fd, 18 int fd,
19 base::FilePath path, 19 base::FilePath path,
20 int id, 20 int id,
21 InputDeviceType type, 21 InputDeviceType type,
22 const EventDeviceInfo& devinfo,
22 EventModifiersEvdev* modifiers, 23 EventModifiersEvdev* modifiers,
23 MouseButtonMapEvdev* button_map, 24 MouseButtonMapEvdev* button_map,
24 CursorDelegateEvdev* cursor, 25 CursorDelegateEvdev* cursor,
25 KeyboardEvdev* keyboard, 26 KeyboardEvdev* keyboard,
26 const EventDispatchCallback& callback) 27 const EventDispatchCallback& callback)
27 : EventConverterEvdev(fd, path, id, type), 28 : EventConverterEvdev(fd, path, id, type),
29 has_keyboard_(devinfo.HasKeyboard()),
28 x_offset_(0), 30 x_offset_(0),
29 y_offset_(0), 31 y_offset_(0),
30 cursor_(cursor), 32 cursor_(cursor),
31 keyboard_(keyboard), 33 keyboard_(keyboard),
32 modifiers_(modifiers), 34 modifiers_(modifiers),
33 button_map_(button_map), 35 button_map_(button_map),
34 callback_(callback) { 36 callback_(callback) {
35 } 37 }
36 38
37 EventConverterEvdevImpl::~EventConverterEvdevImpl() { 39 EventConverterEvdevImpl::~EventConverterEvdevImpl() {
(...skipping 10 matching lines...) Expand all
48 if (errno != ENODEV) 50 if (errno != ENODEV)
49 PLOG(ERROR) << "error reading device " << path_.value(); 51 PLOG(ERROR) << "error reading device " << path_.value();
50 Stop(); 52 Stop();
51 return; 53 return;
52 } 54 }
53 55
54 DCHECK_EQ(read_size % sizeof(*inputs), 0u); 56 DCHECK_EQ(read_size % sizeof(*inputs), 0u);
55 ProcessEvents(inputs, read_size / sizeof(*inputs)); 57 ProcessEvents(inputs, read_size / sizeof(*inputs));
56 } 58 }
57 59
60 bool EventConverterEvdevImpl::HasKeyboard() const {
61 return has_keyboard_;
62 }
63
58 void EventConverterEvdevImpl::ProcessEvents(const input_event* inputs, 64 void EventConverterEvdevImpl::ProcessEvents(const input_event* inputs,
59 int count) { 65 int count) {
60 for (int i = 0; i < count; ++i) { 66 for (int i = 0; i < count; ++i) {
61 const input_event& input = inputs[i]; 67 const input_event& input = inputs[i];
62 switch (input.type) { 68 switch (input.type) {
63 case EV_KEY: 69 case EV_KEY:
64 ConvertKeyEvent(input); 70 ConvertKeyEvent(input);
65 break; 71 break;
66 case EV_REL: 72 case EV_REL:
67 ConvertMouseMoveEvent(input); 73 ConvertMouseMoveEvent(input);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 new MouseEvent(ui::ET_MOUSE_MOVED, 137 new MouseEvent(ui::ET_MOUSE_MOVED,
132 cursor_->GetLocation(), 138 cursor_->GetLocation(),
133 cursor_->GetLocation(), 139 cursor_->GetLocation(),
134 modifiers_->GetModifierFlags(), 140 modifiers_->GetModifierFlags(),
135 /* changed_button_flags */ 0))); 141 /* changed_button_flags */ 0)));
136 x_offset_ = 0; 142 x_offset_ = 0;
137 y_offset_ = 0; 143 y_offset_ = 0;
138 } 144 }
139 145
140 } // namespace ui 146 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698