OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 mus.mojom; | 5 module mus.mojom; |
6 | 6 |
7 import "ui/events/mojo/event_constants.mojom"; | 7 import "ui/events/mojo/event_constants.mojom"; |
8 import "ui/events/mojo/keyboard_codes.mojom"; | 8 import "ui/events/mojo/keyboard_codes.mojom"; |
9 import "ui/gfx/geometry/mojo/geometry.mojom"; | 9 import "ui/gfx/geometry/mojo/geometry.mojom"; |
10 | 10 |
11 struct KeyEventMatcher { | 11 struct KeyEventMatcher { |
12 ui.mojom.KeyboardCode keyboard_code; | 12 ui.mojom.KeyboardCode keyboard_code; |
13 }; | 13 }; |
14 | 14 |
15 struct PointerKindMatcher { | 15 struct PointerKindMatcher { |
16 ui.mojom.PointerKind pointer_kind; | 16 ui.mojom.PointerKind pointer_kind; |
17 }; | 17 }; |
18 | 18 |
19 struct PointerLocationMatcher { | 19 struct PointerLocationMatcher { |
20 gfx.mojom.RectF region; | 20 gfx.mojom.RectF region; |
21 }; | 21 }; |
22 | 22 |
23 struct EventTypeMatcher { | 23 struct EventTypeMatcher { |
24 ui.mojom.EventType type; | 24 ui.mojom.EventType type; |
25 }; | 25 }; |
26 | 26 |
27 struct EventMultTypeMatcher { | |
28 array<ui.mojom.EventType> types; | |
29 }; | |
30 | |
27 struct EventFlagsMatcher { | 31 struct EventFlagsMatcher { |
28 // A bitfield of kEventFlag* and kMouseEventFlag* values in | 32 // A bitfield of kEventFlag* and kMouseEventFlag* values in |
29 // input_event_constants.mojom. | 33 // input_event_constants.mojom. |
30 int32 flags; | 34 int32 flags; |
31 }; | 35 }; |
32 | 36 |
33 // If a specific matcher is missing, then an Event will match this EventMatcher | 37 // If a specific matcher is missing, then an Event will match this EventMatcher |
34 // (if relevant). For example, if |type_matcher| is missing, then events of all | 38 // (if relevant). For example, if |type_matcher| is missing, then events of all |
35 // types will match this EventMatcher. Similarly, if |key_matcher| is missing, | 39 // types will match this EventMatcher. Similarly, if |key_matcher| is missing, |
36 // then all key-events will match. | 40 // then all key-events will match. |
37 // An example matcher to match the Ctrl+A accelerator would be: | 41 // An example matcher to match the Ctrl+A accelerator would be: |
38 // - |type_matcher.type| = ui::mojom::EventType::KEY_PRESSED | 42 // - |type_matcher.type| = ui::mojom::EventType::KEY_PRESSED |
39 // - |flags_matcher.flags| = ui::mojom::kEventVlagControlDown | 43 // - |flags_matcher.flags| = ui::mojom::kEventVlagControlDown |
40 // - |key_matcher.keyboard_code| = ui::mojom::KeyboardCode::A | 44 // - |key_matcher.keyboard_code| = ui::mojom::KeyboardCode::A |
41 // | 45 // |
42 // A matcher to match any key-press event would be: | 46 // A matcher to match any key-press event would be: |
43 // - |type_matcher.type| = ui::mojom::EventType::KEY_PRESSED | 47 // - |type_matcher.type| = ui::mojom::EventType::KEY_PRESSED |
44 struct EventMatcher { | 48 struct EventMatcher { |
45 // TODO(jamescook): Move this to somewhere accelerator-specific. | 49 // TODO(jamescook): Move this to somewhere accelerator-specific. |
46 ui.mojom.AcceleratorPhase accelerator_phase; | 50 ui.mojom.AcceleratorPhase accelerator_phase; |
47 EventTypeMatcher? type_matcher; | 51 EventTypeMatcher? type_matcher; |
52 EventMultTypeMatcher? types_matcher; | |
sadrul
2016/06/27 14:44:54
Instead of this, it'd be better to use the Pointer
riajiang
2016/06/28 21:52:51
Done.
| |
48 EventFlagsMatcher? flags_matcher; | 53 EventFlagsMatcher? flags_matcher; |
49 // These flags will be stripped from incoming events' flags when comparing | 54 // These flags will be stripped from incoming events' flags when comparing |
50 // against |flags_matcher|. | 55 // against |flags_matcher|. |
51 EventFlagsMatcher? ignore_flags_matcher; | 56 EventFlagsMatcher? ignore_flags_matcher; |
52 KeyEventMatcher? key_matcher; | 57 KeyEventMatcher? key_matcher; |
53 PointerKindMatcher? pointer_kind_matcher; | 58 PointerKindMatcher? pointer_kind_matcher; |
54 PointerLocationMatcher? pointer_location_matcher; | 59 PointerLocationMatcher? pointer_location_matcher; |
55 }; | 60 }; |
OLD | NEW |