Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: components/mus/public/cpp/lib/event_matcher.cc

Issue 1559163002: Clean up event flags a bit: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.h"
6 6
7 namespace mus { 7 namespace mus {
8 8
9 mojom::EventMatcherPtr CreateKeyMatcher(mojom::KeyboardCode code, 9 mojom::EventMatcherPtr CreateKeyMatcher(mojom::KeyboardCode code,
10 mojom::EventFlags flags) { 10 mojom::EventFlags flags) {
11 mojom::EventMatcherPtr matcher(mojom::EventMatcher::New()); 11 mojom::EventMatcherPtr matcher(mojom::EventMatcher::New());
12 matcher->type_matcher = mojom::EventTypeMatcher::New(); 12 matcher->type_matcher = mojom::EventTypeMatcher::New();
13 matcher->flags_matcher = mojom::EventFlagsMatcher::New(); 13 matcher->flags_matcher = mojom::EventFlagsMatcher::New();
14 matcher->ignore_flags_matcher = mojom::EventFlagsMatcher::New(); 14 matcher->ignore_flags_matcher = mojom::EventFlagsMatcher::New();
15 // Ignoring these makes most accelerator scenarios more straight forward. Code 15 // Ignoring these makes most accelerator scenarios more straight forward. Code
16 // that needs to check them can override this setting. 16 // that needs to check them can override this setting.
17 matcher->ignore_flags_matcher->flags = 17 matcher->ignore_flags_matcher->flags =
18 static_cast<mojom::EventFlags>(mojom::EVENT_FLAGS_CAPS_LOCK_DOWN | 18 static_cast<mojom::EventFlags>(mojom::EVENT_FLAGS_NUM_LOCK_ON |
19 mojom::EVENT_FLAGS_SCROLL_LOCK_DOWN | 19 mojom::EVENT_FLAGS_CAPS_LOCK_ON |
20 mojom::EVENT_FLAGS_NUM_LOCK_DOWN); 20 mojom::EVENT_FLAGS_SCROLL_LOCK_ON);
21 matcher->key_matcher = mojom::KeyEventMatcher::New(); 21 matcher->key_matcher = mojom::KeyEventMatcher::New();
22 22
23 matcher->type_matcher->type = mus::mojom::EVENT_TYPE_KEY_PRESSED; 23 matcher->type_matcher->type = mus::mojom::EVENT_TYPE_KEY_PRESSED;
24 matcher->flags_matcher->flags = flags; 24 matcher->flags_matcher->flags = flags;
25 matcher->key_matcher->keyboard_code = code; 25 matcher->key_matcher->keyboard_code = code;
26 return matcher; 26 return matcher;
27 } 27 }
28 28
29 } // namespace mus 29 } // namespace mus
OLDNEW
« no previous file with comments | « components/exo/wayland/server.cc ('k') | components/mus/public/interfaces/input_event_constants.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698