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

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

Issue 616633002: [Ozone-Evdev] Propagate touchscreen device information to DeviceDataManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 2 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/key_event_converter_evdev.h" 5 #include "ui/events/ozone/evdev/key_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/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 #include "ui/events/ozone/evdev/event_device_info.h"
14 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" 15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h"
15 16
16 namespace ui { 17 namespace ui {
17 18
18 namespace { 19 namespace {
19 20
20 const int kXkbKeycodeOffset = 8; 21 const int kXkbKeycodeOffset = 8;
21 22
22 ui::KeyboardCode KeyboardCodeFromButton(unsigned int code) { 23 ui::KeyboardCode KeyboardCodeFromButton(unsigned int code) {
23 static const ui::KeyboardCode kLinuxBaseKeyMap[] = { 24 static const ui::KeyboardCode kLinuxBaseKeyMap[] = {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 186 }
186 } 187 }
187 188
188 bool IsLockButton(unsigned int code) { return code == KEY_CAPSLOCK; } 189 bool IsLockButton(unsigned int code) { return code == KEY_CAPSLOCK; }
189 190
190 } // namespace 191 } // namespace
191 192
192 KeyEventConverterEvdev::KeyEventConverterEvdev( 193 KeyEventConverterEvdev::KeyEventConverterEvdev(
193 int fd, 194 int fd,
194 base::FilePath path, 195 base::FilePath path,
196 scoped_ptr<EventDeviceInfo> device_info,
195 EventModifiersEvdev* modifiers, 197 EventModifiersEvdev* modifiers,
196 const EventDispatchCallback& callback) 198 const EventDispatchCallback& callback)
197 : EventConverterEvdev(fd, path), 199 : EventConverterEvdev(fd, path, device_info.Pass()),
198 callback_(callback), 200 callback_(callback),
199 modifiers_(modifiers) { 201 modifiers_(modifiers) {
200 // TODO(spang): Initialize modifiers using EVIOCGKEY. 202 // TODO(spang): Initialize modifiers using EVIOCGKEY.
201 } 203 }
202 204
203 KeyEventConverterEvdev::~KeyEventConverterEvdev() { 205 KeyEventConverterEvdev::~KeyEventConverterEvdev() {
204 Stop(); 206 Stop();
205 close(fd_); 207 close(fd_);
206 } 208 }
207 209
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 255
254 KeyEvent key_event( 256 KeyEvent key_event(
255 down ? ET_KEY_PRESSED : ET_KEY_RELEASED, 257 down ? ET_KEY_PRESSED : ET_KEY_RELEASED,
256 code, 258 code,
257 KeycodeConverter::NativeKeycodeToCode(key + kXkbKeycodeOffset), 259 KeycodeConverter::NativeKeycodeToCode(key + kXkbKeycodeOffset),
258 flags); 260 flags);
259 callback_.Run(&key_event); 261 callback_.Run(&key_event);
260 } 262 }
261 263
262 } // namespace ui 264 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698