| 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 <linux/input.h> | 5 #include <linux/input.h> |
| 6 | 6 |
| 7 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 7 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 EventConverterEvdev::~EventConverterEvdev() { | 23 EventConverterEvdev::~EventConverterEvdev() { |
| 24 Stop(); | 24 Stop(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void EventConverterEvdev::Start() { | 27 void EventConverterEvdev::Start() { |
| 28 base::MessageLoopForUI::current()->WatchFileDescriptor( | 28 base::MessageLoopForUI::current()->WatchFileDescriptor( |
| 29 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); | 29 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void EventConverterEvdev::Stop() { | 32 void EventConverterEvdev::Stop() { |
| 33 // TODO(spang): If we reach here due to an error, we should treat it | |
| 34 // as if we have lost sync & release held keys, etc. | |
| 35 controller_.StopWatchingFileDescriptor(); | 33 controller_.StopWatchingFileDescriptor(); |
| 34 |
| 35 OnStopped(); |
| 36 } |
| 37 |
| 38 void EventConverterEvdev::OnStopped() { |
| 36 } | 39 } |
| 37 | 40 |
| 38 void EventConverterEvdev::OnFileCanWriteWithoutBlocking(int fd) { | 41 void EventConverterEvdev::OnFileCanWriteWithoutBlocking(int fd) { |
| 39 NOTREACHED(); | 42 NOTREACHED(); |
| 40 } | 43 } |
| 41 | 44 |
| 42 bool EventConverterEvdev::HasKeyboard() const { | 45 bool EventConverterEvdev::HasKeyboard() const { |
| 43 return false; | 46 return false; |
| 44 } | 47 } |
| 45 | 48 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 Stop(); | 107 Stop(); |
| 105 } | 108 } |
| 106 } | 109 } |
| 107 | 110 |
| 108 base::TimeDelta EventConverterEvdev::TimeDeltaFromInputEvent( | 111 base::TimeDelta EventConverterEvdev::TimeDeltaFromInputEvent( |
| 109 const input_event& event) { | 112 const input_event& event) { |
| 110 return base::TimeDelta::FromMicroseconds(event.time.tv_sec * 1000000 + | 113 return base::TimeDelta::FromMicroseconds(event.time.tv_sec * 1000000 + |
| 111 event.time.tv_usec); | 114 event.time.tv_usec); |
| 112 } | 115 } |
| 113 } // namespace ui | 116 } // namespace ui |
| OLD | NEW |