blob: eeafcac04822ce3a769b5bbb07538d8446bc7bff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// 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.
#include "components/mus/public/cpp/event_matcher.h"
namespace mus {
mojom::EventMatcherPtr CreateKeyMatcher(mojom::KeyboardCode code, int flags) {
mojom::EventMatcherPtr matcher(mojom::EventMatcher::New());
matcher->type_matcher = mojom::EventTypeMatcher::New();
matcher->flags_matcher = mojom::EventFlagsMatcher::New();
matcher->ignore_flags_matcher = mojom::EventFlagsMatcher::New();
// Ignoring these makes most accelerator scenarios more straight forward. Code
// that needs to check them can override this setting.
matcher->ignore_flags_matcher->flags = mojom::kEventFlagCapsLockOn |
mojom::kEventFlagScrollLockOn |
mojom::kEventFlagNumLockOn;
matcher->key_matcher = mojom::KeyEventMatcher::New();
matcher->type_matcher->type = mus::mojom::EventType::KEY_PRESSED;
matcher->flags_matcher->flags = flags;
matcher->key_matcher->keyboard_code = code;
return matcher;
}
} // namespace mus
|