| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |