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