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 #include "ui/gfx/x/x11_types.h" |
14 | 15 |
15 typedef union _XEvent XEvent; | 16 typedef union _XEvent XEvent; |
16 | 17 |
17 namespace ui { | 18 namespace ui { |
18 | 19 |
19 // Get the EventType from a XEvent. | 20 // Gets the XID of XWindow from a XEvent. |
| 21 EVENTS_X_EXPORT XID XWindowFromXEvent(const XEvent& xev); |
| 22 |
| 23 // Gets the EventType from a XEvent. |
20 EVENTS_X_EXPORT EventType EventTypeFromXEvent(const XEvent& xev); | 24 EVENTS_X_EXPORT EventType EventTypeFromXEvent(const XEvent& xev); |
21 | 25 |
22 // Get the EventFlags from a XEvent. | 26 // Gets the EventFlags from a XEvent. |
23 EVENTS_X_EXPORT int EventFlagsFromXEvent(const XEvent& xev); | 27 EVENTS_X_EXPORT int EventFlagsFromXEvent(const XEvent& xev); |
24 | 28 |
25 // Get the timestamp from a XEvent. | 29 // Gets the timestamp from a XEvent. |
26 EVENTS_X_EXPORT base::TimeDelta EventTimeFromXEvent(const XEvent& xev); | 30 EVENTS_X_EXPORT base::TimeDelta EventTimeFromXEvent(const XEvent& xev); |
27 | 31 |
28 // Get the location from a XEvent. The coordinate system of the resultant | 32 // 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 | 33 // |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 | 34 // 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*. | 35 // defined in ui/aura/root_window.* and ui/aura/window_tree_host*. |
32 EVENTS_X_EXPORT gfx::Point EventLocationFromXEvent(const XEvent& xev); | 36 EVENTS_X_EXPORT gfx::Point EventLocationFromXEvent(const XEvent& xev); |
33 | 37 |
34 // Gets the location in native system coordinate space. | 38 // Gets the location in native system coordinate space. |
35 EVENTS_X_EXPORT gfx::Point EventSystemLocationFromXEvent(const XEvent& xev); | 39 EVENTS_X_EXPORT gfx::Point EventSystemLocationFromXEvent(const XEvent& xev); |
36 | 40 |
37 // Returns the 'real' button for an event. The button reported in slave events | 41 // 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 | 42 // does not take into account any remapping (e.g. using xmodmap), while the |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 EVENTS_X_EXPORT bool GetFlingDataFromXEvent(const XEvent& xev, | 80 EVENTS_X_EXPORT bool GetFlingDataFromXEvent(const XEvent& xev, |
77 float* vx, | 81 float* vx, |
78 float* vy, | 82 float* vy, |
79 float* vx_ordinal, | 83 float* vx_ordinal, |
80 float* vy_ordinal, | 84 float* vy_ordinal, |
81 bool* is_cancel); | 85 bool* is_cancel); |
82 | 86 |
83 } // namespace ui | 87 } // namespace ui |
84 | 88 |
85 #endif // UI_EVENTS_X_EVENTS_X_UTILS_H_ | 89 #endif // UI_EVENTS_X_EVENTS_X_UTILS_H_ |
OLD | NEW |