| OLD | NEW |
| 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 #ifndef UI_EVENTS_EVENT_UTILS_H_ | 5 #ifndef UI_EVENTS_EVENT_UTILS_H_ |
| 6 #define UI_EVENTS_EVENT_UTILS_H_ | 6 #define UI_EVENTS_EVENT_UTILS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 // Returns a copy of |native_event|. Depending on the platform, this copy may | 109 // Returns a copy of |native_event|. Depending on the platform, this copy may |
| 110 // need to be deleted with ReleaseCopiedNativeEvent(). | 110 // need to be deleted with ReleaseCopiedNativeEvent(). |
| 111 base::NativeEvent CopyNativeEvent( | 111 base::NativeEvent CopyNativeEvent( |
| 112 const base::NativeEvent& native_event); | 112 const base::NativeEvent& native_event); |
| 113 | 113 |
| 114 // Delete a |native_event| previously created by CopyNativeEvent(). | 114 // Delete a |native_event| previously created by CopyNativeEvent(). |
| 115 void ReleaseCopiedNativeEvent( | 115 void ReleaseCopiedNativeEvent( |
| 116 const base::NativeEvent& native_event); | 116 const base::NativeEvent& native_event); |
| 117 | 117 |
| 118 // Returns the detailed pointer information for touch events. |
| 119 EVENTS_EXPORT PointerDetails |
| 120 GetTouchPointerDetailsFromNative(const base::NativeEvent& native_event); |
| 121 |
| 118 // Gets the touch id from a native event. | 122 // Gets the touch id from a native event. |
| 119 EVENTS_EXPORT int GetTouchId(const base::NativeEvent& native_event); | 123 EVENTS_EXPORT int GetTouchId(const base::NativeEvent& native_event); |
| 120 | 124 |
| 121 // Clear the touch id from bookkeeping if it is a release/cancel event. | 125 // Clear the touch id from bookkeeping if it is a release/cancel event. |
| 122 EVENTS_EXPORT void ClearTouchIdIfReleased( | 126 EVENTS_EXPORT void ClearTouchIdIfReleased( |
| 123 const base::NativeEvent& native_event); | 127 const base::NativeEvent& native_event); |
| 124 | 128 |
| 125 // Gets the radius along the X/Y axis from a native event. Default is 1.0. | |
| 126 EVENTS_EXPORT float GetTouchRadiusX(const base::NativeEvent& native_event); | |
| 127 EVENTS_EXPORT float GetTouchRadiusY(const base::NativeEvent& native_event); | |
| 128 | |
| 129 // Gets the angle of the major axis away from the X axis. Default is 0.0. | 129 // Gets the angle of the major axis away from the X axis. Default is 0.0. |
| 130 EVENTS_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); | 130 EVENTS_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); |
| 131 | 131 |
| 132 // Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0. | |
| 133 EVENTS_EXPORT float GetTouchForce(const base::NativeEvent& native_event); | |
| 134 | |
| 135 // Gets the fling velocity from a native event. is_cancel is set to true if | 132 // Gets the fling velocity from a native event. is_cancel is set to true if |
| 136 // this was a tap down, intended to stop an ongoing fling. | 133 // this was a tap down, intended to stop an ongoing fling. |
| 137 EVENTS_EXPORT bool GetFlingData(const base::NativeEvent& native_event, | 134 EVENTS_EXPORT bool GetFlingData(const base::NativeEvent& native_event, |
| 138 float* vx, | 135 float* vx, |
| 139 float* vy, | 136 float* vy, |
| 140 float* vx_ordinal, | 137 float* vx_ordinal, |
| 141 float* vy_ordinal, | 138 float* vy_ordinal, |
| 142 bool* is_cancel); | 139 bool* is_cancel); |
| 143 | 140 |
| 144 // Returns whether this is a scroll event and optionally gets the amount to be | 141 // Returns whether this is a scroll event and optionally gets the amount to be |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Update the native X11 event to correspond to the new button flags. | 173 // Update the native X11 event to correspond to the new button flags. |
| 177 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event); | 174 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event); |
| 178 #endif | 175 #endif |
| 179 | 176 |
| 180 // Registers a custom event type. | 177 // Registers a custom event type. |
| 181 EVENTS_EXPORT int RegisterCustomEventType(); | 178 EVENTS_EXPORT int RegisterCustomEventType(); |
| 182 | 179 |
| 183 } // namespace ui | 180 } // namespace ui |
| 184 | 181 |
| 185 #endif // UI_EVENTS_EVENT_UTILS_H_ | 182 #endif // UI_EVENTS_EVENT_UTILS_H_ |
| OLD | NEW |