| 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 module mus.mojom; | |
| 6 | |
| 7 import "components/mus/public/interfaces/input_event_constants.mojom"; | |
| 8 import "components/mus/public/interfaces/input_key_codes.mojom"; | |
| 9 | |
| 10 struct KeyData { | |
| 11 // The chromium event key code; these values are from the ui/ KeyCode enum, | |
| 12 // which has the fun property of being neither consistently the Windows key | |
| 13 // code, nor the X11 keycodes. (This value is consistent across platforms | |
| 14 // for basic ASCII characters; it will differ for modifiers. We don't define | |
| 15 // this as a mojo enum because mojom doesn't appear to have a platform | |
| 16 // dependent preprocessor yet.) | |
| 17 // | |
| 18 // TODO(erg): Remove this, and declare Win32 keycodes correct by fiat. We can | |
| 19 // not do this until we remove ui::Event usage from within mojo. | |
| 20 int32 key_code; | |
| 21 | |
| 22 // Whether this is a character event, and the character value if it is. Note | |
| 23 // that this is different than |text|, which holds a value even when there | |
| 24 // isn't actually a character to insert. (For example, |text| will be set and | |
| 25 // have a value on backspace, and |character| won't.) | |
| 26 bool is_char; | |
| 27 uint16 character; | |
| 28 | |
| 29 // The Win32 key code. Because of the web, this is the closest thing that we | |
| 30 // have to a cross platform key state. | |
| 31 KeyboardCode windows_key_code; | |
| 32 | |
| 33 // The platform specific key code. | |
| 34 // | |
| 35 // TODO(erg): This exists only for NPAPI support, pepper USB keyboard support | |
| 36 // and IME on android support. Theoretically, we should be able to remove this | |
| 37 // in the medium to long term. | |
| 38 int32 native_key_code; | |
| 39 | |
| 40 // The text generated by this keystroke. Corresponds to | |
| 41 // blink::WebKeyboardEvent::text. | |
| 42 uint16 text; | |
| 43 | |
| 44 // Like |text|, but unmodified by concurrently held modifier keys (except | |
| 45 // shift). Corresponds to blink::WebKeyboardEvent::unmodifiedText. | |
| 46 uint16 unmodified_text; | |
| 47 }; | |
| 48 | |
| 49 struct LocationData { | |
| 50 // |x| and |y| are in the coordinate system of the View. | |
| 51 // Typically, this will be an integer-valued translation w.r.t. | |
| 52 // the screen and in this case, |x| and |y| are in units of physical | |
| 53 // pixels. However, some View embedders may apply arbitrary transformations | |
| 54 // of a view w.r.t. the screen. | |
| 55 float x; | |
| 56 float y; | |
| 57 // |screen_x| and |screen_y| are in screen coordinates in units of | |
| 58 // physical pixels. | |
| 59 float screen_x; | |
| 60 float screen_y; | |
| 61 }; | |
| 62 | |
| 63 // TODO(rjkroege,sadrul): Add gesture representation. | |
| 64 struct PointerData { | |
| 65 int32 pointer_id; | |
| 66 PointerKind kind; | |
| 67 LocationData location; | |
| 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 // Only set for |WHEEL| events. | |
| 73 WheelData? wheel_data; | |
| 74 }; | |
| 75 | |
| 76 // Information payload to support | |
| 77 // https://developer.mozilla.org/en-US/docs/Web/Events/wheel. | |
| 78 // TODO(rjkroege): Handle MacOS momentum scrolling. | |
| 79 struct WheelData { | |
| 80 WheelMode mode; | |
| 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; | |
| 99 // |tilt_x| and |tilt_y| are in degrees. See comments in ui::PointerDetails | |
| 100 // for more information. | |
| 101 float tilt_x; | |
| 102 float tilt_y; | |
| 103 }; | |
| 104 | |
| 105 struct Event { | |
| 106 // TODO(sky): rename to type. | |
| 107 EventType action; | |
| 108 // A bitfield of kEventFlag* and kMouseEventFlag* values in | |
| 109 // input_event_constants.mojom. | |
| 110 // | |
| 111 // TODO(sky): parts of this should move to PointerData. | |
| 112 int32 flags; | |
| 113 // Time in microseconds from when the platform was started. | |
| 114 // This value accurately orders events w.r.t. to each other but | |
| 115 // does not position them at an absolute time. | |
| 116 int64 time_stamp; | |
| 117 KeyData? key_data; | |
| 118 PointerData? pointer_data; | |
| 119 }; | |
| OLD | NEW |