20 #ifndef MIR_INPUT_ANDROID_DISPATCHER_INPUT_CONFIGURATION_H_
21 #define MIR_INPUT_ANDROID_DISPATCHER_INPUT_CONFIGURATION_H_
27 #include <utils/RefBase.h>
28 #include <utils/StrongPointer.h>
32 namespace droidinput = android;
36 class InputReaderInterface;
37 class InputReaderPolicyInterface;
38 class InputDispatcherPolicyInterface;
39 class InputDispatcherInterface;
40 class EventHubInterface;
59 class WindowHandleRepository;
62 template <
typename Type>
63 class CachedAndroidPtr
65 droidinput::wp<Type> cache;
67 CachedAndroidPtr(CachedAndroidPtr
const&) =
delete;
68 CachedAndroidPtr& operator=(CachedAndroidPtr
const&) =
delete;
71 CachedAndroidPtr() =
default;
73 droidinput::sp<Type> operator()(std::function<droidinput::sp<Type>()> make)
75 auto result = cache.promote();
78 cache = result = make();
84 class DispatcherInputConfiguration :
public input::InputConfiguration
87 DispatcherInputConfiguration(std::shared_ptr<EventFilter>
const& event_filter,
88 std::shared_ptr<input::InputRegion>
const& input_region,
89 std::shared_ptr<CursorListener>
const& cursor_listener,
90 std::shared_ptr<input::InputReport>
const& input_report);
91 virtual ~DispatcherInputConfiguration();
99 virtual bool is_key_repeat_enabled();
102 virtual droidinput::sp<droidinput::InputDispatcherInterface> the_dispatcher() = 0;
104 virtual std::shared_ptr<InputThread> the_dispatcher_thread();
106 virtual droidinput::sp<droidinput::InputDispatcherPolicyInterface> the_dispatcher_policy();
108 std::shared_ptr<WindowHandleRepository> the_window_handle_repository();
110 std::shared_ptr<EventFilter>
const event_filter;
111 std::shared_ptr<input::InputRegion>
const input_region;
112 std::shared_ptr<CursorListener>
const cursor_listener;
113 std::shared_ptr<input::InputReport>
const input_report;
115 CachedPtr<input::InputManager> input_manager;
118 CachedPtr<InputThread> dispatcher_thread;
119 CachedPtr<InputRegistrar> input_registrar;
121 CachedPtr<shell::InputTargeter> input_targeter;
123 CachedAndroidPtr<droidinput::InputDispatcherPolicyInterface> dispatcher_policy;