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_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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 UI_EXPORT base::TimeDelta EventTimeFromNative( | 132 UI_EXPORT base::TimeDelta EventTimeFromNative( |
133 const base::NativeEvent& native_event); | 133 const base::NativeEvent& native_event); |
134 | 134 |
135 // Get the location from a native event. The coordinate system of the resultant | 135 // Get the location from a native event. The coordinate system of the resultant |
136 // |Point| has the origin at top-left of the "root window". The nature of | 136 // |Point| has the origin at top-left of the "root window". The nature of |
137 // this "root window" and how it maps to platform-specific drawing surfaces is | 137 // this "root window" and how it maps to platform-specific drawing surfaces is |
138 // defined in ui/aura/root_window.* and ui/aura/root_window_host*. | 138 // defined in ui/aura/root_window.* and ui/aura/root_window_host*. |
139 UI_EXPORT gfx::Point EventLocationFromNative( | 139 UI_EXPORT gfx::Point EventLocationFromNative( |
140 const base::NativeEvent& native_event); | 140 const base::NativeEvent& native_event); |
141 | 141 |
| 142 // Gets the location relative to the root window from a native event. If this |
| 143 // can't be determined, fall back on the window relative location. |
| 144 UI_EXPORT gfx::Point EventRootLocationFromNative( |
| 145 const base::NativeEvent& native_event); |
| 146 |
142 #if defined(USE_X11) | 147 #if defined(USE_X11) |
143 // Returns the 'real' button for an event. The button reported in slave events | 148 // Returns the 'real' button for an event. The button reported in slave events |
144 // does not take into account any remapping (e.g. using xmodmap), while the | 149 // does not take into account any remapping (e.g. using xmodmap), while the |
145 // button reported in master events do. This is a utility function to always | 150 // button reported in master events do. This is a utility function to always |
146 // return the mapped button. | 151 // return the mapped button. |
147 UI_EXPORT int EventButtonFromNative(const base::NativeEvent& native_event); | 152 UI_EXPORT int EventButtonFromNative(const base::NativeEvent& native_event); |
148 #endif | 153 #endif |
149 | 154 |
150 // Returns the KeyboardCode from a native event. | 155 // Returns the KeyboardCode from a native event. |
151 UI_EXPORT KeyboardCode KeyboardCodeFromNative( | 156 UI_EXPORT KeyboardCode KeyboardCodeFromNative( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 205 |
201 // Returns true if event is noop. | 206 // Returns true if event is noop. |
202 UI_EXPORT bool IsNoopEvent(const base::NativeEvent& event); | 207 UI_EXPORT bool IsNoopEvent(const base::NativeEvent& event); |
203 | 208 |
204 // Creates and returns no-op event. | 209 // Creates and returns no-op event. |
205 UI_EXPORT base::NativeEvent CreateNoopEvent(); | 210 UI_EXPORT base::NativeEvent CreateNoopEvent(); |
206 | 211 |
207 } // namespace ui | 212 } // namespace ui |
208 | 213 |
209 #endif // UI_BASE_EVENTS_H_ | 214 #endif // UI_BASE_EVENTS_H_ |
OLD | NEW |