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

Side by Side Diff: ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc

Issue 2173603002: Filter GestureFlingStarts with Vx=Vy=0 in RenderWidgetHostViewChildFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/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
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);
342 EventType type = 336 EventType type =
343 (should_fling_start ? ET_SCROLL_FLING_START : ET_SCROLL_FLING_CANCEL); 337 (fling->fling_state == GESTURES_FLING_START ? ET_SCROLL_FLING_START
338 : ET_SCROLL_FLING_CANCEL);
344 339
345 // Fling is like 2-finger scrolling but with velocity instead of displacement. 340 // Fling is like 2-finger scrolling but with
341 // velocity instead of displacement.
wjmaclean 2016/07/22 00:42:01 I'll undo this unintended re-formatting before lan
346 dispatcher_->DispatchScrollEvent(ScrollEventParams( 342 dispatcher_->DispatchScrollEvent(ScrollEventParams(
347 id_, type, cursor_->GetLocation(), gfx::Vector2dF(fling->vx, fling->vy), 343 id_, type, cursor_->GetLocation(), gfx::Vector2dF(fling->vx, fling->vy),
348 gfx::Vector2dF(fling->ordinal_vx, fling->ordinal_vy), 344 gfx::Vector2dF(fling->ordinal_vx, fling->ordinal_vy),
349 kGestureScrollFingerCount, StimeToTimeTicks(gesture->end_time))); 345 kGestureScrollFingerCount, StimeToTimeTicks(gesture->end_time)));
350 } 346 }
351 347
352 void GestureInterpreterLibevdevCros::OnGestureSwipe(const Gesture* gesture, 348 void GestureInterpreterLibevdevCros::OnGestureSwipe(const Gesture* gesture,
353 const GestureSwipe* swipe) { 349 const GestureSwipe* swipe) {
354 DVLOG(3) << base::StringPrintf("Gesture Swipe: (%f, %f) [%f, %f]", 350 DVLOG(3) << base::StringPrintf("Gesture Swipe: (%f, %f) [%f, %f]",
355 swipe->dx, 351 swipe->dx,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 506
511 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) { 507 void GestureInterpreterLibevdevCros::ReleaseMouseButtons(stime_t timestamp) {
512 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp); 508 DispatchMouseButton(BTN_LEFT, false /* down */, timestamp);
513 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp); 509 DispatchMouseButton(BTN_MIDDLE, false /* down */, timestamp);
514 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp); 510 DispatchMouseButton(BTN_RIGHT, false /* down */, timestamp);
515 DispatchMouseButton(BTN_BACK, false /* down */, timestamp); 511 DispatchMouseButton(BTN_BACK, false /* down */, timestamp);
516 DispatchMouseButton(BTN_FORWARD, false /* down */, timestamp); 512 DispatchMouseButton(BTN_FORWARD, false /* down */, timestamp);
517 } 513 }
518 514
519 } // namespace ui 515 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698