Mir

Merge lp:~robertcarr/mir/dedupe-null-input-managers into lp:~mir-team/mir/trunk

Proposed by Robert Carr
Status: Merged
Approved by: Robert Carr
Approved revision: no longer in the source branch.
Merged at revision: 558
Proposed branch: lp:~robertcarr/mir/dedupe-null-input-managers
Merge into: lp:~mir-team/mir/trunk
Diff against target: 142 lines (+61/-32)
4 files modified
examples/render_surfaces.cpp (+2/-16)
include/server/mir/input/null_input_manager.h (+56/-0)
src/server/input/CMakeLists.txt (+1/-1)
src/server/input/null_input_platform.cpp (+2/-15)
To merge this branch: bzr merge lp:~robertcarr/mir/dedupe-null-input-managers
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Daniel van Vugt Needs Information
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+156645@code.launchpad.net

Commit message

Remove duplicate null input manager definitions.

Description of the change

Remove duplicate null input manager definitions.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This does not need to be virtual but it doesn't hurt:
  virtual ~NullInputManager() {}

Also, isn't this server/testing code? If so then the license looks wrong: "GNU Lesser General Public License". It should probably be GPL for pure server components.

review: Needs Information
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> This does not need to be virtual but it doesn't hurt:
> virtual ~NullInputManager() {}

It is virtual regardless of how it is written, but it doesn't need to be written (and could be noexcept).

> Also, isn't this server/testing code? If so then the license looks wrong: "GNU
> Lesser General Public License". It should probably be GPL for pure server
> components.

It is in the server .so, so LGPL is correct.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/render_surfaces.cpp'
2--- examples/render_surfaces.cpp 2013-04-02 09:36:09 +0000
3+++ examples/render_surfaces.cpp 2013-04-02 19:32:21 +0000
4@@ -23,7 +23,7 @@
5 #include "mir/geometry/size.h"
6 #include "mir/graphics/buffer_initializer.h"
7 #include "mir/graphics/display.h"
8-#include "mir/input/input_manager.h"
9+#include "mir/input/null_input_manager.h"
10 #include "mir/shell/surface_builder.h"
11 #include "mir/surfaces/surface.h"
12 #include "mir/default_server_configuration.h"
13@@ -380,20 +380,6 @@
14 // Stub out input.
15 std::shared_ptr<mi::InputManager> RenderSurfacesServerConfiguration::the_input_manager()
16 {
17- struct NullInputManager : public mi::InputManager
18- {
19- void start() {}
20- void stop() {}
21- std::shared_ptr<mi::InputChannel> make_input_channel()
22- {
23- return std::shared_ptr<mi::InputChannel>();
24- }
25- void set_input_focus_to(std::shared_ptr<mi::SessionTarget> const& /* session */,
26- std::shared_ptr<mi::SurfaceTarget> const& /* surface */)
27- {
28- }
29- };
30-
31- return std::make_shared<NullInputManager>();
32+ return std::make_shared<mi::NullInputManager>();
33 }
34 ///\internal [NullInputManager_tag]
35
36=== added file 'include/server/mir/input/null_input_manager.h'
37--- include/server/mir/input/null_input_manager.h 1970-01-01 00:00:00 +0000
38+++ include/server/mir/input/null_input_manager.h 2013-04-02 19:32:21 +0000
39@@ -0,0 +1,56 @@
40+/*
41+ * Copyright © 2013 Canonical Ltd.
42+ *
43+ * This program is free software: you can redistribute it and/or modify it
44+ * under the terms of the GNU Lesser General Public License version 3,
45+ * as published by the Free Software Foundation.
46+ *
47+ * This program is distributed in the hope that it will be useful,
48+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
49+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+ * GNU General Public License for more details.
51+ *
52+ * You should have received a copy of the GNU Lesser General Public License
53+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
54+ *
55+ * Authored by: Robert Carr <robert.carr@canonical.com>
56+ */
57+
58+#ifndef MIR_INPUT_NULL_INPUT_MANAGER_H_
59+#define MIR_INPUT_NULL_INPUT_MANAGER_H_
60+
61+#include "mir/input/input_manager.h"
62+
63+namespace mir
64+{
65+namespace input
66+{
67+
68+class NullInputManager : public InputManager
69+{
70+public:
71+ NullInputManager() {};
72+ virtual ~NullInputManager() {}
73+
74+ void start() {}
75+ void stop() {}
76+
77+ std::shared_ptr<InputChannel> make_input_channel()
78+ {
79+ return std::shared_ptr<InputChannel>();
80+ }
81+
82+ virtual void set_input_focus_to(std::shared_ptr<input::SessionTarget> const& /* session */,
83+ std::shared_ptr<input::SurfaceTarget> const& /* surface */)
84+ {
85+ }
86+
87+protected:
88+ NullInputManager(const NullInputManager&) = delete;
89+ NullInputManager& operator=(const NullInputManager&) = delete;
90+};
91+
92+}
93+}
94+
95+#endif // MIR_INPUT_NULL_INPUT_MANAGER
96
97=== modified file 'src/server/input/CMakeLists.txt'
98--- src/server/input/CMakeLists.txt 2013-03-13 04:54:15 +0000
99+++ src/server/input/CMakeLists.txt 2013-04-02 19:32:21 +0000
100@@ -9,7 +9,7 @@
101 else()
102 list(
103 APPEND INPUT_SOURCES
104- dummy_input_manager.cpp
105+ null_input_platform.cpp
106 )
107 endif()
108
109
110=== renamed file 'src/server/input/dummy_input_manager.cpp' => 'src/server/input/null_input_platform.cpp'
111--- src/server/input/dummy_input_manager.cpp 2013-03-29 16:51:35 +0000
112+++ src/server/input/null_input_platform.cpp 2013-04-02 19:32:21 +0000
113@@ -16,27 +16,14 @@
114 * Authored by: Alan Griffiths <alan@octopull.co.uk>
115 */
116
117-#include "mir/input/input_manager.h"
118+#include "mir/input/null_input_manager.h"
119
120 namespace mg = mir::graphics;
121 namespace mi = mir::input;
122
123-namespace
124-{
125-class DummyInputManager : public mi::InputManager
126-{
127- void stop() {}
128- void start() {}
129- virtual std::shared_ptr<mi::InputChannel> make_input_channel() { return std::shared_ptr<mi::InputChannel>(); }
130- void set_input_focus_to(std::shared_ptr<mi::SessionTarget> const& /* session */, std::shared_ptr<mi::SurfaceTarget> const& /* surface */)
131- {
132- }
133-};
134-}
135-
136 std::shared_ptr<mi::InputManager> mi::create_input_manager(
137 const std::initializer_list<std::shared_ptr<mi::EventFilter> const>& ,
138 std::shared_ptr<mg::ViewableArea> const& )
139 {
140- return std::make_shared<DummyInputManager>();
141+ return std::make_shared<mi::NullInputManager>();
142 }

Subscribers

People subscribed via source and target branches