2
* Copyright © 2013-2014 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Robert Carr <robert.carr@canonical.com>
17
Andreas Pokorny <andreas.pokorny@canonical.com>
20
#include "mir/input/android/default_android_input_configuration.h"
21
#include "event_filter_dispatcher_policy.h"
22
#include "android_input_reader_policy.h"
23
#include "android_input_thread.h"
24
#include "android_input_registrar.h"
25
#include "android_input_targeter.h"
26
#include "android_input_target_enumerator.h"
27
#include "android_input_manager.h"
28
#include "input_translator.h"
29
#include "common_input_thread.h"
31
#include "mir/input/event_filter.h"
34
#include <InputDispatcher.h>
36
#include "mir/input/event_filter.h"
39
#include <InputDispatcher.h>
40
#include <InputReader.h>
44
namespace droidinput = android;
46
namespace mi = mir::input;
47
namespace mia = mi::android;
48
namespace ms = mir::scene;
49
namespace msh = mir::shell;
51
mia::DefaultInputConfiguration::DefaultInputConfiguration(
52
std::shared_ptr<mi::InputDispatcher> const& input_dispatcher,
53
std::shared_ptr<mi::InputRegion> const& input_region,
54
std::shared_ptr<CursorListener> const& cursor_listener,
55
std::shared_ptr<TouchVisualizer> const& touch_visualizer,
56
std::shared_ptr<mi::InputReport> const& input_report) :
57
input_dispatcher(input_dispatcher),
58
input_region(input_region),
59
cursor_listener(cursor_listener),
60
touch_visualizer(touch_visualizer),
61
input_report(input_report)
65
mia::DefaultInputConfiguration::~DefaultInputConfiguration()
69
std::shared_ptr<droidinput::EventHubInterface> mia::DefaultInputConfiguration::the_event_hub()
74
return std::make_shared<droidinput::EventHub>(input_report);
78
std::shared_ptr<droidinput::InputReaderPolicyInterface> mia::DefaultInputConfiguration::the_reader_policy()
83
return std::make_shared<mia::InputReaderPolicy>(input_region, cursor_listener, touch_visualizer);
88
std::shared_ptr<droidinput::InputReaderInterface> mia::DefaultInputConfiguration::the_reader()
93
return std::make_shared<droidinput::InputReader>(
94
the_event_hub(), the_reader_policy(), the_input_translator());
98
std::shared_ptr<mia::InputThread> mia::DefaultInputConfiguration::the_reader_thread()
100
return reader_thread(
103
return std::make_shared<CommonInputThread>("Mir/InputReader",
104
new droidinput::InputReaderThread(the_reader()));
108
std::shared_ptr<droidinput::InputListenerInterface> mia::DefaultInputConfiguration::the_input_translator()
110
return std::make_shared<mia::InputTranslator>(input_dispatcher);
113
std::shared_ptr<mi::InputManager> mia::DefaultInputConfiguration::the_input_manager()
115
return input_manager(
116
[this]() -> std::shared_ptr<mi::InputManager>
118
return std::make_shared<mia::InputManager>(
120
the_reader_thread());