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