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 <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/time/tick_clock.h" | 12 #include "base/time/tick_clock.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "ui/events/event_constants.h" | 14 #include "ui/events/event_constants.h" |
15 #include "ui/events/x/events_x_export.h" | 15 #include "ui/events/x/events_x_export.h" |
16 #include "ui/gfx/geometry/point.h" | 16 #include "ui/gfx/geometry/point.h" |
17 | 17 |
18 typedef union _XEvent XEvent; | 18 typedef union _XEvent XEvent; |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 // Gets the EventType from a XEvent. | 22 // Gets the EventType from a XEvent. |
23 EVENTS_X_EXPORT EventType EventTypeFromXEvent(const XEvent& xev); | 23 EVENTS_X_EXPORT EventType EventTypeFromXEvent(const XEvent& xev); |
24 | 24 |
25 // Gets the EventFlags from a XEvent. | 25 // Gets the EventFlags from a XEvent. |
26 EVENTS_X_EXPORT int EventFlagsFromXEvent(const XEvent& xev); | 26 EVENTS_X_EXPORT int EventFlagsFromXEvent(const XEvent& xev); |
27 | 27 |
28 // Gets the timestamp from a XEvent. | 28 // Gets the timestamp from a XEvent. |
29 EVENTS_X_EXPORT base::TimeDelta EventTimeFromXEvent(const XEvent& xev); | 29 EVENTS_X_EXPORT base::TimeTicks EventTimeFromXEvent(const XEvent& xev); |
30 | 30 |
31 // Gets the location from a XEvent. The coordinate system of the resultant | 31 // Gets the location from a XEvent. The coordinate system of the resultant |
32 // |Point| has the origin at top-left of the "root window". The nature of | 32 // |Point| has the origin at top-left of the "root window". The nature of |
33 // this "root window" and how it maps to platform-specific drawing surfaces is | 33 // this "root window" and how it maps to platform-specific drawing surfaces is |
34 // defined in ui/aura/root_window.* and ui/aura/window_tree_host*. | 34 // defined in ui/aura/root_window.* and ui/aura/window_tree_host*. |
35 EVENTS_X_EXPORT gfx::Point EventLocationFromXEvent(const XEvent& xev); | 35 EVENTS_X_EXPORT gfx::Point EventLocationFromXEvent(const XEvent& xev); |
36 | 36 |
37 // Gets the location in native system coordinate space. | 37 // Gets the location in native system coordinate space. |
38 EVENTS_X_EXPORT gfx::Point EventSystemLocationFromXEvent(const XEvent& xev); | 38 EVENTS_X_EXPORT gfx::Point EventSystemLocationFromXEvent(const XEvent& xev); |
39 | 39 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 float* vx_ordinal, | 82 float* vx_ordinal, |
83 float* vy_ordinal, | 83 float* vy_ordinal, |
84 bool* is_cancel); | 84 bool* is_cancel); |
85 | 85 |
86 EVENTS_X_EXPORT void ResetTimestampRolloverCountersForTesting( | 86 EVENTS_X_EXPORT void ResetTimestampRolloverCountersForTesting( |
87 std::unique_ptr<base::TickClock> tick_clock = nullptr); | 87 std::unique_ptr<base::TickClock> tick_clock = nullptr); |
88 | 88 |
89 } // namespace ui | 89 } // namespace ui |
90 | 90 |
91 #endif // UI_EVENTS_X_EVENTS_X_UTILS_H_ | 91 #endif // UI_EVENTS_X_EVENTS_X_UTILS_H_ |
OLD | NEW |