| 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. | |
| 65 struct PointerData { | 50 struct PointerData { |
| 66 int32 pointer_id; | 51 int32 pointer_id; |
| 67 PointerKind kind; | 52 PointerKind kind; |
| 68 LocationData location; | 53 // |x| and |y| are in the coordinate system of the View. |
| 69 // Some devices (e.g. pen, finger) can extend across multiple pixels | 54 float x; |
| 70 // at once. |brush_data| provides additional data for this case and | 55 float y; |
| 71 // is available when |kind| is PEN or TOUCH. | 56 // |screen_x| and |screen_y| are in screen coordinates. |
| 72 BrushData? brush_data; | 57 float screen_x; |
| 73 }; | 58 float screen_y; |
| 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 location; | |
| 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. | |
| 98 float pressure; | 59 float pressure; |
| 99 // |tiltY| and |tiltX| are in degrees. | 60 float radius_major; |
| 100 float tiltY; | 61 float radius_minor; |
| 101 float tiltZ; | 62 float orientation; |
| 63 // Used for devices that support wheels. Ranges from -1 to 1. |
| 64 float horizontal_wheel; |
| 65 float vertical_wheel; |
| 102 }; | 66 }; |
| 103 | 67 |
| 104 struct Event { | 68 struct Event { |
| 105 // TODO(sky): rename to type. | 69 // TODO(sky): rename to type. |
| 106 EventType action; | 70 EventType action; |
| 107 // TODO(sky): parts of this should move to PointerData. | 71 // TODO(sky): parts of this should move to PointerData. |
| 108 EventFlags flags; | 72 EventFlags flags; |
| 109 // Time in microseconds from when the platform was started. | 73 // Time in microseconds from when the platform was started. |
| 110 // This value accurately orders events w.r.t. to each other but | 74 // This value accurately orders events w.r.t. to each other but |
| 111 // does not position them at an absolute time. | 75 // does not position them at an absolute time. |
| 112 int64 time_stamp; | 76 int64 time_stamp; |
| 113 KeyData? key_data; | 77 KeyData? key_data; |
| 114 PointerData? pointer_data; | 78 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; | |
| 118 }; | 79 }; |
| OLD | NEW |