Mir
default_input_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 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: Andreas Pokorny <andreas.pokorny@canonical.com>
17  */
18 
19 #ifndef MIR_INPUT_DEFAULT_INPUT_MANAGER_H_
20 #define MIR_INPUT_DEFAULT_INPUT_MANAGER_H_
21 
23 
24 #include <vector>
25 #include <thread>
26 #include <atomic>
27 
28 namespace mir
29 {
30 namespace dispatch
31 {
32 class MultiplexingDispatchable;
33 class ThreadedDispatcher;
34 class ActionQueue;
35 }
36 namespace input
37 {
38 class LegacyInputDispatchable;
39 class Platform;
40 class InputEventHandlerRegister;
41 class InputDeviceRegistry;
42 
44 {
45 public:
46  DefaultInputManager(std::shared_ptr<dispatch::MultiplexingDispatchable> const& multiplexer,
47  std::shared_ptr<LegacyInputDispatchable> const& legacy_dispatchable);
49  void add_platform(std::shared_ptr<Platform> const& platform) override;
50  void start() override;
51  void stop() override;
52 private:
53  void start_platforms();
54  void stop_platforms();
55  std::vector<std::shared_ptr<Platform>> platforms;
56  std::shared_ptr<dispatch::MultiplexingDispatchable> const multiplexer;
57  std::shared_ptr<input::LegacyInputDispatchable> const legacy_dispatchable;
58  std::shared_ptr<dispatch::ActionQueue> const queue;
59  std::unique_ptr<dispatch::ThreadedDispatcher> input_thread;
60 
61  enum class State
62  {
63  started,
64  stopped,
65  starting,
66  stopping
67  };
68  std::atomic<State> state;
69 };
70 
71 }
72 }
73 #endif
All things Mir.
Definition: atomic_callback.h:25
void stop() override
Definition: default_input_manager.cpp:122
DefaultInputManager(std::shared_ptr< dispatch::MultiplexingDispatchable > const &multiplexer, std::shared_ptr< LegacyInputDispatchable > const &legacy_dispatchable)
Definition: default_input_manager.cpp:38
~DefaultInputManager()
Definition: default_input_manager.cpp:44
void start() override
Definition: default_input_manager.cpp:70
Definition: input_manager.h:32
void add_platform(std::shared_ptr< Platform > const &platform) override
Definition: default_input_manager.cpp:49
Definition: default_input_manager.h:43

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015