| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 if (params.flags & EF_DIRECT_INPUT) { | 212 if (params.flags & EF_DIRECT_INPUT) { |
| 213 details = GetTransformedEventPointerDetails(params); | 213 details = GetTransformedEventPointerDetails(params); |
| 214 cursor_->MoveCursorTo(GetTransformedEventLocation(params)); | 214 cursor_->MoveCursorTo(GetTransformedEventLocation(params)); |
| 215 location = cursor_->GetLocation(); | 215 location = cursor_->GetLocation(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), | 218 MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), |
| 219 params.timestamp, | 219 params.timestamp, |
| 220 modifiers_.GetModifierFlags() | params.flags, | 220 modifiers_.GetModifierFlags() | params.flags, |
| 221 /* changed_button_flags */ 0); | 221 /* changed_button_flags */ 0, |
| 222 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, |
| 223 ui::PointerEvent::kMousePointerId)); |
| 222 event.set_location_f(location); | 224 event.set_location_f(location); |
| 223 event.set_root_location_f(location); | 225 event.set_root_location_f(location); |
| 224 event.set_source_device_id(params.device_id); | 226 event.set_source_device_id(params.device_id); |
| 225 event.set_pointer_details(details); | 227 event.set_pointer_details(details); |
| 226 DispatchUiEvent(&event); | 228 DispatchUiEvent(&event); |
| 227 } | 229 } |
| 228 | 230 |
| 229 void EventFactoryEvdev::DispatchMouseButtonEvent( | 231 void EventFactoryEvdev::DispatchMouseButtonEvent( |
| 230 const MouseButtonEventParams& params) { | 232 const MouseButtonEventParams& params) { |
| 231 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseButtonEvent", "device", | 233 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseButtonEvent", "device", |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 bool down = modifiers_.GetModifierFlags() & flag; | 274 bool down = modifiers_.GetModifierFlags() & flag; |
| 273 | 275 |
| 274 // Suppress nested clicks. EventModifiersEvdev counts presses, we only | 276 // Suppress nested clicks. EventModifiersEvdev counts presses, we only |
| 275 // dispatch an event on 0-1 (first press) and 1-0 (last release) transitions. | 277 // dispatch an event on 0-1 (first press) and 1-0 (last release) transitions. |
| 276 if (down == was_down) | 278 if (down == was_down) |
| 277 return; | 279 return; |
| 278 | 280 |
| 279 MouseEvent event(params.down ? ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED, | 281 MouseEvent event(params.down ? ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED, |
| 280 gfx::Point(), gfx::Point(), params.timestamp, | 282 gfx::Point(), gfx::Point(), params.timestamp, |
| 281 modifiers_.GetModifierFlags() | flag | params.flags, | 283 modifiers_.GetModifierFlags() | flag | params.flags, |
| 282 /* changed_button_flags */ flag); | 284 /* changed_button_flags */ flag, |
| 285 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, |
| 286 ui::PointerEvent::kMousePointerId)); |
| 283 event.set_location_f(location); | 287 event.set_location_f(location); |
| 284 event.set_root_location_f(location); | 288 event.set_root_location_f(location); |
| 285 event.set_source_device_id(params.device_id); | 289 event.set_source_device_id(params.device_id); |
| 286 event.set_pointer_details(details); | 290 event.set_pointer_details(details); |
| 287 DispatchUiEvent(&event); | 291 DispatchUiEvent(&event); |
| 288 } | 292 } |
| 289 | 293 |
| 290 void EventFactoryEvdev::DispatchMouseWheelEvent( | 294 void EventFactoryEvdev::DispatchMouseWheelEvent( |
| 291 const MouseWheelEventParams& params) { | 295 const MouseWheelEventParams& params) { |
| 292 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseWheelEvent", "device", | 296 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseWheelEvent", "device", |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 472 |
| 469 // Scan & monitor devices. | 473 // Scan & monitor devices. |
| 470 device_manager_->AddObserver(this); | 474 device_manager_->AddObserver(this); |
| 471 device_manager_->ScanDevices(this); | 475 device_manager_->ScanDevices(this); |
| 472 | 476 |
| 473 // Notify device thread that initial scan is done. | 477 // Notify device thread that initial scan is done. |
| 474 input_device_factory_proxy_->OnStartupScanComplete(); | 478 input_device_factory_proxy_->OnStartupScanComplete(); |
| 475 } | 479 } |
| 476 | 480 |
| 477 } // namespace ui | 481 } // namespace ui |
| OLD | NEW |