| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mojo/event_struct_traits.h" | 5 #include "ui/events/mojo/event_struct_traits.h" |
| 6 | 6 |
| 7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
| 8 #include "ui/events/event_utils.h" | 8 #include "ui/events/event_utils.h" |
| 9 #include "ui/events/keycodes/dom/keycode_converter.h" | 9 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 10 #include "ui/events/mojo/event_constants.mojom.h" | 10 #include "ui/events/mojo/event_constants.mojom.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 const gfx::Point location(pointer_data->location->x, | 276 const gfx::Point location(pointer_data->location->x, |
| 277 pointer_data->location->y); | 277 pointer_data->location->y); |
| 278 const gfx::Point screen_location(pointer_data->location->screen_x, | 278 const gfx::Point screen_location(pointer_data->location->screen_x, |
| 279 pointer_data->location->screen_y); | 279 pointer_data->location->screen_y); |
| 280 | 280 |
| 281 switch (pointer_data->kind) { | 281 switch (pointer_data->kind) { |
| 282 case ui::mojom::PointerKind::MOUSE: { | 282 case ui::mojom::PointerKind::MOUSE: { |
| 283 out->reset(new ui::PointerEvent( | 283 out->reset(new ui::PointerEvent( |
| 284 MojoPointerEventTypeToUIEvent(event.action()), location, | 284 MojoPointerEventTypeToUIEvent(event.action()), location, |
| 285 screen_location, event.flags(), ui::PointerEvent::kMousePointerId, | 285 screen_location, event.flags(), |
| 286 pointer_data->changed_button_flags, | 286 pointer_data->changed_button_flags, |
| 287 event.action() == ui::mojom::EventType::POINTER_WHEEL_CHANGED | 287 event.action() == ui::mojom::EventType::POINTER_WHEEL_CHANGED |
| 288 ? ui::PointerDetails( | 288 ? ui::PointerDetails( |
| 289 ui::EventPointerType::POINTER_TYPE_MOUSE, | 289 ui::EventPointerType::POINTER_TYPE_MOUSE, |
| 290 gfx::Vector2d( | 290 gfx::Vector2d( |
| 291 static_cast<int>(pointer_data->wheel_data->delta_x), | 291 static_cast<int>(pointer_data->wheel_data->delta_x), |
| 292 static_cast<int>( | 292 static_cast<int>( |
| 293 pointer_data->wheel_data->delta_y))) | 293 pointer_data->wheel_data->delta_y)), |
| 294 : ui::PointerDetails( | 294 ui::PointerEvent::kMousePointerId) |
| 295 ui::EventPointerType::POINTER_TYPE_MOUSE), | 295 : ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, |
| 296 ui::PointerEvent::kMousePointerId), |
| 296 ui::EventTimeForNow())); | 297 ui::EventTimeForNow())); |
| 297 break; | 298 break; |
| 298 } | 299 } |
| 299 case ui::mojom::PointerKind::TOUCH: { | 300 case ui::mojom::PointerKind::TOUCH: { |
| 300 out->reset(new ui::PointerEvent( | 301 out->reset(new ui::PointerEvent( |
| 301 MojoPointerEventTypeToUIEvent(event.action()), location, | 302 MojoPointerEventTypeToUIEvent(event.action()), location, |
| 302 screen_location, event.flags(), pointer_data->pointer_id, | 303 screen_location, event.flags(), |
| 303 pointer_data->changed_button_flags, | 304 pointer_data->changed_button_flags, |
| 304 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, | 305 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, |
| 305 /* pointer_id*/ 0, | 306 /* pointer_id*/ pointer_data->pointer_id, |
| 306 pointer_data->brush_data->width, | 307 pointer_data->brush_data->width, |
| 307 pointer_data->brush_data->height, | 308 pointer_data->brush_data->height, |
| 308 pointer_data->brush_data->pressure, | 309 pointer_data->brush_data->pressure, |
| 309 pointer_data->brush_data->tilt_x, | 310 pointer_data->brush_data->tilt_x, |
| 310 pointer_data->brush_data->tilt_y), | 311 pointer_data->brush_data->tilt_y), |
| 311 ui::EventTimeForNow())); | 312 ui::EventTimeForNow())); |
| 312 break; | 313 break; |
| 313 } | 314 } |
| 314 case ui::mojom::PointerKind::PEN: | 315 case ui::mojom::PointerKind::PEN: |
| 315 NOTIMPLEMENTED(); | 316 NOTIMPLEMENTED(); |
| 316 return false; | 317 return false; |
| 317 } | 318 } |
| 318 break; | 319 break; |
| 319 } | 320 } |
| 320 case ui::mojom::EventType::UNKNOWN: | 321 case ui::mojom::EventType::UNKNOWN: |
| 321 return false; | 322 return false; |
| 322 } | 323 } |
| 323 | 324 |
| 324 if (!out->get()) | 325 if (!out->get()) |
| 325 return false; | 326 return false; |
| 326 | 327 |
| 327 return event.ReadLatency((*out)->latency()); | 328 return event.ReadLatency((*out)->latency()); |
| 328 } | 329 } |
| 329 | 330 |
| 330 } // namespace mojo | 331 } // namespace mojo |
| OLD | NEW |