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

Side by Side Diff: ui/events/ozone/evdev/event_factory.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.cc ('k') | ui/events/ozone/evdev/key_event_converter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_factory.h" 5 #include "ui/events/ozone/evdev/event_factory.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <linux/input.h> 9 #include <linux/input.h>
10 #include <poll.h> 10 #include <poll.h>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 if (IsTouchPad(devinfo)) { 60 if (IsTouchPad(devinfo)) {
61 LOG(WARNING) << "touchpad device not supported: " << path.value(); 61 LOG(WARNING) << "touchpad device not supported: " << path.value();
62 close(fd); 62 close(fd);
63 return; 63 return;
64 } 64 }
65 65
66 // TODO(spang) Add more device types. Support hot-plugging. 66 // TODO(spang) Add more device types. Support hot-plugging.
67 scoped_ptr<EventConverterOzone> converter; 67 scoped_ptr<EventConverterOzone> converter;
68 if (IsTouchScreen(devinfo)) 68 if (IsTouchScreen(devinfo))
69 converter.reset(new TouchEventConverterEvdev(fd, path)); 69 converter.reset(new TouchEventConverterEvdev(fd, path, &modifiers_));
70 else if (devinfo.HasEventType(EV_KEY)) 70 else if (devinfo.HasEventType(EV_KEY))
71 converter.reset(new KeyEventConverterEvdev(fd, path, &modifiers_)); 71 converter.reset(new KeyEventConverterEvdev(fd, path, &modifiers_));
72 72
73 if (converter) { 73 if (converter) {
74 AddEventConverter(fd, converter.Pass()); 74 AddEventConverter(fd, converter.Pass());
75 } else { 75 } else {
76 close(fd); 76 close(fd);
77 } 77 }
78 } 78 }
79 79
80 void EventFactoryEvdev::StartProcessingEvents() { 80 void EventFactoryEvdev::StartProcessingEvents() {
81 base::ThreadRestrictions::AssertIOAllowed(); 81 base::ThreadRestrictions::AssertIOAllowed();
82 82
83 base::FileEnumerator file_enum( 83 base::FileEnumerator file_enum(
84 base::FilePath("/dev/input"), false, base::FileEnumerator::FILES); 84 base::FilePath("/dev/input"), false, base::FileEnumerator::FILES);
85 for (base::FilePath path = file_enum.Next(); !path.empty(); 85 for (base::FilePath path = file_enum.Next(); !path.empty();
86 path = file_enum.Next()) 86 path = file_enum.Next())
87 AttachInputDevice(path); 87 AttachInputDevice(path);
88 } 88 }
89 89
90 } // namespace ui 90 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_converter.cc ('k') | ui/events/ozone/evdev/key_event_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698