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

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

Issue 137273009: evdev: Factor common code out of key & touch converters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove duplicate variables & unneeded #include Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ui/events/ozone/evdev/event_converter.h ('k') | ui/events/ozone/evdev/event_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/events/ozone/evdev/event_converter.h"
6
7 #include <errno.h>
8 #include <linux/input.h>
9
10 #include "ui/events/ozone/evdev/event_modifiers.h"
11
12 namespace ui {
13
14 // Number of events to read at a time.
15 const int kEvdevBufferSize = 64;
16
17 EventConverterEvdev::EventConverterEvdev(int fd,
18 base::FilePath path,
19 EventModifiersEvdev* modifiers)
20 : fd_(fd), path_(path), modifiers_(modifiers) {}
21
22 EventConverterEvdev::~EventConverterEvdev() { close(fd_); }
23
24 void EventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) {
25 input_event inputs[kEvdevBufferSize];
26 ssize_t read_size = read(fd, inputs, sizeof(inputs));
27 if (read_size <= 0) {
28 if (errno == EINTR || errno == EAGAIN)
29 return;
30 PLOG(ERROR) << "error reading device " << path_.value();
31 return;
32 }
33
34 CHECK_EQ(read_size % sizeof(*inputs), 0u);
35 ProcessEvents(inputs, read_size / sizeof(*inputs));
36 }
37
38 void EventConverterEvdev::OnFileCanWriteWithoutBlocking(int fd) {
39 NOTREACHED();
40 }
41
42 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_converter.h ('k') | ui/events/ozone/evdev/event_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698