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 KeyData { | |
12 // The chromium event key code; these values are from the ui/ KeyCode enum, | |
13 // which has the fun property of being neither consistently the Windows key | |
14 // code, nor the X11 keycodes. (This value is consistent across platforms | |
15 // for basic ASCII characters; it will differ for modifiers. We don't define | |
16 // this as a mojo enum because mojom doesn't appear to have a platform | |
17 // dependent preprocessor yet.) | |
18 // | |
19 // TODO(erg): Remove this, and declare Win32 keycodes correct by fiat. We can | |
20 // not do this until we remove ui::Event usage from within mojo. | |
21 int32 key_code; | |
22 | |
23 // Whether this is a character event, and the character value if it is. Note | |
24 // that this is different than |text|, which holds a value even when there | |
25 // isn't actually a character to insert. (For example, |text| will be set and | |
26 // have a value on backspace, and |character| won't.) | |
27 bool is_char; | |
28 uint16 character; | |
29 | |
30 // The Win32 key code. Because of the web, this is the closest thing that we | |
31 // have to a cross platform key state. | |
32 KeyboardCode windows_key_code; | |
33 | |
34 // The platform specific key code. | |
35 // | |
36 // TODO(erg): This exists only for NPAPI support, pepper USB keyboard support | |
37 // and IME on android support. Theoretically, we should be able to remove this | |
38 // in the medium to long term. | |
39 int32 native_key_code; | |
40 | |
41 // The text generated by this keystroke. Corresponds to | |
42 // blink::WebKeyboardEvent::text. | |
43 uint16 text; | |
44 | |
45 // Like |text|, but unmodified by concurrently held modifier keys (except | |
46 // shift). Corresponds to blink::WebKeyboardEvent::unmodifiedText. | |
47 uint16 unmodified_text; | |
48 }; | |
49 | |
50 struct PointerData { | |
51 int32 pointer_id; | |
52 PointerKind kind; | |
53 // |x| and |y| are in the coordinate system of the View. | |
54 float x; | |
55 float y; | |
56 // |screen_x| and |screen_y| are in screen coordinates. | |
57 float screen_x; | |
58 float screen_y; | |
59 float pressure; | |
60 float radius_major; | |
61 float radius_minor; | |
62 float orientation; | |
63 // Used for devices that support wheels. Ranges from -1 to 1. | |
64 float horizontal_wheel; | |
65 float vertical_wheel; | |
66 }; | |
67 | |
68 struct Event { | |
69 // TODO(sky): rename to type. | |
70 EventType action; | |
71 // TODO(sky): parts of this should move to PointerData. | |
72 EventFlags flags; | |
73 // Time the event was delivered. The time is in milliseconds and corresponds | |
74 // to the uptime of the machine. | |
75 int64 time_stamp; | |
76 KeyData? key_data; | |
77 PointerData? pointer_data; | |
78 }; | |
OLD | NEW |