diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/mojo/events/BUILD.gn | 1 | ||||
-rw-r--r-- | ui/mojo/events/input_event_matcher.mojom | 48 |
2 files changed, 49 insertions, 0 deletions
diff --git a/ui/mojo/events/BUILD.gn b/ui/mojo/events/BUILD.gn index 1652936..eda7307 100644 --- a/ui/mojo/events/BUILD.gn +++ b/ui/mojo/events/BUILD.gn @@ -7,6 +7,7 @@ import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni") mojom("interfaces") { sources = [ "input_event_constants.mojom", + "input_event_matcher.mojom", "input_events.mojom", "input_key_codes.mojom", ] diff --git a/ui/mojo/events/input_event_matcher.mojom b/ui/mojo/events/input_event_matcher.mojom new file mode 100644 index 0000000..08676d0c --- /dev/null +++ b/ui/mojo/events/input_event_matcher.mojom @@ -0,0 +1,48 @@ +// Copyright 2015 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 "ui/mojo/events/input_event_constants.mojom"; +import "ui/mojo/events/input_key_codes.mojom"; +import "ui/mojo/geometry/geometry.mojom"; + +struct KeyEventMatcher { + KeyboardCode keyboard_code; +}; + +struct PointerKindMatcher { + PointerKind pointer_kind; +}; + +struct PointerLocationMatcher { + RectF region; +}; + +struct EventTypeMatcher { + EventType type; +}; + +struct EventFlagsMatcher { + EventFlags flags; +}; + +// If a specific matcher is missing, then an Event will match this EventMatcher +// (if relevant). For example, if |type_matcher| is missing, then events of all +// types will match this EventMatcher. Similarly, if |key_matcher| is missing, +// then all key-events will match. +// An example matcher to match the Ctrl+A accelerator would be: +// - |type_matcher.type| = mojo::EVENT_TYPE_KEY_PRESSED +// - |flags_matcher.flags| = mojo::EVENT_FLAGS_CONTROL_DOWN +// - |key_matcher.keyboard_code| = mojo::KEYBOARD_CODE_A +// +// A matcher to match any key-press event would be: +// - |type_matcher.type| = mojo::EVENT_TYPE_KEY_PRESSED +struct EventMatcher { + EventTypeMatcher? type_matcher; + EventFlagsMatcher? flags_matcher; + KeyEventMatcher? key_matcher; + PointerKindMatcher? pointer_kind_matcher; + PointerLocationMatcher? pointer_location_matcher; +}; |