OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BASE_EVENTS_H_ | 5 #ifndef UI_BASE_EVENTS_H_ |
6 #define UI_BASE_EVENTS_H_ | 6 #define UI_BASE_EVENTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/event_types.h" | 9 #include "base/event_types.h" |
10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Get the EventType from a native event. | 73 // Get the EventType from a native event. |
74 UI_EXPORT EventType EventTypeFromNative(const base::NativeEvent& native_event); | 74 UI_EXPORT EventType EventTypeFromNative(const base::NativeEvent& native_event); |
75 | 75 |
76 // Get the EventFlags from a native event. | 76 // Get the EventFlags from a native event. |
77 UI_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); | 77 UI_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); |
78 | 78 |
79 // Get the location from a native event. | 79 // Get the location from a native event. |
80 UI_EXPORT gfx::Point EventLocationFromNative( | 80 UI_EXPORT gfx::Point EventLocationFromNative( |
81 const base::NativeEvent& native_event); | 81 const base::NativeEvent& native_event); |
82 | 82 |
| 83 #if defined(USE_X11) |
| 84 // Returns the 'real' button for an event. The button reported in slave events |
| 85 // does not take into account any remapping (e.g. using xmodmap), while the |
| 86 // button reported in master events do. This is a utility function to always |
| 87 // return the mapped button. |
| 88 UI_EXPORT int EventButtonFromNative(const base::NativeEvent& native_event); |
| 89 #endif |
| 90 |
83 // Returns the KeyboardCode from a native event. | 91 // Returns the KeyboardCode from a native event. |
84 UI_EXPORT KeyboardCode KeyboardCodeFromNative( | 92 UI_EXPORT KeyboardCode KeyboardCodeFromNative( |
85 const base::NativeEvent& native_event); | 93 const base::NativeEvent& native_event); |
86 | 94 |
87 // Returns true if the message is a mouse event. | 95 // Returns true if the message is a mouse event. |
88 UI_EXPORT bool IsMouseEvent(const base::NativeEvent& native_event); | 96 UI_EXPORT bool IsMouseEvent(const base::NativeEvent& native_event); |
89 | 97 |
90 // Gets the mouse wheel offset from a native event. | 98 // Gets the mouse wheel offset from a native event. |
91 UI_EXPORT int GetMouseWheelOffset(const base::NativeEvent& native_event); | 99 UI_EXPORT int GetMouseWheelOffset(const base::NativeEvent& native_event); |
92 | 100 |
93 // Gets the touch id from a native event. | 101 // Gets the touch id from a native event. |
94 UI_EXPORT int GetTouchId(const base::NativeEvent& native_event); | 102 UI_EXPORT int GetTouchId(const base::NativeEvent& native_event); |
95 | 103 |
96 // Gets the radius along the X/Y axis from a native event. Default is 1.0. | 104 // Gets the radius along the X/Y axis from a native event. Default is 1.0. |
97 UI_EXPORT float GetTouchRadiusX(const base::NativeEvent& native_event); | 105 UI_EXPORT float GetTouchRadiusX(const base::NativeEvent& native_event); |
98 UI_EXPORT float GetTouchRadiusY(const base::NativeEvent& native_event); | 106 UI_EXPORT float GetTouchRadiusY(const base::NativeEvent& native_event); |
99 | 107 |
100 // Gets the angle of the major axis away from the X axis. Default is 0.0. | 108 // Gets the angle of the major axis away from the X axis. Default is 0.0. |
101 UI_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); | 109 UI_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); |
102 | 110 |
103 // Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0. | 111 // Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0. |
104 UI_EXPORT float GetTouchForce(const base::NativeEvent& native_event); | 112 UI_EXPORT float GetTouchForce(const base::NativeEvent& native_event); |
105 | 113 |
106 // Creates and returns no-op event. | 114 // Creates and returns no-op event. |
107 UI_EXPORT base::NativeEvent CreateNoopEvent(); | 115 UI_EXPORT base::NativeEvent CreateNoopEvent(); |
108 | 116 |
109 } // namespace ui | 117 } // namespace ui |
110 | 118 |
111 #endif // UI_BASE_EVENTS_H_ | 119 #endif // UI_BASE_EVENTS_H_ |
OLD | NEW |