OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 module mojo; | |
6 | |
7 import "geometry/public/interfaces/geometry.mojom"; | |
8 import "input_events/public/interfaces/input_event_constants.mojom"; | |
9 import "input_events/public/interfaces/input_key_codes.mojom"; | |
10 | |
11 struct LocationData { | |
12 Point? in_view_location; | |
13 Point? screen_location; | |
14 }; | |
15 | |
16 struct KeyData { | |
17 // 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 | |
19 // 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 | |
21 // this as a mojo enum because mojom doesn't appear to have a platform | |
22 // dependent preprocessor yet.) | |
23 // | |
24 // 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. | |
26 int32 key_code; | |
27 | |
28 // Whether this is a character event, and the character value if it is. Note | |
29 // that this is different than |text|, which holds a value even when there | |
30 // isn't actually a character to insert. (For example, |text| will be set and | |
31 // have a value on backspace, and |character| won't.) | |
32 bool is_char; | |
33 uint16 character; | |
34 | |
35 // The Win32 key code. Because of the web, this is the closest thing that we | |
36 // have to a cross platform key state. | |
37 KeyboardCode windows_key_code; | |
38 | |
39 // The platform specific key code. | |
40 // | |
41 // TODO(erg): This exists only for NPAPI support, pepper USB keyboard support | |
42 // and IME on android support. Theoretically, we should be able to remove this | |
43 // in the medium to long term. | |
44 int32 native_key_code; | |
45 | |
46 // The text generated by this keystroke. Corresponds to | |
47 // blink::WebKeyboardEvent::text. | |
48 uint16 text; | |
49 | |
50 // Like |text|, but unmodified by concurrently held modifier keys (except | |
51 // shift). Corresponds to blink::WebKeyboardEvent::unmodifiedText. | |
52 uint16 unmodified_text; | |
53 }; | |
54 | |
55 struct TouchData { | |
56 int32 pointer_id; | |
57 }; | |
58 | |
59 struct GestureData { | |
60 // A bounding box for all the input events that contributed to this gesture. | |
61 RectF? bounding_box; | |
62 | |
63 // GESTURE_SCROLL_UPDATE | |
64 float scroll_x; | |
65 float scroll_y; | |
66 | |
67 // SCROLL_FLING_START | |
68 float velocity_x; | |
69 float velocity_y; | |
70 | |
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 }; | |
88 | |
89 struct Event { | |
90 EventType action; | |
91 EventFlags flags; | |
92 int64 time_stamp; | |
93 LocationData? location_data; | |
94 KeyData? key_data; | |
95 TouchData? touch_data; | |
96 GestureData? gesture_data; | |
97 MouseWheelData? wheel_data; | |
98 }; | |
OLD | NEW |