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

Side by Side Diff: ui/events/event.cc

Issue 718153002: Indicate whether a touch event will cause scrolling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « ui/events/event.h ('k') | ui/events/events.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/event.h" 5 #include "ui/events/event.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #include <X11/keysym.h> 10 #include <X11/keysym.h>
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 508
509 //////////////////////////////////////////////////////////////////////////////// 509 ////////////////////////////////////////////////////////////////////////////////
510 // TouchEvent 510 // TouchEvent
511 511
512 TouchEvent::TouchEvent(const base::NativeEvent& native_event) 512 TouchEvent::TouchEvent(const base::NativeEvent& native_event)
513 : LocatedEvent(native_event), 513 : LocatedEvent(native_event),
514 touch_id_(GetTouchId(native_event)), 514 touch_id_(GetTouchId(native_event)),
515 radius_x_(GetTouchRadiusX(native_event)), 515 radius_x_(GetTouchRadiusX(native_event)),
516 radius_y_(GetTouchRadiusY(native_event)), 516 radius_y_(GetTouchRadiusY(native_event)),
517 rotation_angle_(GetTouchAngle(native_event)), 517 rotation_angle_(GetTouchAngle(native_event)),
518 force_(GetTouchForce(native_event)) { 518 force_(GetTouchForce(native_event)),
519 causes_scrolling_(false) {
519 latency()->AddLatencyNumberWithTimestamp( 520 latency()->AddLatencyNumberWithTimestamp(
520 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 521 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
521 0, 522 0,
522 0, 523 0,
523 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 524 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()),
524 1); 525 1);
525 526
526 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 527 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
527 528
528 if (type() == ET_TOUCH_PRESSED) 529 if (type() == ET_TOUCH_PRESSED)
529 IncrementTouchIdRefCount(native_event); 530 IncrementTouchIdRefCount(native_event);
530 } 531 }
531 532
532 TouchEvent::TouchEvent(EventType type, 533 TouchEvent::TouchEvent(EventType type,
533 const gfx::PointF& location, 534 const gfx::PointF& location,
534 int touch_id, 535 int touch_id,
535 base::TimeDelta time_stamp) 536 base::TimeDelta time_stamp)
536 : LocatedEvent(type, location, location, time_stamp, 0), 537 : LocatedEvent(type, location, location, time_stamp, 0),
537 touch_id_(touch_id), 538 touch_id_(touch_id),
538 radius_x_(0.0f), 539 radius_x_(0.0f),
539 radius_y_(0.0f), 540 radius_y_(0.0f),
540 rotation_angle_(0.0f), 541 rotation_angle_(0.0f),
541 force_(0.0f) { 542 force_(0.0f),
543 causes_scrolling_(false) {
542 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 544 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
543 } 545 }
544 546
545 TouchEvent::TouchEvent(EventType type, 547 TouchEvent::TouchEvent(EventType type,
546 const gfx::PointF& location, 548 const gfx::PointF& location,
547 int flags, 549 int flags,
548 int touch_id, 550 int touch_id,
549 base::TimeDelta time_stamp, 551 base::TimeDelta time_stamp,
550 float radius_x, 552 float radius_x,
551 float radius_y, 553 float radius_y,
552 float angle, 554 float angle,
553 float force) 555 float force)
554 : LocatedEvent(type, location, location, time_stamp, flags), 556 : LocatedEvent(type, location, location, time_stamp, flags),
555 touch_id_(touch_id), 557 touch_id_(touch_id),
556 radius_x_(radius_x), 558 radius_x_(radius_x),
557 radius_y_(radius_y), 559 radius_y_(radius_y),
558 rotation_angle_(angle), 560 rotation_angle_(angle),
559 force_(force) { 561 force_(force),
562 causes_scrolling_(false) {
560 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 563 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
561 } 564 }
562 565
563 TouchEvent::~TouchEvent() { 566 TouchEvent::~TouchEvent() {
564 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 567 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11
565 // platform setups the tracking_id to slot mapping. So in dtor here, 568 // platform setups the tracking_id to slot mapping. So in dtor here,
566 // if this touch event is a release event, we clear the mapping accordingly. 569 // if this touch event is a release event, we clear the mapping accordingly.
567 if (HasNativeEvent()) 570 if (HasNativeEvent())
568 ClearTouchIdIfReleased(native_event()); 571 ClearTouchIdIfReleased(native_event());
569 } 572 }
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 gfx::PointF(x, y), 973 gfx::PointF(x, y),
971 time_stamp, 974 time_stamp,
972 flags | EF_FROM_TOUCH), 975 flags | EF_FROM_TOUCH),
973 details_(details) { 976 details_(details) {
974 } 977 }
975 978
976 GestureEvent::~GestureEvent() { 979 GestureEvent::~GestureEvent() {
977 } 980 }
978 981
979 } // namespace ui 982 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event.h ('k') | ui/events/events.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698