OLD | NEW |
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" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 bool IsLockButton(unsigned int code) { return code == KEY_CAPSLOCK; } | 188 bool IsLockButton(unsigned int code) { return code == KEY_CAPSLOCK; } |
189 | 189 |
190 } // namespace | 190 } // namespace |
191 | 191 |
192 KeyEventConverterEvdev::KeyEventConverterEvdev( | 192 KeyEventConverterEvdev::KeyEventConverterEvdev( |
193 int fd, | 193 int fd, |
194 base::FilePath path, | 194 base::FilePath path, |
| 195 int id, |
195 EventModifiersEvdev* modifiers, | 196 EventModifiersEvdev* modifiers, |
196 const EventDispatchCallback& callback) | 197 const EventDispatchCallback& callback) |
197 : EventConverterEvdev(fd, path), | 198 : EventConverterEvdev(fd, path, id), |
198 callback_(callback), | 199 callback_(callback), |
199 modifiers_(modifiers) { | 200 modifiers_(modifiers) { |
200 // TODO(spang): Initialize modifiers using EVIOCGKEY. | 201 // TODO(spang): Initialize modifiers using EVIOCGKEY. |
201 } | 202 } |
202 | 203 |
203 KeyEventConverterEvdev::~KeyEventConverterEvdev() { | 204 KeyEventConverterEvdev::~KeyEventConverterEvdev() { |
204 Stop(); | 205 Stop(); |
205 close(fd_); | 206 close(fd_); |
206 } | 207 } |
207 | 208 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 254 |
254 KeyEvent key_event( | 255 KeyEvent key_event( |
255 down ? ET_KEY_PRESSED : ET_KEY_RELEASED, | 256 down ? ET_KEY_PRESSED : ET_KEY_RELEASED, |
256 code, | 257 code, |
257 KeycodeConverter::NativeKeycodeToCode(key + kXkbKeycodeOffset), | 258 KeycodeConverter::NativeKeycodeToCode(key + kXkbKeycodeOffset), |
258 flags); | 259 flags); |
259 callback_.Run(&key_event); | 260 callback_.Run(&key_event); |
260 } | 261 } |
261 | 262 |
262 } // namespace ui | 263 } // namespace ui |
OLD | NEW |