OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_X_EVENTS_X_UTILS_H_ | 5 #ifndef UI_EVENTS_X_EVENTS_X_UTILS_H_ |
6 #define UI_EVENTS_X_EVENTS_X_UTILS_H_ | 6 #define UI_EVENTS_X_EVENTS_X_UTILS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "ui/events/event_constants.h" | 11 #include "ui/events/event_constants.h" |
12 #include "ui/events/x/events_x_export.h" | 12 #include "ui/events/x/events_x_export.h" |
13 #include "ui/gfx/geometry/point.h" | 13 #include "ui/gfx/geometry/point.h" |
14 | 14 |
15 typedef union _XEvent XEvent; | 15 typedef union _XEvent XEvent; |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 | 18 |
19 // Get the EventType from a XEvent. | 19 // Gets the EventType from a XEvent. |
20 EVENTS_X_EXPORT EventType EventTypeFromXEvent(const XEvent& xev); | 20 EVENTS_X_EXPORT EventType EventTypeFromXEvent(const XEvent& xev); |
21 | 21 |
22 // Get the EventFlags from a XEvent. | 22 // Gets the EventFlags from a XEvent. |
23 EVENTS_X_EXPORT int EventFlagsFromXEvent(const XEvent& xev); | 23 EVENTS_X_EXPORT int EventFlagsFromXEvent(const XEvent& xev); |
24 | 24 |
25 // Get the timestamp from a XEvent. | 25 // Gets the timestamp from a XEvent. |
26 EVENTS_X_EXPORT base::TimeDelta EventTimeFromXEvent(const XEvent& xev); | 26 EVENTS_X_EXPORT base::TimeDelta EventTimeFromXEvent(const XEvent& xev); |
27 | 27 |
28 // Get the location from a XEvent. The coordinate system of the resultant | 28 // Gets the location from a XEvent. The coordinate system of the resultant |
29 // |Point| has the origin at top-left of the "root window". The nature of | 29 // |Point| has the origin at top-left of the "root window". The nature of |
30 // this "root window" and how it maps to platform-specific drawing surfaces is | 30 // this "root window" and how it maps to platform-specific drawing surfaces is |
31 // defined in ui/aura/root_window.* and ui/aura/window_tree_host*. | 31 // defined in ui/aura/root_window.* and ui/aura/window_tree_host*. |
32 EVENTS_X_EXPORT gfx::Point EventLocationFromXEvent(const XEvent& xev); | 32 EVENTS_X_EXPORT gfx::Point EventLocationFromXEvent(const XEvent& xev); |
33 | 33 |
34 // Gets the location in native system coordinate space. | 34 // Gets the location in native system coordinate space. |
35 EVENTS_X_EXPORT gfx::Point EventSystemLocationFromXEvent(const XEvent& xev); | 35 EVENTS_X_EXPORT gfx::Point EventSystemLocationFromXEvent(const XEvent& xev); |
36 | 36 |
37 // Returns the 'real' button for an event. The button reported in slave events | 37 // Returns the 'real' button for an event. The button reported in slave events |
38 // does not take into account any remapping (e.g. using xmodmap), while the | 38 // does not take into account any remapping (e.g. using xmodmap), while the |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 float* vy, | 78 float* vy, |
79 float* vx_ordinal, | 79 float* vx_ordinal, |
80 float* vy_ordinal, | 80 float* vy_ordinal, |
81 bool* is_cancel); | 81 bool* is_cancel); |
82 | 82 |
83 EVENTS_X_EXPORT void ResetTimestampRolloverCountersForTesting(); | 83 EVENTS_X_EXPORT void ResetTimestampRolloverCountersForTesting(); |
84 | 84 |
85 } // namespace ui | 85 } // namespace ui |
86 | 86 |
87 #endif // UI_EVENTS_X_EVENTS_X_UTILS_H_ | 87 #endif // UI_EVENTS_X_EVENTS_X_UTILS_H_ |
OLD | NEW |