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

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

Issue 755403006: Added experimental Touch.tilt, Touch.tiltDirection support for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused code (event_sender.cc) Created 5 years, 9 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
« no previous file with comments | « ui/events/event.h ('k') | ui/events/event_utils.h » ('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/keysym.h> 9 #include <X11/keysym.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 // TouchEvent 525 // TouchEvent
526 526
527 TouchEvent::TouchEvent(const base::NativeEvent& native_event) 527 TouchEvent::TouchEvent(const base::NativeEvent& native_event)
528 : LocatedEvent(native_event), 528 : LocatedEvent(native_event),
529 touch_id_(GetTouchId(native_event)), 529 touch_id_(GetTouchId(native_event)),
530 unique_event_id_(get_next_touch_event_id()), 530 unique_event_id_(get_next_touch_event_id()),
531 radius_x_(GetTouchRadiusX(native_event)), 531 radius_x_(GetTouchRadiusX(native_event)),
532 radius_y_(GetTouchRadiusY(native_event)), 532 radius_y_(GetTouchRadiusY(native_event)),
533 rotation_angle_(GetTouchAngle(native_event)), 533 rotation_angle_(GetTouchAngle(native_event)),
534 force_(GetTouchForce(native_event)), 534 force_(GetTouchForce(native_event)),
535 tilt_(GetTouchTilt(native_event)),
536 tiltDirection_(GetTouchTiltDirection(native_event)),
535 may_cause_scrolling_(false), 537 may_cause_scrolling_(false),
536 should_remove_native_touch_id_mapping_(false) { 538 should_remove_native_touch_id_mapping_(false) {
537 latency()->AddLatencyNumberWithTimestamp( 539 latency()->AddLatencyNumberWithTimestamp(
538 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, 540 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0,
539 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); 541 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1);
540 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 542 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
541 543
542 FixRotationAngle(); 544 FixRotationAngle();
543 if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED) 545 if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED)
544 should_remove_native_touch_id_mapping_ = true; 546 should_remove_native_touch_id_mapping_ = true;
545 } 547 }
546 548
547 TouchEvent::TouchEvent(EventType type, 549 TouchEvent::TouchEvent(EventType type,
548 const gfx::PointF& location, 550 const gfx::PointF& location,
549 int touch_id, 551 int touch_id,
550 base::TimeDelta time_stamp) 552 base::TimeDelta time_stamp)
551 : LocatedEvent(type, location, location, time_stamp, 0), 553 : LocatedEvent(type, location, location, time_stamp, 0),
552 touch_id_(touch_id), 554 touch_id_(touch_id),
553 unique_event_id_(get_next_touch_event_id()), 555 unique_event_id_(get_next_touch_event_id()),
554 radius_x_(0.0f), 556 radius_x_(0.0f),
555 radius_y_(0.0f), 557 radius_y_(0.0f),
556 rotation_angle_(0.0f), 558 rotation_angle_(0.0f),
557 force_(0.0f), 559 force_(0.0f),
560 tilt_(std::numeric_limits<float>::quiet_NaN()),
561 tiltDirection_(std::numeric_limits<float>::quiet_NaN()),
558 may_cause_scrolling_(false), 562 may_cause_scrolling_(false),
559 should_remove_native_touch_id_mapping_(false) { 563 should_remove_native_touch_id_mapping_(false) {
560 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 564 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
561 } 565 }
562 566
563 TouchEvent::TouchEvent(EventType type, 567 TouchEvent::TouchEvent(EventType type,
564 const gfx::PointF& location, 568 const gfx::PointF& location,
565 int flags, 569 int flags,
566 int touch_id, 570 int touch_id,
567 base::TimeDelta time_stamp, 571 base::TimeDelta time_stamp,
568 float radius_x, 572 float radius_x,
569 float radius_y, 573 float radius_y,
570 float angle, 574 float angle,
571 float force) 575 float force,
576 float tilt,
577 float tiltDirection)
572 : LocatedEvent(type, location, location, time_stamp, flags), 578 : LocatedEvent(type, location, location, time_stamp, flags),
573 touch_id_(touch_id), 579 touch_id_(touch_id),
574 unique_event_id_(get_next_touch_event_id()), 580 unique_event_id_(get_next_touch_event_id()),
575 radius_x_(radius_x), 581 radius_x_(radius_x),
576 radius_y_(radius_y), 582 radius_y_(radius_y),
577 rotation_angle_(angle), 583 rotation_angle_(angle),
578 force_(force), 584 force_(force),
585 tilt_(tilt),
586 tiltDirection_(tiltDirection),
579 may_cause_scrolling_(false), 587 may_cause_scrolling_(false),
580 should_remove_native_touch_id_mapping_(false) { 588 should_remove_native_touch_id_mapping_(false) {
581 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 589 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
582 FixRotationAngle(); 590 FixRotationAngle();
583 } 591 }
584 592
585 TouchEvent::~TouchEvent() { 593 TouchEvent::~TouchEvent() {
586 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 594 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11
587 // platform setups the tracking_id to slot mapping. So in dtor here, 595 // platform setups the tracking_id to slot mapping. So in dtor here,
588 // if this touch event is a release event, we clear the mapping accordingly. 596 // if this touch event is a release event, we clear the mapping accordingly.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 gfx::PointF(x, y), 989 gfx::PointF(x, y),
982 time_stamp, 990 time_stamp,
983 flags | EF_FROM_TOUCH), 991 flags | EF_FROM_TOUCH),
984 details_(details) { 992 details_(details) {
985 } 993 }
986 994
987 GestureEvent::~GestureEvent() { 995 GestureEvent::~GestureEvent() {
988 } 996 }
989 997
990 } // namespace ui 998 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event.h ('k') | ui/events/event_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698