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_factory_evdev.h" | 5 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/task_runner.h" | 9 #include "base/task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 // Transform the event to align touches to the image based on display mode. | 151 // Transform the event to align touches to the image based on display mode. |
152 DeviceDataManager::GetInstance()->ApplyTouchTransformer(params.device_id, &x, | 152 DeviceDataManager::GetInstance()->ApplyTouchTransformer(params.device_id, &x, |
153 &y); | 153 &y); |
154 DeviceDataManager::GetInstance()->ApplyTouchRadiusScale(params.device_id, | 154 DeviceDataManager::GetInstance()->ApplyTouchRadiusScale(params.device_id, |
155 &radius_x); | 155 &radius_x); |
156 DeviceDataManager::GetInstance()->ApplyTouchRadiusScale(params.device_id, | 156 DeviceDataManager::GetInstance()->ApplyTouchRadiusScale(params.device_id, |
157 &radius_y); | 157 &radius_y); |
158 | 158 |
159 scoped_ptr<TouchEvent> touch_event(new TouchEvent( | 159 scoped_ptr<TouchEvent> touch_event(new TouchEvent( |
160 params.type, gfx::PointF(x, y), | 160 params.type, gfx::PointF(x, y), modifiers_.GetModifierFlags(), |
161 /* flags */ 0, params.touch_id, params.timestamp, radius_x, radius_y, | 161 params.touch_id, params.timestamp, radius_x, radius_y, |
162 /* angle */ 0., params.pressure)); | 162 /* angle */ 0., params.pressure)); |
163 touch_event->set_source_device_id(params.device_id); | 163 touch_event->set_source_device_id(params.device_id); |
164 PostUiEvent(touch_event.Pass()); | 164 PostUiEvent(touch_event.Pass()); |
165 } | 165 } |
166 | 166 |
167 void EventFactoryEvdev::PostUiEvent(scoped_ptr<Event> event) { | 167 void EventFactoryEvdev::PostUiEvent(scoped_ptr<Event> event) { |
168 base::ThreadTaskRunnerHandle::Get()->PostTask( | 168 base::ThreadTaskRunnerHandle::Get()->PostTask( |
169 FROM_HERE, | 169 FROM_HERE, |
170 base::Bind(&EventFactoryEvdev::DispatchUiEventTask, | 170 base::Bind(&EventFactoryEvdev::DispatchUiEventTask, |
171 weak_ptr_factory_.GetWeakPtr(), | 171 weak_ptr_factory_.GetWeakPtr(), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 modifiers_.GetModifierFlags(), | 210 modifiers_.GetModifierFlags(), |
211 /* changed_button_flags */ 0))); | 211 /* changed_button_flags */ 0))); |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 int EventFactoryEvdev::NextDeviceId() { | 215 int EventFactoryEvdev::NextDeviceId() { |
216 return ++last_device_id_; | 216 return ++last_device_id_; |
217 } | 217 } |
218 | 218 |
219 } // namespace ui | 219 } // namespace ui |
OLD | NEW |