| // Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module mojo; |
| |
| import "geometry/public/interfaces/geometry.mojom"; |
| import "input_events/public/interfaces/input_event_constants.mojom"; |
| import "input_events/public/interfaces/input_key_codes.mojom"; |
| |
| struct LocationData { |
| Point? in_view_location; |
| Point? screen_location; |
| }; |
| |
| struct KeyData { |
| // The chromium event key code; these values are from the ui/ KeyCode enum, |
| // which has the fun property of being neither consistently the Windows key |
| // code, nor the X11 keycodes. (This value is consistent across platforms |
| // for basic ASCII characters; it will differ for modifiers. We don't define |
| // this as a mojo enum because mojom doesn't appear to have a platform |
| // dependent preprocessor yet.) |
| // |
| // TODO(erg): Remove this, and declare Win32 keycodes correct by fiat. We can |
| // not do this until we remove ui::Event usage from within mojo. |
| int32 key_code; |
| |
| // Whether this is a character event, and the character value if it is. Note |
| // that this is different than |text|, which holds a value even when there |
| // isn't actually a character to insert. (For example, |text| will be set and |
| // have a value on backspace, and |character| won't.) |
| bool is_char; |
| uint16 character; |
| |
| // The Win32 key code. Because of the web, this is the closest thing that we |
| // have to a cross platform key state. |
| KeyboardCode windows_key_code; |
| |
| // The platform specific key code. |
| // |
| // TODO(erg): This exists only for NPAPI support, pepper USB keyboard support |
| // and IME on android support. Theoretically, we should be able to remove this |
| // in the medium to long term. |
| int32 native_key_code; |
| |
| // The text generated by this keystroke. Corresponds to |
| // blink::WebKeyboardEvent::text. |
| uint16 text; |
| |
| // Like |text|, but unmodified by concurrently held modifier keys (except |
| // shift). Corresponds to blink::WebKeyboardEvent::unmodifiedText. |
| uint16 unmodified_text; |
| }; |
| |
| struct TouchData { |
| int32 pointer_id; |
| }; |
| |
| struct GestureData { |
| // A bounding box for all the input events that contributed to this gesture. |
| RectF? bounding_box; |
| |
| // GESTURE_SCROLL_UPDATE |
| float scroll_x; |
| float scroll_y; |
| |
| // SCROLL_FLING_START |
| float velocity_x; |
| float velocity_y; |
| |
| // GESTURE_PINCH_UPDATE |
| float scale; |
| |
| // GESTURE_SWIPE |
| bool swipe_left; |
| bool swipe_right; |
| bool swipe_up; |
| bool swipe_down; |
| |
| // GESTURE_TAP and GESTURE_TAP_UNCONFIRMED and GESTURE_DOUBLE_TAP |
| int32 tap_count; |
| }; |
| |
| struct MouseWheelData { |
| int32 x_offset; |
| int32 y_offset; |
| }; |
| |
| struct Event { |
| EventType action; |
| EventFlags flags; |
| int64 time_stamp; |
| LocationData? location_data; |
| KeyData? key_data; |
| TouchData? touch_data; |
| GestureData? gesture_data; |
| MouseWheelData? wheel_data; |
| }; |