OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 module mojo; | 5 module mojo; |
6 | 6 |
7 import "geometry/public/interfaces/geometry.mojom"; | 7 import "geometry/public/interfaces/geometry.mojom"; |
8 import "input_events/public/interfaces/input_event_constants.mojom"; | 8 import "input_events/public/interfaces/input_event_constants.mojom"; |
9 import "input_events/public/interfaces/input_key_codes.mojom"; | 9 import "input_events/public/interfaces/input_key_codes.mojom"; |
10 | 10 |
11 struct LocationData { | |
12 Point? in_view_location; | |
13 Point? screen_location; | |
14 }; | |
15 | |
16 struct KeyData { | 11 struct KeyData { |
17 // The chromium event key code; these values are from the ui/ KeyCode enum, | 12 // The chromium event key code; these values are from the ui/ KeyCode enum, |
18 // which has the fun property of being neither consistently the Windows key | 13 // which has the fun property of being neither consistently the Windows key |
19 // code, nor the X11 keycodes. (This value is consistent across platforms | 14 // code, nor the X11 keycodes. (This value is consistent across platforms |
20 // for basic ASCII characters; it will differ for modifiers. We don't define | 15 // for basic ASCII characters; it will differ for modifiers. We don't define |
21 // this as a mojo enum because mojom doesn't appear to have a platform | 16 // this as a mojo enum because mojom doesn't appear to have a platform |
22 // dependent preprocessor yet.) | 17 // dependent preprocessor yet.) |
23 // | 18 // |
24 // TODO(erg): Remove this, and declare Win32 keycodes correct by fiat. We can | 19 // TODO(erg): Remove this, and declare Win32 keycodes correct by fiat. We can |
25 // not do this until we remove ui::Event usage from within mojo. | 20 // not do this until we remove ui::Event usage from within mojo. |
(...skipping 19 matching lines...) Expand all Loading... |
45 | 40 |
46 // The text generated by this keystroke. Corresponds to | 41 // The text generated by this keystroke. Corresponds to |
47 // blink::WebKeyboardEvent::text. | 42 // blink::WebKeyboardEvent::text. |
48 uint16 text; | 43 uint16 text; |
49 | 44 |
50 // Like |text|, but unmodified by concurrently held modifier keys (except | 45 // Like |text|, but unmodified by concurrently held modifier keys (except |
51 // shift). Corresponds to blink::WebKeyboardEvent::unmodifiedText. | 46 // shift). Corresponds to blink::WebKeyboardEvent::unmodifiedText. |
52 uint16 unmodified_text; | 47 uint16 unmodified_text; |
53 }; | 48 }; |
54 | 49 |
55 struct TouchData { | 50 struct PointerData { |
56 int32 pointer_id; | 51 int32 pointer_id; |
57 }; | 52 PointerKind kind; |
58 | 53 // |x| and |y| are in the coordinate system of the View. |
59 struct GestureData { | 54 float x; |
60 // A bounding box for all the input events that contributed to this gesture. | 55 float y; |
61 RectF? bounding_box; | 56 // |screen_x| and |screen_y| are in screen coordinates. |
62 | 57 float screen_x; |
63 // GESTURE_SCROLL_UPDATE | 58 float screen_y; |
64 float scroll_x; | 59 float pressure; |
65 float scroll_y; | 60 float radius_major; |
66 | 61 float radius_minor; |
67 // SCROLL_FLING_START | 62 float orientation; |
68 float velocity_x; | 63 // Used for devices that support wheels. Ranges from -1 to 1. |
69 float velocity_y; | 64 float horizontal_wheel; |
70 | 65 float vertical_wheel; |
71 // GESTURE_PINCH_UPDATE | |
72 float scale; | |
73 | |
74 // GESTURE_SWIPE | |
75 bool swipe_left; | |
76 bool swipe_right; | |
77 bool swipe_up; | |
78 bool swipe_down; | |
79 | |
80 // GESTURE_TAP and GESTURE_TAP_UNCONFIRMED and GESTURE_DOUBLE_TAP | |
81 int32 tap_count; | |
82 }; | |
83 | |
84 struct MouseWheelData { | |
85 int32 x_offset; | |
86 int32 y_offset; | |
87 }; | 66 }; |
88 | 67 |
89 struct Event { | 68 struct Event { |
| 69 // TODO(sky): rename to type. |
90 EventType action; | 70 EventType action; |
| 71 // TODO(sky): parts of this should move to PointerData. |
91 EventFlags flags; | 72 EventFlags flags; |
92 int64 time_stamp; | 73 int64 time_stamp; |
93 LocationData? location_data; | |
94 KeyData? key_data; | 74 KeyData? key_data; |
95 TouchData? touch_data; | 75 PointerData? pointer_data; |
96 GestureData? gesture_data; | |
97 MouseWheelData? wheel_data; | |
98 }; | 76 }; |
OLD | NEW |