| 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/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" |
| 6 | 6 |
| 7 #include <gestures/gestures.h> | 7 #include <gestures/gestures.h> |
| 8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
| 9 #include <linux/input.h> | 9 #include <linux/input.h> |
| 10 | 10 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 "Gesture Fling: (%f, %f) [%f, %f] fling_state=%d", | 326 "Gesture Fling: (%f, %f) [%f, %f] fling_state=%d", |
| 327 fling->vx, | 327 fling->vx, |
| 328 fling->vy, | 328 fling->vy, |
| 329 fling->ordinal_vx, | 329 fling->ordinal_vx, |
| 330 fling->ordinal_vy, | 330 fling->ordinal_vy, |
| 331 fling->fling_state); | 331 fling->fling_state); |
| 332 | 332 |
| 333 if (!cursor_) | 333 if (!cursor_) |
| 334 return; // No cursor! | 334 return; // No cursor! |
| 335 | 335 |
| 336 // We may receive a request for a GESTURE_FLING_START with zero velocity; in |
| 337 // this case send a ET_SCROLL_FLING_CANCEL in case it's needed to stop a |
| 338 // fling in progress. |
| 339 // TODO(wjmaclean): is it possible to get consecutive GESTURE_FLING_STARTs? |
| 340 bool should_fling_start = fling->fling_state == GESTURES_FLING_START && |
| 341 (fling->vx != 0 || fling->vy != 0); |
| 336 EventType type = | 342 EventType type = |
| 337 (fling->fling_state == GESTURES_FLING_START ? ET_SCROLL_FLING_START | 343 (should_fling_start ? ET_SCROLL_FLING_START : ET_SCROLL_FLING_CANCEL); |
| 338 : ET_SCROLL_FLING_CANCEL); | |
| 339 | 344 |
| 340 // Fling is like 2-finger scrolling but with velocity instead of displacement. | 345 // Fling is like 2-finger scrolling but with velocity instead of displacement. |
| 341 dispatcher_->DispatchScrollEvent(ScrollEventParams( | 346 dispatcher_->DispatchScrollEvent(ScrollEventParams( |
| 342 id_, type, cursor_->GetLocation(), gfx::Vector2dF(fling->vx, fling->vy), | 347 id_, type, cursor_->GetLocation(), gfx::Vector2dF(fling->vx, fling->vy), |
| 343 gfx::Vector2dF(fling->ordinal_vx, fling->ordinal_vy), | 348 gfx::Vector2dF(fling->ordinal_vx, fling->ordinal_vy), |
| 344 kGestureScrollFingerCount, StimeToTimeTicks(gesture->end_time))); | 349 kGestureScrollFingerCount, StimeToTimeTicks(gesture->end_time))); |
| 345 } | 350 } |
| 346 | 351 |
| 347 void GestureInterpreterLibevdevCros::OnGestureSwipe(const Gesture* gesture, | 352 void GestureInterpreterLibevdevCros::OnGestureSwipe(const Gesture* gesture, |
| 348 const GestureSwipe* swipe) { | 353 const GestureSwipe* swipe) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 510 |
| 506 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) { | 511 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) { |
| 507 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp); | 512 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp); |
| 508 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp); | 513 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp); |
| 509 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp); | 514 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp); |
| 510 DispatchMouseButton(BTN_BACK, false /* down */, timestamp); | 515 DispatchMouseButton(BTN_BACK, false /* down */, timestamp); |
| 511 DispatchMouseButton(BTN_FORWARD, false /* down */, timestamp); | 516 DispatchMouseButton(BTN_FORWARD, false /* down */, timestamp); |
| 512 } | 517 } |
| 513 | 518 |
| 514 } // namespace ui | 519 } // namespace ui |
| OLD | NEW |