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 // TODO(rjkroege,sadrul): Add gesture representation. | |
50 struct PointerData { | 51 struct PointerData { |
51 int32 pointer_id; | 52 int32 pointer_id; |
52 PointerKind kind; | 53 PointerKind kind; |
53 // |x| and |y| are in the coordinate system of the View. | 54 // |x| and |y| are in the coordinate system of the View. |
55 // Typically, this will be an integer-valued translation w.r.t. | |
56 // the screen and in this case, |x| and |y| are in units of physical | |
57 // pixels. However, some View embedders may apply arbitrary transformations | |
58 // of a view w.r.t. the screen. | |
54 float x; | 59 float x; |
55 float y; | 60 float y; |
56 // |screen_x| and |screen_y| are in screen coordinates. | 61 // |screen_x| and |screen_y| are in screen coordinates in units of |
62 // physical pixels. | |
57 float screen_x; | 63 float screen_x; |
58 float screen_y; | 64 float screen_y; |
65 // Some devices (e.g. trackpads or mice) have additional valuators | |
66 // such as the mouse wheel or ball. Present only if kind is WHEEL. | |
67 WheelData? wheel_data; | |
68 // Some devices (e.g. pen, finger) can extend across multiple pixels | |
69 // at once. |brush_data| provides additional data for this case and | |
70 // is available when |kind| is PEN or TOUCH. | |
71 BrushData? brush_data; | |
72 }; | |
73 | |
74 // Information payload to support | |
75 // https://developer.mozilla.org/en-US/docs/Web/Events/wheel. | |
76 // TODO(rjkroege): Handle MacOS momentum scrolling. | |
77 struct WheelData { | |
sadrul
2015/09/09 04:19:05
Would it make sense to make this ScrollData? (e.g.
rjkroege
2015/09/09 19:45:38
I have this long frustration with the re-use of wh
sadrul
2015/09/10 17:39:15
Re-using wheel events to mean scrolling does sound
rjkroege
2015/09/12 01:29:02
At some level yes. But we don't know if a wheel is
| |
78 WheelMode mode; | |
sadrul
2015/09/09 04:19:05
As per above, ScrollMode?
rjkroege
2015/09/09 19:45:38
see the above. I will update this after updating t
| |
79 // |delta_x|, |delta_y|, |delta_z| can be in units of pixels, lines, pages | |
80 // or control scaling as controlled by |mode|. Pixel scroll is physical | |
81 // pixels in the coordinate system of the target View. | |
82 float delta_x; | |
83 float delta_y; | |
84 float delta_z; | |
85 }; | |
86 | |
87 // Supplementary data to support pointers where the pointer can | |
88 // cover multiple pixels per http://www.w3.org/TR/pointerevents/ | |
89 struct BrushData { | |
sadrul
2015/09/09 04:19:05
'Brush' here seems awkward, but I don't have a sug
rjkroege
2015/09/09 19:45:38
Brush: short, analogous with paint programs. Am ha
sadrul
2015/09/10 17:39:15
Heh, yeah. I am OK with Brush until we can think o
| |
90 // |width| and |height| are in CSS pixels in the coordinate system of | |
91 // the target View. | |
92 float width; | |
93 float height; | |
94 // |pressure| range is [0,1]. It will be set to 0.5 when the device cannot | |
sadrul
2015/09/09 04:19:04
The 'unknown' value for pressure in the spec is 0,
rjkroege
2015/09/09 19:45:38
Done
| |
95 // provide the actual value. | |
59 float pressure; | 96 float pressure; |
60 float radius_major; | 97 // |tiltY| and |tiltX| are in degrees. |
61 float radius_minor; | 98 float tiltY; |
62 float orientation; | 99 float tiltZ; |
63 // Used for devices that support wheels. Ranges from -1 to 1. | |
64 float horizontal_wheel; | |
65 float vertical_wheel; | |
66 }; | 100 }; |
67 | 101 |
68 struct Event { | 102 struct Event { |
69 // TODO(sky): rename to type. | 103 // TODO(sky): rename to type. |
70 EventType action; | 104 EventType action; |
71 // TODO(sky): parts of this should move to PointerData. | 105 // TODO(sky): parts of this should move to PointerData. |
72 EventFlags flags; | 106 EventFlags flags; |
73 // Time in microseconds from when the platform was started. | 107 // Time in microseconds from when the platform was started. |
74 // This value accurately orders events w.r.t. to each other but | 108 // This value accurately orders events w.r.t. to each other but |
75 // does not position them at an absolute time. | 109 // does not position them at an absolute time. |
76 int64 time_stamp; | 110 int64 time_stamp; |
77 KeyData? key_data; | 111 KeyData? key_data; |
78 PointerData? pointer_data; | 112 PointerData? pointer_data; |
79 }; | 113 }; |
OLD | NEW |