| 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/event_converter_evdev_impl.h" | 5 #include "ui/events/ozone/evdev/event_converter_evdev_impl.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 "ui/events/event.h" | 10 #include "ui/events/event.h" |
| 11 #include "ui/events/keycodes/dom4/keycode_converter.h" | 11 #include "ui/events/keycodes/dom4/keycode_converter.h" |
| 12 #include "ui/events/ozone/evdev/keyboard_util_evdev.h" | 12 #include "ui/events/ozone/evdev/keyboard_util_evdev.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // Values for EV_KEY. | 18 // Values for EV_KEY. |
| 19 const int kKeyReleaseValue = 0; | 19 const int kKeyReleaseValue = 0; |
| 20 const int kKeyRepeatValue = 2; | 20 const int kKeyRepeatValue = 2; |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 EventConverterEvdevImpl::EventConverterEvdevImpl( | 24 EventConverterEvdevImpl::EventConverterEvdevImpl( |
| 25 int fd, | 25 int fd, |
| 26 base::FilePath path, | 26 base::FilePath path, |
| 27 int id, | 27 int id, |
| 28 InputDeviceType type, | 28 InputDeviceType type, |
| 29 const EventDeviceInfo& devinfo, | 29 const EventDeviceInfo& devinfo, |
| 30 EventModifiersEvdev* modifiers, | |
| 31 CursorDelegateEvdev* cursor, | 30 CursorDelegateEvdev* cursor, |
| 32 const KeyEventDispatchCallback& key_callback, | 31 const KeyEventDispatchCallback& key_callback, |
| 33 const MouseMoveEventDispatchCallback& mouse_move_callback, | 32 const MouseMoveEventDispatchCallback& mouse_move_callback, |
| 34 const MouseButtonEventDispatchCallback& mouse_button_callback) | 33 const MouseButtonEventDispatchCallback& mouse_button_callback) |
| 35 : EventConverterEvdev(fd, path, id, type), | 34 : EventConverterEvdev(fd, path, id, type), |
| 36 has_keyboard_(devinfo.HasKeyboard()), | 35 has_keyboard_(devinfo.HasKeyboard()), |
| 37 has_touchpad_(devinfo.HasTouchpad()), | 36 has_touchpad_(devinfo.HasTouchpad()), |
| 38 x_offset_(0), | 37 x_offset_(0), |
| 39 y_offset_(0), | 38 y_offset_(0), |
| 40 cursor_(cursor), | 39 cursor_(cursor), |
| 41 modifiers_(modifiers), | |
| 42 key_callback_(key_callback), | 40 key_callback_(key_callback), |
| 43 mouse_move_callback_(mouse_move_callback), | 41 mouse_move_callback_(mouse_move_callback), |
| 44 mouse_button_callback_(mouse_button_callback) { | 42 mouse_button_callback_(mouse_button_callback) { |
| 45 } | 43 } |
| 46 | 44 |
| 47 EventConverterEvdevImpl::~EventConverterEvdevImpl() { | 45 EventConverterEvdevImpl::~EventConverterEvdevImpl() { |
| 48 Stop(); | 46 Stop(); |
| 49 close(fd_); | 47 close(fd_); |
| 50 } | 48 } |
| 51 | 49 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 153 |
| 156 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_)); | 154 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_)); |
| 157 | 155 |
| 158 mouse_move_callback_.Run(MouseMoveEventParams(id_, cursor_->GetLocation())); | 156 mouse_move_callback_.Run(MouseMoveEventParams(id_, cursor_->GetLocation())); |
| 159 | 157 |
| 160 x_offset_ = 0; | 158 x_offset_ = 0; |
| 161 y_offset_ = 0; | 159 y_offset_ = 0; |
| 162 } | 160 } |
| 163 | 161 |
| 164 } // namespace ui | 162 } // namespace ui |
| OLD | NEW |