Chromium Code Reviews| Index: ui/events/ozone/evdev/event_converter_evdev_impl.cc |
| diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc |
| index 9654ec4cecd49d373a66419a514968025ac645f4..7ca333e029fc46fe320f7aae505dc95b0fbe07b7 100644 |
| --- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc |
| +++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc |
| @@ -27,6 +27,7 @@ EventConverterEvdevImpl::EventConverterEvdevImpl( |
| const EventDispatchCallback& callback) |
| : EventConverterEvdev(fd, path, id, type), |
| has_keyboard_(devinfo.HasKeyboard()), |
| + has_touchpad_(devinfo.HasTouchpad()), |
| x_offset_(0), |
| y_offset_(0), |
| cursor_(cursor), |
| @@ -53,14 +54,32 @@ void EventConverterEvdevImpl::OnFileCanReadWithoutBlocking(int fd) { |
| return; |
| } |
| + if (ignore_events_) |
| + return; |
| + |
| DCHECK_EQ(read_size % sizeof(*inputs), 0u); |
| ProcessEvents(inputs, read_size / sizeof(*inputs)); |
| } |
| +void EventConverterEvdevImpl::SetAllowedKeys( |
| + scoped_ptr<std::set<KeyboardCode> > allowed_keys) { |
| + DCHECK(HasKeyboard()); |
| + allowed_keys_ = allowed_keys.Pass(); |
| +} |
| + |
| +void EventConverterEvdevImpl::AllowAllKeys() { |
| + DCHECK(HasKeyboard()); |
| + allowed_keys_.reset(); |
| +} |
| + |
| bool EventConverterEvdevImpl::HasKeyboard() const { |
| return has_keyboard_; |
| } |
| +bool EventConverterEvdevImpl::HasTouchpad() const { |
| + return has_touchpad_; |
| +} |
| + |
| void EventConverterEvdevImpl::ProcessEvents(const input_event* inputs, |
| int count) { |
| for (int i = 0; i < count; ++i) { |
| @@ -86,7 +105,9 @@ void EventConverterEvdevImpl::ConvertKeyEvent(const input_event& input) { |
| return; |
| } |
| // Keyboard processing. |
| - keyboard_->OnKeyChange(input.code, input.value != 0); |
| + KeyboardCode key_code = KeyboardEvdev::KeyboardCodeFromEvdevKey(input.code); |
|
spang
2014/12/22 18:56:16
I think this the key filter should probably use Do
kpschoedel
2014/12/22 19:17:56
Yes, assuming the comment in
scoped_disable_inter
|
| + if (!allowed_keys_ || allowed_keys_->count(key_code)) |
| + keyboard_->OnKeyChange(input.code, input.value != 0); |
| } |
| void EventConverterEvdevImpl::ConvertMouseMoveEvent(const input_event& input) { |