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 "ui/mojo/events/input_event_constants.mojom"; | 7 import "ui/mojo/events/input_event_constants.mojom"; |
8 import "ui/mojo/events/input_key_codes.mojom"; | 8 import "ui/mojo/events/input_key_codes.mojom"; |
9 import "ui/mojo/geometry/geometry.mojom"; | 9 import "ui/mojo/geometry/geometry.mojom"; |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... | |
40 | 40 |
41 // The text generated by this keystroke. Corresponds to | 41 // The text generated by this keystroke. Corresponds to |
42 // blink::WebKeyboardEvent::text. | 42 // blink::WebKeyboardEvent::text. |
43 uint16 text; | 43 uint16 text; |
44 | 44 |
45 // Like |text|, but unmodified by concurrently held modifier keys (except | 45 // Like |text|, but unmodified by concurrently held modifier keys (except |
46 // shift). Corresponds to blink::WebKeyboardEvent::unmodifiedText. | 46 // shift). Corresponds to blink::WebKeyboardEvent::unmodifiedText. |
47 uint16 unmodified_text; | 47 uint16 unmodified_text; |
48 }; | 48 }; |
49 | 49 |
50 struct LocationData { | |
51 // |x| and |y| are in the coordinate system of the View. | |
52 // Typically, this will be an integer-valued translation w.r.t. | |
53 // the screen and in this case, |x| and |y| are in units of physical | |
54 // pixels. However, some View embedders may apply arbitrary transformations | |
55 // of a view w.r.t. the screen. | |
56 float x; | |
57 float y; | |
58 // |screen_x| and |screen_y| are in screen coordinates in units of | |
59 // physical pixels. | |
60 float screen_x; | |
61 float screen_y; | |
62 }; | |
63 | |
64 // TODO(rjkroege,sadrul): Add gesture representation. | |
50 struct PointerData { | 65 struct PointerData { |
51 int32 pointer_id; | 66 int32 pointer_id; |
52 PointerKind kind; | 67 PointerKind kind; |
53 // |x| and |y| are in the coordinate system of the View. | 68 LocationData where; |
sky
2015/09/14 19:27:26
'where' is a weird name for this (same with line 8
rjkroege
2015/09/14 21:07:38
Done.
| |
54 float x; | 69 // Some devices (e.g. pen, finger) can extend across multiple pixels |
55 float y; | 70 // at once. |brush_data| provides additional data for this case and |
56 // |screen_x| and |screen_y| are in screen coordinates. | 71 // is available when |kind| is PEN or TOUCH. |
57 float screen_x; | 72 BrushData? brush_data; |
58 float screen_y; | 73 }; |
74 | |
75 // Information payload to support | |
76 // https://developer.mozilla.org/en-US/docs/Web/Events/wheel. | |
77 // TODO(rjkroege): Handle MacOS momentum scrolling. | |
78 struct WheelData { | |
79 WheelMode mode; | |
80 LocationData where; | |
81 // |delta_x|, |delta_y|, |delta_z| can be in units of pixels, lines, pages | |
82 // or control scaling as controlled by |mode|. Pixel scroll is physical | |
83 // pixels in the coordinate system of the target View. | |
84 float delta_x; | |
85 float delta_y; | |
86 float delta_z; | |
87 }; | |
88 | |
89 // Supplementary data to support pointers where the pointer can | |
90 // cover multiple pixels per http://www.w3.org/TR/pointerevents/ | |
91 struct BrushData { | |
92 // |width| and |height| are in CSS pixels in the coordinate system of | |
93 // the target View. | |
94 float width; | |
95 float height; | |
96 // |pressure| range is [0,1]. For devices like mice buttons where the | |
97 // pressure is not available, it will be set to 0.5 if the button is down. | |
59 float pressure; | 98 float pressure; |
60 float radius_major; | 99 // |tiltY| and |tiltX| are in degrees. |
61 float radius_minor; | 100 float tiltY; |
62 float orientation; | 101 float tiltZ; |
63 // Used for devices that support wheels. Ranges from -1 to 1. | |
64 float horizontal_wheel; | |
65 float vertical_wheel; | |
66 }; | 102 }; |
67 | 103 |
68 struct Event { | 104 struct Event { |
69 // TODO(sky): rename to type. | 105 // TODO(sky): rename to type. |
70 EventType action; | 106 EventType action; |
71 // TODO(sky): parts of this should move to PointerData. | 107 // TODO(sky): parts of this should move to PointerData. |
72 EventFlags flags; | 108 EventFlags flags; |
73 // Time in microseconds from when the platform was started. | 109 // Time in microseconds from when the platform was started. |
74 // This value accurately orders events w.r.t. to each other but | 110 // This value accurately orders events w.r.t. to each other but |
75 // does not position them at an absolute time. | 111 // does not position them at an absolute time. |
76 int64 time_stamp; | 112 int64 time_stamp; |
77 KeyData? key_data; | 113 KeyData? key_data; |
78 PointerData? pointer_data; | 114 PointerData? pointer_data; |
115 // Some devices (e.g. trackpads or mice) have additional valuators | |
116 // such as the mouse wheel or ball. Present only if action is WHEEL. | |
117 WheelData? wheel_data; | |
79 }; | 118 }; |
OLD | NEW |