| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "ui/events/event_constants.h" | 6 #include "ui/events/event_constants.h" |
| 7 #include "ui/events/event_utils.h" | 7 #include "ui/events/event_utils.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { | 89 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { |
| 90 } | 90 } |
| 91 | 91 |
| 92 int GetTouchId(const base::NativeEvent& native_event) { | 92 int GetTouchId(const base::NativeEvent& native_event) { |
| 93 const ui::TouchEvent* event = | 93 const ui::TouchEvent* event = |
| 94 static_cast<const ui::TouchEvent*>(native_event); | 94 static_cast<const ui::TouchEvent*>(native_event); |
| 95 DCHECK(event->IsTouchEvent()); | 95 DCHECK(event->IsTouchEvent()); |
| 96 return event->touch_id(); | 96 return event->touch_id(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 float GetTouchRadiusX(const base::NativeEvent& native_event) { | 99 PointerDetails GetTouchPointerDetailsFromNative( |
| 100 const base::NativeEvent& native_event) { |
| 100 const ui::TouchEvent* event = | 101 const ui::TouchEvent* event = |
| 101 static_cast<const ui::TouchEvent*>(native_event); | 102 static_cast<const ui::TouchEvent*>(native_event); |
| 102 DCHECK(event->IsTouchEvent()); | 103 DCHECK(event->IsTouchEvent()); |
| 103 return event->pointer_details().radius_x(); | 104 return event->pointer_details(); |
| 104 } | |
| 105 | |
| 106 float GetTouchRadiusY(const base::NativeEvent& native_event) { | |
| 107 const ui::TouchEvent* event = | |
| 108 static_cast<const ui::TouchEvent*>(native_event); | |
| 109 DCHECK(event->IsTouchEvent()); | |
| 110 return event->pointer_details().radius_y(); | |
| 111 } | 105 } |
| 112 | 106 |
| 113 float GetTouchAngle(const base::NativeEvent& native_event) { | 107 float GetTouchAngle(const base::NativeEvent& native_event) { |
| 114 const ui::TouchEvent* event = | 108 const ui::TouchEvent* event = |
| 115 static_cast<const ui::TouchEvent*>(native_event); | 109 static_cast<const ui::TouchEvent*>(native_event); |
| 116 DCHECK(event->IsTouchEvent()); | 110 DCHECK(event->IsTouchEvent()); |
| 117 return event->rotation_angle(); | 111 return event->rotation_angle(); |
| 118 } | 112 } |
| 119 | 113 |
| 120 float GetTouchForce(const base::NativeEvent& native_event) { | |
| 121 const ui::TouchEvent* event = | |
| 122 static_cast<const ui::TouchEvent*>(native_event); | |
| 123 DCHECK(event->IsTouchEvent()); | |
| 124 return event->pointer_details().force(); | |
| 125 } | |
| 126 | |
| 127 bool GetScrollOffsets(const base::NativeEvent& native_event, | 114 bool GetScrollOffsets(const base::NativeEvent& native_event, |
| 128 float* x_offset, | 115 float* x_offset, |
| 129 float* y_offset, | 116 float* y_offset, |
| 130 float* x_offset_ordinal, | 117 float* x_offset_ordinal, |
| 131 float* y_offset_ordinal, | 118 float* y_offset_ordinal, |
| 132 int* finger_count) { | 119 int* finger_count) { |
| 133 const ui::ScrollEvent* event = | 120 const ui::ScrollEvent* event = |
| 134 static_cast<const ui::ScrollEvent*>(native_event); | 121 static_cast<const ui::ScrollEvent*>(native_event); |
| 135 DCHECK(event->IsScrollEvent()); | 122 DCHECK(event->IsScrollEvent()); |
| 136 if (x_offset) | 123 if (x_offset) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 164 *vx_ordinal = event->x_offset_ordinal(); | 151 *vx_ordinal = event->x_offset_ordinal(); |
| 165 if (vy_ordinal) | 152 if (vy_ordinal) |
| 166 *vy_ordinal = event->y_offset_ordinal(); | 153 *vy_ordinal = event->y_offset_ordinal(); |
| 167 if (is_cancel) | 154 if (is_cancel) |
| 168 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL; | 155 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL; |
| 169 | 156 |
| 170 return true; | 157 return true; |
| 171 } | 158 } |
| 172 | 159 |
| 173 } // namespace ui | 160 } // namespace ui |
| OLD | NEW |