• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H
18 #define _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H
19 
20 #include <optional>
21 
22 namespace android::inputdispatcher {
23 
24 /* Specifies which events are to be canceled and why. */
25 struct CancelationOptions {
26     enum Mode {
27         CANCEL_ALL_EVENTS = 0,
28         CANCEL_POINTER_EVENTS = 1,
29         CANCEL_NON_POINTER_EVENTS = 2,
30         CANCEL_FALLBACK_EVENTS = 3,
31     };
32 
33     // The criterion to use to determine which events should be canceled.
34     Mode mode;
35 
36     // Descriptive reason for the cancelation.
37     const char* reason;
38 
39     // The specific keycode of the key event to cancel, or nullopt to cancel any key event.
40     std::optional<int32_t> keyCode = std::nullopt;
41 
42     // The specific device id of events to cancel, or nullopt to cancel events from any device.
43     std::optional<int32_t> deviceId = std::nullopt;
44 
45     // The specific display id of events to cancel, or nullopt to cancel events on any display.
46     std::optional<int32_t> displayId = std::nullopt;
47 
CancelationOptionsCancelationOptions48     CancelationOptions(Mode mode, const char* reason) : mode(mode), reason(reason) {}
49 };
50 
51 } // namespace android::inputdispatcher
52 
53 #endif // _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H
54