summaryrefslogtreecommitdiffstats
path: root/ui/mojo
diff options
context:
space:
mode:
authorsadrul <sadrul@chromium.org>2015-10-22 14:19:58 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-22 21:20:57 +0000
commite3726ec7b5baa4fe0619aeaeae55ba948f2d8605 (patch)
tree45fe12352d26427adde520d1e9411bca23dceab1 /ui/mojo
parent65ee4346123cb72b9860408dee37c51886281730 (diff)
downloadchromium_src-e3726ec7b5baa4fe0619aeaeae55ba948f2d8605.zip
chromium_src-e3726ec7b5baa4fe0619aeaeae55ba948f2d8605.tar.gz
chromium_src-e3726ec7b5baa4fe0619aeaeae55ba948f2d8605.tar.bz2
mus: Introduce EventMatcher.
EventMatcher: Clients can send an EventMatcher to the server, and associate some command with it. If an input event matches an EventMatcher, then mus sends the event and the associated command back to the client. Update the accelerator handling in mus to use EventMatcher. BUG=546707 Review URL: https://codereview.chromium.org/1420813002 Cr-Commit-Position: refs/heads/master@{#355644}
Diffstat (limited to 'ui/mojo')
-rw-r--r--ui/mojo/events/BUILD.gn1
-rw-r--r--ui/mojo/events/input_event_matcher.mojom48
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;
+};