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 { |
| 78 WheelMode mode; |
| 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 { |
| 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]. For devices like mice buttons where the |
| 95 // pressure is not available, it will be set to 0.5 if the button is down. |
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 |