| 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/tablet_event_converter_evdev.h" | 5 #include "ui/events/ozone/evdev/tablet_event_converter_evdev.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 ssize_t read_size = read(fd, inputs, sizeof(inputs)); | 43 ssize_t read_size = read(fd, inputs, sizeof(inputs)); |
| 44 if (read_size < 0) { | 44 if (read_size < 0) { |
| 45 if (errno == EINTR || errno == EAGAIN) | 45 if (errno == EINTR || errno == EAGAIN) |
| 46 return; | 46 return; |
| 47 if (errno != ENODEV) | 47 if (errno != ENODEV) |
| 48 PLOG(ERROR) << "error reading device " << path_.value(); | 48 PLOG(ERROR) << "error reading device " << path_.value(); |
| 49 Stop(); | 49 Stop(); |
| 50 return; | 50 return; |
| 51 } | 51 } |
| 52 | 52 |
| 53 if (ignore_events_) |
| 54 return; |
| 55 |
| 53 DCHECK_EQ(read_size % sizeof(*inputs), 0u); | 56 DCHECK_EQ(read_size % sizeof(*inputs), 0u); |
| 54 ProcessEvents(inputs, read_size / sizeof(*inputs)); | 57 ProcessEvents(inputs, read_size / sizeof(*inputs)); |
| 55 } | 58 } |
| 56 | 59 |
| 57 void TabletEventConverterEvdev::ProcessEvents(const input_event* inputs, | 60 void TabletEventConverterEvdev::ProcessEvents(const input_event* inputs, |
| 58 int count) { | 61 int count) { |
| 59 for (int i = 0; i < count; ++i) { | 62 for (int i = 0; i < count; ++i) { |
| 60 const input_event& input = inputs[i]; | 63 const input_event& input = inputs[i]; |
| 61 switch (input.type) { | 64 switch (input.type) { |
| 62 case EV_KEY: | 65 case EV_KEY: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 168 |
| 166 callback_.Run(make_scoped_ptr( | 169 callback_.Run(make_scoped_ptr( |
| 167 new MouseEvent(ui::ET_MOUSE_MOVED, cursor_->GetLocation(), | 170 new MouseEvent(ui::ET_MOUSE_MOVED, cursor_->GetLocation(), |
| 168 cursor_->GetLocation(), modifiers_->GetModifierFlags(), | 171 cursor_->GetLocation(), modifiers_->GetModifierFlags(), |
| 169 /* changed_button_flags */ 0))); | 172 /* changed_button_flags */ 0))); |
| 170 | 173 |
| 171 abs_value_dirty_ = false; | 174 abs_value_dirty_ = false; |
| 172 } | 175 } |
| 173 | 176 |
| 174 } // namespace ui | 177 } // namespace ui |
| OLD | NEW |