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 "base/event_types.h" | 8 #include "base/event_types.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/events/event_constants.h" | 10 #include "ui/events/event_constants.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Returns the DOM KeyboardEvent code (physical location in the | 80 // Returns the DOM KeyboardEvent code (physical location in the |
81 // keyboard) from a native event. The ownership of the return value | 81 // keyboard) from a native event. The ownership of the return value |
82 // is NOT trasferred to the caller. | 82 // is NOT trasferred to the caller. |
83 EVENTS_EXPORT const char* CodeFromNative( | 83 EVENTS_EXPORT const char* CodeFromNative( |
84 const base::NativeEvent& native_event); | 84 const base::NativeEvent& native_event); |
85 | 85 |
86 // Returns the platform related key code. For X11, it is xksym value. | 86 // Returns the platform related key code. For X11, it is xksym value. |
87 EVENTS_EXPORT uint32 PlatformKeycodeFromNative( | 87 EVENTS_EXPORT uint32 PlatformKeycodeFromNative( |
88 const base::NativeEvent& native_event); | 88 const base::NativeEvent& native_event); |
89 | 89 |
| 90 // Returns the windows key code. Note that this value is different from |
| 91 // KeyboardCodeFromNative (there is a divergence between ui::KeyboardCode and |
| 92 // windows key codes). |
| 93 EVENTS_EXPORT uint32 WindowsKeycodeFromNative( |
| 94 const base::NativeEvent& native_event); |
| 95 |
| 96 // Returns the text generated by this keystroke. Used in the value we pass to |
| 97 // blink. |
| 98 EVENTS_EXPORT uint16 TextFromNative(const base::NativeEvent& native_event); |
| 99 |
| 100 // Returns the unmodified text generated by this keystroke. Used in the value |
| 101 // we pass to blink. |
| 102 EVENTS_EXPORT uint16 UnmodifiedTextFromNative( |
| 103 const base::NativeEvent& native_event); |
| 104 |
| 105 #if defined(OS_LINUX) |
| 106 // Returns a control character sequences from a |windows_key_code|. |
| 107 EVENTS_EXPORT uint16 GetControlCharacterForKeycode(int windows_key_code, |
| 108 bool shift); |
| 109 #endif |
| 110 |
90 // Returns true if the keyboard event is a character event rather than | 111 // Returns true if the keyboard event is a character event rather than |
91 // a keystroke event. | 112 // a keystroke event. |
92 EVENTS_EXPORT bool IsCharFromNative(const base::NativeEvent& native_event); | 113 EVENTS_EXPORT bool IsCharFromNative(const base::NativeEvent& native_event); |
93 | 114 |
94 // Returns the flags of the button that changed during a press/release. | 115 // Returns the flags of the button that changed during a press/release. |
95 EVENTS_EXPORT int GetChangedMouseButtonFlagsFromNative( | 116 EVENTS_EXPORT int GetChangedMouseButtonFlagsFromNative( |
96 const base::NativeEvent& native_event); | 117 const base::NativeEvent& native_event); |
97 | 118 |
98 // Gets the mouse wheel offsets from a native event. | 119 // Gets the mouse wheel offsets from a native event. |
99 EVENTS_EXPORT gfx::Vector2d GetMouseWheelOffset( | 120 EVENTS_EXPORT gfx::Vector2d GetMouseWheelOffset( |
(...skipping 26 matching lines...) Expand all Loading... |
126 | 147 |
127 // Gets the angle of the major axis away from the X axis. Default is 0.0. | 148 // Gets the angle of the major axis away from the X axis. Default is 0.0. |
128 EVENTS_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); | 149 EVENTS_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); |
129 | 150 |
130 // Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0. | 151 // Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0. |
131 EVENTS_EXPORT float GetTouchForce(const base::NativeEvent& native_event); | 152 EVENTS_EXPORT float GetTouchForce(const base::NativeEvent& native_event); |
132 | 153 |
133 // Gets the fling velocity from a native event. is_cancel is set to true if | 154 // Gets the fling velocity from a native event. is_cancel is set to true if |
134 // this was a tap down, intended to stop an ongoing fling. | 155 // this was a tap down, intended to stop an ongoing fling. |
135 EVENTS_EXPORT bool GetFlingData(const base::NativeEvent& native_event, | 156 EVENTS_EXPORT bool GetFlingData(const base::NativeEvent& native_event, |
136 float* vx, | 157 float* vx, |
137 float* vy, | 158 float* vy, |
138 float* vx_ordinal, | 159 float* vx_ordinal, |
139 float* vy_ordinal, | 160 float* vy_ordinal, |
140 bool* is_cancel); | 161 bool* is_cancel); |
141 | 162 |
142 // Returns whether this is a scroll event and optionally gets the amount to be | 163 // Returns whether this is a scroll event and optionally gets the amount to be |
143 // scrolled. |x_offset|, |y_offset| and |finger_count| can be NULL. | 164 // scrolled. |x_offset|, |y_offset| and |finger_count| can be NULL. |
144 EVENTS_EXPORT bool GetScrollOffsets(const base::NativeEvent& native_event, | 165 EVENTS_EXPORT bool GetScrollOffsets(const base::NativeEvent& native_event, |
145 float* x_offset, | 166 float* x_offset, |
146 float* y_offset, | 167 float* y_offset, |
147 float* x_offset_ordinal, | 168 float* x_offset_ordinal, |
148 float* y_offset_ordinal, | 169 float* y_offset_ordinal, |
149 int* finger_count); | 170 int* finger_count); |
150 | 171 |
151 // Returns whether natural scrolling should be used for touchpad. | 172 // Returns whether natural scrolling should be used for touchpad. |
152 EVENTS_EXPORT bool ShouldDefaultToNaturalScroll(); | 173 EVENTS_EXPORT bool ShouldDefaultToNaturalScroll(); |
153 | 174 |
154 // Returns whether or not the internal display produces touch events. | 175 // Returns whether or not the internal display produces touch events. |
155 EVENTS_EXPORT gfx::Display::TouchSupport GetInternalDisplayTouchSupport(); | 176 EVENTS_EXPORT gfx::Display::TouchSupport GetInternalDisplayTouchSupport(); |
156 | 177 |
157 #if defined(OS_WIN) | 178 #if defined(OS_WIN) |
158 EVENTS_EXPORT int GetModifiersFromACCEL(const ACCEL& accel); | 179 EVENTS_EXPORT int GetModifiersFromACCEL(const ACCEL& accel); |
159 EVENTS_EXPORT int GetModifiersFromKeyState(); | 180 EVENTS_EXPORT int GetModifiersFromKeyState(); |
(...skipping 15 matching lines...) Expand all Loading... |
175 // Update the native X11 event to correspond to the new button flags. | 196 // Update the native X11 event to correspond to the new button flags. |
176 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event); | 197 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event); |
177 #endif | 198 #endif |
178 | 199 |
179 // Registers a custom event type. | 200 // Registers a custom event type. |
180 EVENTS_EXPORT int RegisterCustomEventType(); | 201 EVENTS_EXPORT int RegisterCustomEventType(); |
181 | 202 |
182 } // namespace ui | 203 } // namespace ui |
183 | 204 |
184 #endif // UI_EVENTS_EVENT_UTILS_H_ | 205 #endif // UI_EVENTS_EVENT_UTILS_H_ |
OLD | NEW |