Mir
default_input_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015-2016 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 Platform;
39 class InputEventHandlerRegister;
40 class InputDeviceRegistry;
41 
43 {
44 public:
46  std::shared_ptr<dispatch::MultiplexingDispatchable> const& multiplexer,
47  std::shared_ptr<Platform> const& platform);
49 
50  void start() override;
51  void stop() override;
52 private:
53  // TODO Remove add_platform() when we next break mirserver ABI
54  // when we do that we can also convert platforms to a std::shared_ptr<Platform> const
55  // and simplify start_platforms() & stop_platforms()
56  void add_platform(std::shared_ptr<Platform> const& platform) override;
57 
58  void start_platforms();
59  void stop_platforms();
60  std::vector<std::shared_ptr<Platform>> platforms;
61  std::shared_ptr<dispatch::MultiplexingDispatchable> const multiplexer;
62  std::shared_ptr<dispatch::ActionQueue> const queue;
63  std::unique_ptr<dispatch::ThreadedDispatcher> input_thread;
64 
65  enum class State
66  {
67  started,
68  stopped,
69  starting,
70  stopping
71  };
72  std::atomic<State> state;
73 };
74 
75 }
76 }
77 #endif
All things Mir.
Definition: atomic_callback.h:25
Definition: input_manager.h:32
std::promise< bool > stop
Definition: in.cpp:28
Definition: default_input_manager.h:42

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016