| 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/libgestures_glue/event_reader_libevdev_cros.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
| 9 #include <linux/input.h> | 9 #include <linux/input.h> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 EventReaderLibevdevCros::EventReaderLibevdevCros(int fd, | 28 EventReaderLibevdevCros::EventReaderLibevdevCros(int fd, |
| 29 const base::FilePath& path, | 29 const base::FilePath& path, |
| 30 int id, | 30 int id, |
| 31 InputDeviceType type, | 31 InputDeviceType type, |
| 32 const EventDeviceInfo& devinfo, | 32 const EventDeviceInfo& devinfo, |
| 33 scoped_ptr<Delegate> delegate) | 33 scoped_ptr<Delegate> delegate) |
| 34 : EventConverterEvdev(fd, path, id, type), | 34 : EventConverterEvdev(fd, path, id, type), |
| 35 has_keyboard_(devinfo.HasKeyboard()), | 35 has_keyboard_(devinfo.HasKeyboard()), |
| 36 has_mouse_(devinfo.HasMouse()), |
| 36 has_touchpad_(devinfo.HasTouchpad()), | 37 has_touchpad_(devinfo.HasTouchpad()), |
| 37 delegate_(delegate.Pass()) { | 38 delegate_(delegate.Pass()) { |
| 38 memset(&evdev_, 0, sizeof(evdev_)); | 39 memset(&evdev_, 0, sizeof(evdev_)); |
| 39 evdev_.log = OnLogMessage; | 40 evdev_.log = OnLogMessage; |
| 40 evdev_.log_udata = this; | 41 evdev_.log_udata = this; |
| 41 evdev_.syn_report = OnSynReport; | 42 evdev_.syn_report = OnSynReport; |
| 42 evdev_.syn_report_udata = this; | 43 evdev_.syn_report_udata = this; |
| 43 evdev_.fd = fd; | 44 evdev_.fd = fd; |
| 44 | 45 |
| 45 memset(&evstate_, 0, sizeof(evstate_)); | 46 memset(&evstate_, 0, sizeof(evstate_)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 66 PLOG(ERROR) << "error reading device " << path_.value(); | 67 PLOG(ERROR) << "error reading device " << path_.value(); |
| 67 Stop(); | 68 Stop(); |
| 68 return; | 69 return; |
| 69 } | 70 } |
| 70 } | 71 } |
| 71 | 72 |
| 72 bool EventReaderLibevdevCros::HasKeyboard() const { | 73 bool EventReaderLibevdevCros::HasKeyboard() const { |
| 73 return has_keyboard_; | 74 return has_keyboard_; |
| 74 } | 75 } |
| 75 | 76 |
| 77 bool EventReaderLibevdevCros::HasMouse() const { |
| 78 return has_mouse_; |
| 79 } |
| 80 |
| 76 bool EventReaderLibevdevCros::HasTouchpad() const { | 81 bool EventReaderLibevdevCros::HasTouchpad() const { |
| 77 return has_touchpad_; | 82 return has_touchpad_; |
| 78 } | 83 } |
| 79 | 84 |
| 80 void EventReaderLibevdevCros::SetAllowedKeys( | 85 void EventReaderLibevdevCros::SetAllowedKeys( |
| 81 scoped_ptr<std::set<DomCode>> allowed_keys) { | 86 scoped_ptr<std::set<DomCode>> allowed_keys) { |
| 82 DCHECK(HasKeyboard()); | 87 DCHECK(HasKeyboard()); |
| 83 delegate_->SetAllowedKeys(allowed_keys.Pass()); | 88 delegate_->SetAllowedKeys(allowed_keys.Pass()); |
| 84 } | 89 } |
| 85 | 90 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 109 if (level >= LOGLEVEL_ERROR) | 114 if (level >= LOGLEVEL_ERROR) |
| 110 LOG(ERROR) << "libevdev: " << FormatLog(fmt, args); | 115 LOG(ERROR) << "libevdev: " << FormatLog(fmt, args); |
| 111 else if (level >= LOGLEVEL_WARNING) | 116 else if (level >= LOGLEVEL_WARNING) |
| 112 LOG(WARNING) << "libevdev: " << FormatLog(fmt, args); | 117 LOG(WARNING) << "libevdev: " << FormatLog(fmt, args); |
| 113 else | 118 else |
| 114 VLOG(3) << "libevdev: " << FormatLog(fmt, args); | 119 VLOG(3) << "libevdev: " << FormatLog(fmt, args); |
| 115 va_end(args); | 120 va_end(args); |
| 116 } | 121 } |
| 117 | 122 |
| 118 } // namespace ui | 123 } // namespace ui |
| OLD | NEW |