Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1056)

Side by Side Diff: ui/events/ozone/evdev/event_factory_evdev.cc

Issue 1294523004: ozone: Handle pressure and tilt for stylus devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-pe-details
Patch Set: Drop now unused mutators. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/task_runner.h" 8 #include "base/task_runner.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "base/threading/worker_pool.h" 10 #include "base/threading/worker_pool.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 void EventFactoryEvdev::DispatchMouseMoveEvent( 162 void EventFactoryEvdev::DispatchMouseMoveEvent(
163 const MouseMoveEventParams& params) { 163 const MouseMoveEventParams& params) {
164 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseMoveEvent", "device", 164 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseMoveEvent", "device",
165 params.device_id); 165 params.device_id);
166 MouseEvent event(ui::ET_MOUSE_MOVED, params.location, params.location, 166 MouseEvent event(ui::ET_MOUSE_MOVED, params.location, params.location,
167 params.timestamp, modifiers_.GetModifierFlags(), 167 params.timestamp, modifiers_.GetModifierFlags(),
168 /* changed_button_flags */ 0); 168 /* changed_button_flags */ 0);
169 event.set_source_device_id(params.device_id); 169 event.set_source_device_id(params.device_id);
170 event.set_pointer_details(params.pointer_details);
170 DispatchUiEvent(&event); 171 DispatchUiEvent(&event);
171 } 172 }
172 173
173 void EventFactoryEvdev::DispatchMouseButtonEvent( 174 void EventFactoryEvdev::DispatchMouseButtonEvent(
174 const MouseButtonEventParams& params) { 175 const MouseButtonEventParams& params) {
175 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseButtonEvent", "device", 176 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseButtonEvent", "device",
176 params.device_id); 177 params.device_id);
177 178
178 // Mouse buttons can be remapped, touchpad taps & clicks cannot. 179 // Mouse buttons can be remapped, touchpad taps & clicks cannot.
179 unsigned int button = params.button; 180 unsigned int button = params.button;
(...skipping 29 matching lines...) Expand all
209 // Suppress nested clicks. EventModifiersEvdev counts presses, we only 210 // Suppress nested clicks. EventModifiersEvdev counts presses, we only
210 // dispatch an event on 0-1 (first press) and 1-0 (last release) transitions. 211 // dispatch an event on 0-1 (first press) and 1-0 (last release) transitions.
211 if (down == was_down) 212 if (down == was_down)
212 return; 213 return;
213 214
214 MouseEvent event(params.down ? ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED, 215 MouseEvent event(params.down ? ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED,
215 params.location, params.location, params.timestamp, 216 params.location, params.location, params.timestamp,
216 modifiers_.GetModifierFlags() | flag, 217 modifiers_.GetModifierFlags() | flag,
217 /* changed_button_flags */ flag); 218 /* changed_button_flags */ flag);
218 event.set_source_device_id(params.device_id); 219 event.set_source_device_id(params.device_id);
220 event.set_pointer_details(params.pointer_details);
219 DispatchUiEvent(&event); 221 DispatchUiEvent(&event);
220 } 222 }
221 223
222 void EventFactoryEvdev::DispatchMouseWheelEvent( 224 void EventFactoryEvdev::DispatchMouseWheelEvent(
223 const MouseWheelEventParams& params) { 225 const MouseWheelEventParams& params) {
224 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseWheelEvent", "device", 226 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseWheelEvent", "device",
225 params.device_id); 227 params.device_id);
226 MouseWheelEvent event(params.delta, params.location, params.location, 228 MouseWheelEvent event(params.delta, params.location, params.location,
227 params.timestamp, modifiers_.GetModifierFlags(), 229 params.timestamp, modifiers_.GetModifierFlags(),
228 0 /* changed_button_flags */); 230 0 /* changed_button_flags */);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 348 }
347 349
348 void EventFactoryEvdev::WarpCursorTo(gfx::AcceleratedWidget widget, 350 void EventFactoryEvdev::WarpCursorTo(gfx::AcceleratedWidget widget,
349 const gfx::PointF& location) { 351 const gfx::PointF& location) {
350 if (!cursor_) 352 if (!cursor_)
351 return; 353 return;
352 354
353 cursor_->MoveCursorTo(widget, location); 355 cursor_->MoveCursorTo(widget, location);
354 356
355 base::ThreadTaskRunnerHandle::Get()->PostTask( 357 base::ThreadTaskRunnerHandle::Get()->PostTask(
356 FROM_HERE, base::Bind(&EventFactoryEvdev::DispatchMouseMoveEvent, 358 FROM_HERE,
357 weak_ptr_factory_.GetWeakPtr(), 359 base::Bind(&EventFactoryEvdev::DispatchMouseMoveEvent,
358 MouseMoveEventParams(-1 /* device_id */, 360 weak_ptr_factory_.GetWeakPtr(),
359 cursor_->GetLocation(), 361 MouseMoveEventParams(
360 EventTimeForNow()))); 362 -1 /* device_id */, cursor_->GetLocation(),
363 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE),
364 EventTimeForNow())));
361 } 365 }
362 366
363 int EventFactoryEvdev::NextDeviceId() { 367 int EventFactoryEvdev::NextDeviceId() {
364 return ++last_device_id_; 368 return ++last_device_id_;
365 } 369 }
366 370
367 void EventFactoryEvdev::StartThread() { 371 void EventFactoryEvdev::StartThread() {
368 // Set up device factory. 372 // Set up device factory.
369 scoped_ptr<DeviceEventDispatcherEvdev> proxy_dispatcher( 373 scoped_ptr<DeviceEventDispatcherEvdev> proxy_dispatcher(
370 new ProxyDeviceEventDispatcher(base::ThreadTaskRunnerHandle::Get(), 374 new ProxyDeviceEventDispatcher(base::ThreadTaskRunnerHandle::Get(),
(...skipping 13 matching lines...) Expand all
384 388
385 // Scan & monitor devices. 389 // Scan & monitor devices.
386 device_manager_->AddObserver(this); 390 device_manager_->AddObserver(this);
387 device_manager_->ScanDevices(this); 391 device_manager_->ScanDevices(this);
388 392
389 // Notify device thread that initial scan is done. 393 // Notify device thread that initial scan is done.
390 input_device_factory_proxy_->OnStartupScanComplete(); 394 input_device_factory_proxy_->OnStartupScanComplete();
391 } 395 }
392 396
393 } // namespace ui 397 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_converter_evdev_impl.cc ('k') | ui/events/ozone/evdev/input_injector_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698