Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
event_filter_dispatcher_policy.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Robert Carr <robert.carr@canonical.com>
17  */
18 #ifndef MIR_EVENT_FILTER_DISPATCHER_POLICY_H_
19 #define MIR_EVENT_FILTER_DISPATCHER_POLICY_H_
20 
21 #include "mir/input/event_filter.h"
22 
23 #include <InputDispatcher.h>
24 
25 namespace android
26 {
27 class InputEvent;
28 }
29 
30 namespace droidinput = android;
31 
32 namespace mir
33 {
34 namespace input
35 {
36 namespace android
37 {
38 //class EventFilter;
39 
40 class EventFilterDispatcherPolicy : public droidinput::InputDispatcherPolicyInterface
41 {
42 public:
43  EventFilterDispatcherPolicy(std::shared_ptr<EventFilter> const& event_filter, bool key_repeat_enabled);
44  virtual ~EventFilterDispatcherPolicy() {}
45 
46  void notifyConfigurationChanged(nsecs_t when);
47  nsecs_t notifyANR(droidinput::sp<droidinput::InputApplicationHandle> const& inputApplicationHandle,
48  droidinput::sp<droidinput::InputWindowHandle> const& inputWindowHandle);
49  void notifyInputChannelBroken(droidinput::sp<droidinput::InputWindowHandle> const& inputWindowHandle);
50  bool filterInputEvent(const droidinput::InputEvent* input_event,
51  uint32_t policy_flags);
52  void interceptKeyBeforeQueueing(const droidinput::KeyEvent* key_event,
53  uint32_t& policy_flags);
54  void getDispatcherConfiguration(droidinput::InputDispatcherConfiguration* outConfig);
55  bool isKeyRepeatEnabled();
56  void interceptMotionBeforeQueueing(nsecs_t when, uint32_t& policyFlags);
57 
58  nsecs_t interceptKeyBeforeDispatching(droidinput::sp<droidinput::InputWindowHandle> const& inputWindowHandle,
59  droidinput::KeyEvent const* keyEvent, uint32_t policyFlags);
60 
61  bool dispatchUnhandledKey(droidinput::sp<droidinput::InputWindowHandle> const& inputWindowHandle,
62  droidinput::KeyEvent const* keyEvent, uint32_t policyFlags,
63  droidinput::KeyEvent* outFallbackKeyEvent);
64 
65  void notifySwitch(nsecs_t when, int32_t switchCode, int32_t switchValue, uint32_t policyFlags);
66  void pokeUserActivity(nsecs_t eventTime, int32_t eventType);
67  bool checkInjectEventsPermissionNonReentrant(int32_t injectorPid, int32_t injectorUid);
68 
69 protected:
70  EventFilterDispatcherPolicy(const EventFilterDispatcherPolicy&) = delete;
71  EventFilterDispatcherPolicy& operator=(const EventFilterDispatcherPolicy&) = delete;
72 private:
73  std::shared_ptr<EventFilter> event_filter;
74  bool key_repeat_enabled;
75 };
76 
77 }
78 }
79 }
80 
81 #endif // MIR_DUMMY_INPUT_DISPATCHER_POLICY_H_

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Oct 15 00:23:28 UTC 2013