Merge lp:~andreas-pokorny/mir/07-csdi-rpc-for-setting-input-device-configurations into lp:mir
- 07-csdi-rpc-for-setting-input-device-configurations
- Merge into development-branch
Status: | Work in progress |
---|---|
Proposed branch: | lp:~andreas-pokorny/mir/07-csdi-rpc-for-setting-input-device-configurations |
Merge into: | lp:mir |
Prerequisite: | lp:~andreas-pokorny/mir/06-csdi-client-api-for-input-device-settings |
Diff against target: |
1066 lines (+419/-20) 46 files modified
include/client/mir_toolkit/mir_connection.h (+14/-0) include/server/mir/frontend/session_mediator_observer.h (+2/-0) include/server/mir/input/input_device_hub.h (+1/-0) include/test/mir/test/doubles/mock_input_device_hub.h (+1/-1) src/client/logging/rpc_report.cpp (+14/-3) src/client/logging/rpc_report.h (+1/-0) src/client/lttng/rpc_report.cpp (+4/-0) src/client/lttng/rpc_report.h (+1/-0) src/client/mir_connection.cpp (+12/-0) src/client/mir_connection.h (+1/-0) src/client/mir_connection_api.cpp (+16/-1) src/client/rpc/mir_display_server.cpp (+7/-0) src/client/rpc/mir_display_server.h (+4/-0) src/client/rpc/mir_protobuf_rpc_channel.cpp (+1/-0) src/client/rpc/null_rpc_report.cpp (+5/-0) src/client/rpc/null_rpc_report.h (+1/-1) src/client/rpc/rpc_report.h (+2/-0) src/client/symbols.map (+1/-0) src/include/common/mir/protobuf/display_server.h (+4/-0) src/protobuf/mir_protobuf.proto (+6/-0) src/protobuf/symbols.map (+25/-9) src/server/frontend/protobuf_input_converter.cpp (+29/-0) src/server/frontend/protobuf_input_converter.h (+2/-0) src/server/frontend/protobuf_message_processor.cpp (+4/-0) src/server/frontend/session_mediator.cpp (+22/-0) src/server/frontend/session_mediator.h (+4/-0) src/server/frontend/session_mediator_observer_multiplexer.cpp (+7/-0) src/server/frontend/session_mediator_observer_multiplexer.h (+2/-0) src/server/input/default_device.cpp (+15/-2) src/server/input/default_device.h (+7/-0) src/server/input/default_input_device_hub.cpp (+73/-1) src/server/input/default_input_device_hub.h (+6/-0) src/server/report/logging/session_mediator_report.cpp (+5/-0) src/server/report/logging/session_mediator_report.h (+2/-0) src/server/report/lttng/session_mediator_report.cpp (+1/-0) src/server/report/lttng/session_mediator_report.h (+1/-0) src/server/report/lttng/session_mediator_report_tp.h (+1/-0) src/server/report/null/session_mediator_report.cpp (+4/-0) src/server/report/null/session_mediator_report.h (+2/-0) tests/acceptance-tests/test_client_input.cpp (+36/-2) tests/acceptance-tests/test_nested_mir.cpp (+1/-0) tests/acceptance-tests/test_session_mediator_report.cpp (+1/-0) tests/include/mir/test/doubles/mock_rpc_report.h (+4/-0) tests/include/mir/test/doubles/stub_display_server.h (+5/-0) tests/include/mir/test/stub_server_tool.h (+8/-0) tests/unit-tests/input/test_default_input_device_hub.cpp (+54/-0) |
To merge this branch: | bzr merge lp:~andreas-pokorny/mir/07-csdi-rpc-for-setting-input-device-configurations |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Mir development team | Pending | ||
Review via email: mp+310640@code.launchpad.net |
Commit message
Add client server RPC code to apply input device changes done by a client
This change adds code to transport input device configurations from clients back to the server, using a new rpc. On the server side the changed configuration is forwarded to the respective input device.
Description of the change
This change adds RPC to apply configuration changes of a single device.
So the process for a client would be to get the current configuration of all devices, search for relevant devices. Inspect and update the retrieved configuration, and then apply the configuration of the devices that should be changed.
The following has been left out - and is to be added with upcoming MPs
* Forwardng configuration changes through nested
* Allowing the shell to filter or deny configuration changes..
Not considered by this API yet:
* Storing configuration changes inside sessions, and applying those on session switch - I do not see a use case for that, I think nested platforms and uss are usually the main users of that API
* Letting clients configure the keymap that should be used for each keyboard
Mir CI Bot (mir-ci-bot) wrote : | # |
- 3801. By Andreas Pokorny
-
merge lp:mir
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3801
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 3802. By Andreas Pokorny
-
release input device config in test case
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3802
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 3803. By Andreas Pokorny
-
merge prereq
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3803
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3803
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 3804. By Andreas Pokorny
-
merge lp:mir and adapt to observer reports
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3804
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Andreas Pokorny (andreas-pokorny) wrote : | # |
Ok I have to rework the way configuration is stored inside the server -
I think that will make me revisit the RPC again.. so back to WIP
Unmerged revisions
- 3804. By Andreas Pokorny
-
merge lp:mir and adapt to observer reports
- 3803. By Andreas Pokorny
-
merge prereq
- 3802. By Andreas Pokorny
-
release input device config in test case
- 3801. By Andreas Pokorny
-
merge lp:mir
- 3800. By Andreas Pokorny
-
merge prereq
- 3799. By Andreas Pokorny
-
update prereq
- 3798. By Andreas Pokorny
-
get changes from lp:mir
- 3797. By Andreas Pokorny
-
use rpc channel
- 3796. By Andreas Pokorny
-
Extend RPC Report
- 3795. By Andreas Pokorny
-
more reports
Preview Diff
1 | === modified file 'include/client/mir_toolkit/mir_connection.h' |
2 | --- include/client/mir_toolkit/mir_connection.h 2016-10-12 06:03:15 +0000 |
3 | +++ include/client/mir_toolkit/mir_connection.h 2016-11-18 09:52:03 +0000 |
4 | @@ -360,6 +360,20 @@ |
5 | MirInputConfig* mir_connection_create_input_config(MirConnection *connection); |
6 | |
7 | /** |
8 | + * Apply the input configuration for a device |
9 | + * |
10 | + * Configure the behavior of input device attached to a server. This does not |
11 | + * only affect the input device when events are dispatched to surfaces of this |
12 | + * connection, but the behavior of the devices in general. |
13 | + * |
14 | + * \warning This request may be denied. Check that the request succeeded with mir_connection_get_error_message. |
15 | + * \param [in] connection The connection |
16 | + * \param [in] device The input device |
17 | + */ |
18 | +void mir_connection_apply_input_device_configuration( |
19 | + MirConnection* connection, MirInputDevice const* device); |
20 | + |
21 | +/** |
22 | * Release this snapshot of the input configuration. |
23 | * This invalidates any pointers retrieved from this structure. |
24 | * |
25 | |
26 | === modified file 'include/server/mir/frontend/session_mediator_observer.h' |
27 | --- include/server/mir/frontend/session_mediator_observer.h 2016-11-02 05:07:18 +0000 |
28 | +++ include/server/mir/frontend/session_mediator_observer.h 2016-11-18 09:52:03 +0000 |
29 | @@ -72,6 +72,8 @@ |
30 | std::string const& app_name, |
31 | char const* method, |
32 | std::string const& what) = 0; |
33 | + |
34 | + virtual void session_apply_input_device_configuration_called(std::string const& app_name) = 0; |
35 | }; |
36 | |
37 | } |
38 | |
39 | === modified file 'include/server/mir/input/input_device_hub.h' |
40 | --- include/server/mir/input/input_device_hub.h 2016-07-18 07:38:38 +0000 |
41 | +++ include/server/mir/input/input_device_hub.h 2016-11-18 09:52:03 +0000 |
42 | @@ -38,6 +38,7 @@ |
43 | virtual void add_observer(std::shared_ptr<InputDeviceObserver> const&) = 0; |
44 | virtual void remove_observer(std::weak_ptr<InputDeviceObserver> const&) = 0; |
45 | virtual void for_each_input_device(std::function<void(Device const& device)> const& callback) = 0; |
46 | + virtual void for_each_mutable_input_device(std::function<void(Device& device)> const& callback) = 0; |
47 | |
48 | InputDeviceHub(InputDeviceHub const&) = delete; |
49 | InputDeviceHub& operator=(InputDeviceHub const&) = delete; |
50 | |
51 | === modified file 'include/test/mir/test/doubles/mock_input_device_hub.h' |
52 | --- include/test/mir/test/doubles/mock_input_device_hub.h 2016-07-18 07:38:38 +0000 |
53 | +++ include/test/mir/test/doubles/mock_input_device_hub.h 2016-11-18 09:52:03 +0000 |
54 | @@ -33,7 +33,7 @@ |
55 | MOCK_METHOD1(add_observer, void(std::shared_ptr<input::InputDeviceObserver> const&)); |
56 | MOCK_METHOD1(remove_observer, void(std::weak_ptr<input::InputDeviceObserver> const&)); |
57 | MOCK_METHOD1(for_each_input_device, void(std::function<void(input::Device const&)> const&)); |
58 | - |
59 | + MOCK_METHOD1(for_each_mutable_input_device, void(std::function<void(input::Device&)> const&)); |
60 | }; |
61 | |
62 | } |
63 | |
64 | === modified file 'src/client/logging/rpc_report.cpp' |
65 | --- src/client/logging/rpc_report.cpp 2016-07-20 04:54:07 +0000 |
66 | +++ src/client/logging/rpc_report.cpp 2016-11-18 09:52:03 +0000 |
67 | @@ -19,8 +19,10 @@ |
68 | #include "rpc_report.h" |
69 | |
70 | #include "mir/logging/logger.h" |
71 | +#include "mir/event_printer.h" |
72 | |
73 | #include "mir_protobuf_wire.pb.h" |
74 | +#include "mir_protobuf.pb.h" |
75 | |
76 | #include <boost/exception/diagnostic_information.hpp> |
77 | #include <sstream> |
78 | @@ -89,11 +91,10 @@ |
79 | } |
80 | |
81 | void mcll::RpcReport::event_parsing_succeeded( |
82 | - MirEvent const& /*event*/) |
83 | + MirEvent const& event) |
84 | { |
85 | std::stringstream ss; |
86 | - /* TODO: Log more information about event */ |
87 | - ss << "Event parsed"; |
88 | + ss << "Event parsed : " << event; |
89 | |
90 | logger->log(ml::Severity::debug, ss.str(), component); |
91 | } |
92 | @@ -147,3 +148,13 @@ |
93 | |
94 | logger->log(ml::Severity::debug, ss.str(), component); |
95 | } |
96 | + |
97 | +void mcll::RpcReport::input_device_configuration_received(mir::protobuf::InputDevices const& event) |
98 | +{ |
99 | + std::stringstream ss; |
100 | + ss << "Input device information received: "; |
101 | + for (auto info : event.device_info()) |
102 | + ss << info.id() << ":" << info.name() << " "; |
103 | + |
104 | + logger->log(ml::Severity::debug, ss.str(), component); |
105 | +} |
106 | |
107 | === modified file 'src/client/logging/rpc_report.h' |
108 | --- src/client/logging/rpc_report.h 2016-01-29 08:18:22 +0000 |
109 | +++ src/client/logging/rpc_report.h 2016-11-18 09:52:03 +0000 |
110 | @@ -61,6 +61,7 @@ |
111 | void file_descriptors_received(google::protobuf::MessageLite const& response, |
112 | std::vector<Fd> const& fds) override; |
113 | |
114 | + void input_device_configuration_received(mir::protobuf::InputDevices const& event) override; |
115 | private: |
116 | std::shared_ptr<mir::logging::Logger> const logger; |
117 | }; |
118 | |
119 | === modified file 'src/client/lttng/rpc_report.cpp' |
120 | --- src/client/lttng/rpc_report.cpp 2016-01-29 08:18:22 +0000 |
121 | +++ src/client/lttng/rpc_report.cpp 2016-11-18 09:52:03 +0000 |
122 | @@ -99,3 +99,7 @@ |
123 | mir_tracepoint(mir_client_rpc, file_descriptors_received, |
124 | handles.get(), fds.size()); |
125 | } |
126 | + |
127 | +void mcl::lttng::RpcReport::input_device_configuration_received(mir::protobuf::InputDevices const& /*event*/) |
128 | +{ |
129 | +} |
130 | |
131 | === modified file 'src/client/lttng/rpc_report.h' |
132 | --- src/client/lttng/rpc_report.h 2016-01-29 08:18:22 +0000 |
133 | +++ src/client/lttng/rpc_report.h 2016-11-18 09:52:03 +0000 |
134 | @@ -52,6 +52,7 @@ |
135 | void file_descriptors_received(google::protobuf::MessageLite const& response, |
136 | std::vector<Fd> const& fds) override; |
137 | |
138 | + void input_device_configuration_received(mir::protobuf::InputDevices const& event) override; |
139 | private: |
140 | ClientTracepointProvider tp_provider; |
141 | }; |
142 | |
143 | === modified file 'src/client/mir_connection.cpp' |
144 | --- src/client/mir_connection.cpp 2016-11-15 20:53:57 +0000 |
145 | +++ src/client/mir_connection.cpp 2016-11-18 09:52:03 +0000 |
146 | @@ -1320,3 +1320,15 @@ |
147 | BOOST_THROW_EXCEPTION(std::invalid_argument("cannot query extensions before connecting to server")); |
148 | return platform->request_interface(name, version); |
149 | } |
150 | + |
151 | +void MirConnection::apply_input_device_configuration(mp::InputDeviceInfo const* device_info) |
152 | +{ |
153 | + mp::InputDeviceSetting setting; |
154 | + setting.set_id(device_info->id()); |
155 | + if (device_info->has_pointer_configuration()) |
156 | + *setting.mutable_pointer_configuration() = device_info->pointer_configuration(); |
157 | + if (device_info->has_touchpad_configuration()) |
158 | + *setting.mutable_touchpad_configuration() = device_info->touchpad_configuration(); |
159 | + |
160 | + server.apply_input_device_configuration(&setting, ignored.get(), gp::NewCallback(ignore)); |
161 | +} |
162 | |
163 | === modified file 'src/client/mir_connection.h' |
164 | --- src/client/mir_connection.h 2016-11-14 00:28:49 +0000 |
165 | +++ src/client/mir_connection.h 2016-11-18 09:52:03 +0000 |
166 | @@ -182,6 +182,7 @@ |
167 | void done_display_configure(); |
168 | |
169 | MirWaitHandle* set_base_display_configuration(MirDisplayConfiguration const* configuration); |
170 | + void apply_input_device_configuration(mir::protobuf::InputDeviceInfo const* config); |
171 | void preview_base_display_configuration( |
172 | mir::protobuf::DisplayConfiguration const& configuration, |
173 | std::chrono::seconds timeout); |
174 | |
175 | === modified file 'src/client/mir_connection_api.cpp' |
176 | --- src/client/mir_connection_api.cpp 2016-10-28 22:28:15 +0000 |
177 | +++ src/client/mir_connection_api.cpp 2016-11-18 09:52:03 +0000 |
178 | @@ -312,12 +312,28 @@ |
179 | MirConnection* connection, |
180 | mir_input_config_callback callback, |
181 | void* context) |
182 | +try |
183 | { |
184 | if (!connection) |
185 | return; |
186 | auto devices = connection->the_input_devices(); |
187 | devices->set_change_callback([connection, context, callback]{callback(connection, context);}); |
188 | } |
189 | +catch (std::exception const& ex) |
190 | +{ |
191 | + MIR_LOG_UNCAUGHT_EXCEPTION(ex); |
192 | +} |
193 | + |
194 | +void mir_connection_apply_input_device_configuration(MirConnection* connection, MirInputDevice const* config) try |
195 | +{ |
196 | + if (!connection) |
197 | + return; |
198 | + connection->apply_input_device_configuration(reinterpret_cast<mp::InputDeviceInfo const*>(config)); |
199 | +} |
200 | +catch (std::exception const& ex) |
201 | +{ |
202 | + MIR_LOG_UNCAUGHT_EXCEPTION(ex); |
203 | +} |
204 | |
205 | void mir_input_config_destroy(MirInputConfig const* config) |
206 | { |
207 | @@ -430,4 +446,3 @@ |
208 | MIR_LOG_UNCAUGHT_EXCEPTION(ex); |
209 | } |
210 | } |
211 | - |
212 | |
213 | === modified file 'src/client/rpc/mir_display_server.cpp' |
214 | --- src/client/rpc/mir_display_server.cpp 2016-10-12 06:03:15 +0000 |
215 | +++ src/client/rpc/mir_display_server.cpp 2016-11-18 09:52:03 +0000 |
216 | @@ -224,3 +224,10 @@ |
217 | { |
218 | channel->call_method(std::string(__func__), request, response, done); |
219 | } |
220 | +void mclr::DisplayServer::apply_input_device_configuration( |
221 | + mir::protobuf::InputDeviceSetting const* request, |
222 | + mir::protobuf::Void* response, |
223 | + google::protobuf::Closure* done) |
224 | +{ |
225 | + channel->call_method(std::string(__func__), request, response, done); |
226 | +} |
227 | |
228 | === modified file 'src/client/rpc/mir_display_server.h' |
229 | --- src/client/rpc/mir_display_server.h 2016-10-12 06:03:15 +0000 |
230 | +++ src/client/rpc/mir_display_server.h 2016-11-18 09:52:03 +0000 |
231 | @@ -147,6 +147,10 @@ |
232 | mir::protobuf::RaiseRequest const* request, |
233 | mir::protobuf::Void* response, |
234 | google::protobuf::Closure* done) override; |
235 | + virtual void apply_input_device_configuration( |
236 | + mir::protobuf::InputDeviceSetting const* request, |
237 | + mir::protobuf::Void* response, |
238 | + google::protobuf::Closure* done) override; |
239 | private: |
240 | std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> const channel; |
241 | }; |
242 | |
243 | === modified file 'src/client/rpc/mir_protobuf_rpc_channel.cpp' |
244 | --- src/client/rpc/mir_protobuf_rpc_channel.cpp 2016-11-15 20:53:57 +0000 |
245 | +++ src/client/rpc/mir_protobuf_rpc_channel.cpp 2016-11-18 09:52:03 +0000 |
246 | @@ -271,6 +271,7 @@ |
247 | |
248 | if (seq.has_input_devices()) |
249 | { |
250 | + rpc_report->input_device_configuration_received(seq.input_devices()); |
251 | input_devices->update_devices(seq.input_devices()); |
252 | } |
253 | |
254 | |
255 | === modified file 'src/client/rpc/null_rpc_report.cpp' |
256 | --- src/client/rpc/null_rpc_report.cpp 2016-01-29 08:18:22 +0000 |
257 | +++ src/client/rpc/null_rpc_report.cpp 2016-11-18 09:52:03 +0000 |
258 | @@ -79,3 +79,8 @@ |
259 | std::vector<mir::Fd> const& /*fds*/) |
260 | { |
261 | } |
262 | + |
263 | +void mclr::NullRpcReport::input_device_configuration_received( |
264 | + mir::protobuf::InputDevices const& /*event*/) |
265 | +{ |
266 | +} |
267 | |
268 | === modified file 'src/client/rpc/null_rpc_report.h' |
269 | --- src/client/rpc/null_rpc_report.h 2016-01-29 08:18:22 +0000 |
270 | +++ src/client/rpc/null_rpc_report.h 2016-11-18 09:52:03 +0000 |
271 | @@ -50,8 +50,8 @@ |
272 | |
273 | void file_descriptors_received(google::protobuf::MessageLite const& response, |
274 | std::vector<Fd> const& fds) override; |
275 | + void input_device_configuration_received(mir::protobuf::InputDevices const& event) override; |
276 | }; |
277 | - |
278 | } |
279 | } |
280 | } |
281 | |
282 | === modified file 'src/client/rpc/rpc_report.h' |
283 | --- src/client/rpc/rpc_report.h 2016-01-29 08:18:22 +0000 |
284 | +++ src/client/rpc/rpc_report.h 2016-11-18 09:52:03 +0000 |
285 | @@ -38,6 +38,7 @@ |
286 | namespace protobuf |
287 | { |
288 | class Event; |
289 | +class InputDevices; |
290 | |
291 | namespace wire |
292 | { |
293 | @@ -75,6 +76,7 @@ |
294 | virtual void file_descriptors_received(google::protobuf::MessageLite const& response, |
295 | std::vector<mir::Fd> const& fds) = 0; |
296 | |
297 | + virtual void input_device_configuration_received(mir::protobuf::InputDevices const& event) = 0; |
298 | protected: |
299 | RpcReport() = default; |
300 | RpcReport(RpcReport const&) = delete; |
301 | |
302 | === modified file 'src/client/symbols.map' |
303 | --- src/client/symbols.map 2016-11-17 08:45:49 +0000 |
304 | +++ src/client/symbols.map 2016-11-18 09:52:03 +0000 |
305 | @@ -467,6 +467,7 @@ |
306 | |
307 | MIR_CLIENT_0.26 { # New functions in Mir 0.26 |
308 | global: |
309 | + mir_connection_apply_input_device_configuration; |
310 | mir_input_device_get_mutable_pointer_configuration; |
311 | mir_input_device_get_mutable_touchpad_configuration; |
312 | mir_input_device_get_pointer_configuration; |
313 | |
314 | === modified file 'src/include/common/mir/protobuf/display_server.h' |
315 | --- src/include/common/mir/protobuf/display_server.h 2016-10-12 06:03:15 +0000 |
316 | +++ src/include/common/mir/protobuf/display_server.h 2016-11-18 09:52:03 +0000 |
317 | @@ -143,6 +143,10 @@ |
318 | mir::protobuf::RaiseRequest const* request, |
319 | mir::protobuf::Void* response, |
320 | google::protobuf::Closure* done) = 0; |
321 | + virtual void apply_input_device_configuration( |
322 | + mir::protobuf::InputDeviceSetting const* request, |
323 | + mir::protobuf::Void* response, |
324 | + google::protobuf::Closure* done) = 0; |
325 | |
326 | protected: |
327 | DisplayServer() = default; |
328 | |
329 | === modified file 'src/protobuf/mir_protobuf.proto' |
330 | --- src/protobuf/mir_protobuf.proto 2016-11-15 20:53:57 +0000 |
331 | +++ src/protobuf/mir_protobuf.proto 2016-11-18 09:52:03 +0000 |
332 | @@ -430,6 +430,12 @@ |
333 | optional TouchpadConfiguration touchpad_configuration = 6; |
334 | } |
335 | |
336 | +message InputDeviceSetting { |
337 | + optional int64 id = 1; |
338 | + optional PointerConfiguration pointer_configuration = 2; |
339 | + optional TouchpadConfiguration touchpad_configuration = 3; |
340 | +} |
341 | + |
342 | message PointerConfiguration { |
343 | optional uint32 handedness = 1; |
344 | optional uint32 acceleration = 2; |
345 | |
346 | === modified file 'src/protobuf/symbols.map' |
347 | --- src/protobuf/symbols.map 2016-11-11 11:23:52 +0000 |
348 | +++ src/protobuf/symbols.map 2016-11-18 09:52:03 +0000 |
349 | @@ -1047,26 +1047,42 @@ |
350 | MIR_PROTOBUF_0.26 { |
351 | global: |
352 | extern "C++" { |
353 | + mir::protobuf::InputDeviceConfiguration::?InputDeviceConfiguration*; |
354 | + mir::protobuf::InputDeviceConfiguration::CopyFrom*; |
355 | + mir::protobuf::InputDeviceConfiguration::InputDeviceConfiguration*; |
356 | + mir::protobuf::InputDeviceConfiguration::New*; |
357 | + mir::protobuf::InputDeviceConfiguration::add_setting*; |
358 | + mir::protobuf::InputDeviceConfiguration::setting*; |
359 | + mir::protobuf::InputDeviceInfo::CopyFrom*; |
360 | mir::protobuf::InputDeviceInfo::MergeFrom*; |
361 | mir::protobuf::InputDeviceInfo::default_instance_; |
362 | - mir::protobuf::PointerConfiguration::?PointerConfiguration*; |
363 | - mir::protobuf::PointerConfiguration::PointerConfiguration*; |
364 | - mir::protobuf::PointerConfiguration::default_instance_; |
365 | - mir::protobuf::TouchpadConfiguration::TouchpadConfiguration*; |
366 | - mir::protobuf::TouchpadConfiguration::?TouchpadConfiguration*; |
367 | - mir::protobuf::TouchpadConfiguration::default_instance_; |
368 | - mir::protobuf::PointerConfiguration::?PointerConfiguration*; |
369 | - mir::protobuf::InputDeviceInfo::CopyFrom*; |
370 | + mir::protobuf::InputDeviceSetting::?InputDeviceSetting*; |
371 | + mir::protobuf::InputDeviceSetting::CopyFrom*; |
372 | + mir::protobuf::InputDeviceSetting::InputDeviceSetting*; |
373 | + mir::protobuf::InputDeviceSetting::New*; |
374 | + mir::protobuf::InputDeviceSetting::default_instance*; |
375 | + mir::protobuf::InputDeviceSetting::pointer_configuration*; |
376 | + mir::protobuf::InputDeviceSetting::touchpad_configuration*; |
377 | + mir::protobuf::InputDevices::?InputDevices*; |
378 | mir::protobuf::InputDevices::Clear*; |
379 | mir::protobuf::InputDevices::CopyFrom*; |
380 | mir::protobuf::InputDevices::InputDevices*; |
381 | - mir::protobuf::InputDevices::?InputDevices*; |
382 | mir::protobuf::InputDevices::MergeFrom*; |
383 | mir::protobuf::InputDevices::New*; |
384 | mir::protobuf::InputDevices::default_instance_; |
385 | + mir::protobuf::PointerConfiguration::?PointerConfiguration*; |
386 | mir::protobuf::PointerConfiguration::CopyFrom*; |
387 | + mir::protobuf::PointerConfiguration::PointerConfiguration*; |
388 | + mir::protobuf::PointerConfiguration::default_instance_; |
389 | + mir::protobuf::TouchpadConfiguration::?TouchpadConfiguration*; |
390 | mir::protobuf::TouchpadConfiguration::CopyFrom*; |
391 | + mir::protobuf::TouchpadConfiguration::TouchpadConfiguration*; |
392 | + mir::protobuf::TouchpadConfiguration::default_instance_; |
393 | + typeinfo?for?mir::protobuf::InputDeviceConfiguration; |
394 | + typeinfo?for?mir::protobuf::InputDeviceSetting; |
395 | typeinfo?for?mir::protobuf::InputDevices; |
396 | + vtable?for?mir::protobuf::InputDeviceConfiguration; |
397 | + vtable?for?mir::protobuf::InputDeviceSetting; |
398 | vtable?for?mir::protobuf::InputDevices; |
399 | }; |
400 | } MIR_PROTOBUF_0.22; |
401 | |
402 | === modified file 'src/server/frontend/protobuf_input_converter.cpp' |
403 | --- src/server/frontend/protobuf_input_converter.cpp 2016-10-27 14:31:48 +0000 |
404 | +++ src/server/frontend/protobuf_input_converter.cpp 2016-11-18 09:52:03 +0000 |
405 | @@ -61,3 +61,32 @@ |
406 | msg_conf->set_disable_while_typing(dev_conf.disable_while_typing); |
407 | } |
408 | } |
409 | + |
410 | +void mfd::apply_protobuf_device_settting(protobuf::InputDeviceSetting const& device_setting, |
411 | + input::Device& device) |
412 | +{ |
413 | + if (device_setting.has_pointer_configuration()) |
414 | + { |
415 | + mi::PointerConfiguration pointer_config; |
416 | + auto const& conf = device_setting.pointer_configuration(); |
417 | + pointer_config.handedness = static_cast<MirPointerHandedness>(conf.handedness()); |
418 | + pointer_config.acceleration = static_cast<MirPointerAcceleration>(conf.acceleration()); |
419 | + pointer_config.cursor_acceleration_bias = conf.acceleration_bias(); |
420 | + pointer_config.horizontal_scroll_scale = conf.horizontal_scroll_scale(); |
421 | + pointer_config.vertical_scroll_scale = conf.vertical_scroll_scale(); |
422 | + device.apply_pointer_configuration(pointer_config); |
423 | + } |
424 | + if (device_setting.has_touchpad_configuration()) |
425 | + { |
426 | + mi::TouchpadConfiguration touchpad_config; |
427 | + auto const& conf = device_setting.touchpad_configuration(); |
428 | + touchpad_config.click_mode = conf.click_modes(); |
429 | + touchpad_config.scroll_mode = conf.scroll_modes(); |
430 | + touchpad_config.button_down_scroll_button = conf.button_down_scroll_button(); |
431 | + touchpad_config.tap_to_click = conf.tap_to_click(); |
432 | + touchpad_config.middle_mouse_button_emulation = conf.middle_mouse_button_emulation(); |
433 | + touchpad_config.disable_with_mouse = conf.disable_with_mouse(); |
434 | + touchpad_config.disable_while_typing = conf.disable_while_typing(); |
435 | + device.apply_touchpad_configuration(touchpad_config); |
436 | + } |
437 | +} |
438 | |
439 | === modified file 'src/server/frontend/protobuf_input_converter.h' |
440 | --- src/server/frontend/protobuf_input_converter.h 2016-10-27 14:31:48 +0000 |
441 | +++ src/server/frontend/protobuf_input_converter.h 2016-11-18 09:52:03 +0000 |
442 | @@ -43,6 +43,8 @@ |
443 | |
444 | void pack_protobuf_input_device_info(protobuf::InputDeviceInfo& device_info, |
445 | input::Device const& device); |
446 | +void apply_protobuf_device_settting(protobuf::InputDeviceSetting const& setting, |
447 | + input::Device& device); |
448 | } |
449 | } |
450 | } |
451 | |
452 | === modified file 'src/server/frontend/protobuf_message_processor.cpp' |
453 | --- src/server/frontend/protobuf_message_processor.cpp 2016-11-11 17:40:29 +0000 |
454 | +++ src/server/frontend/protobuf_message_processor.cpp 2016-11-18 09:52:03 +0000 |
455 | @@ -348,6 +348,10 @@ |
456 | { |
457 | invoke(this, display_server.get(), &protobuf::DisplayServer::cancel_base_display_configuration_preview, invocation); |
458 | } |
459 | + else if ("apply_input_device_configuration" == invocation.method_name()) |
460 | + { |
461 | + invoke(this, display_server.get(), &protobuf::DisplayServer::apply_input_device_configuration, invocation); |
462 | + } |
463 | else |
464 | { |
465 | report->unknown_method(display_server.get(), invocation.id(), invocation.method_name()); |
466 | |
467 | === modified file 'src/server/frontend/session_mediator.cpp' |
468 | --- src/server/frontend/session_mediator.cpp 2016-11-17 08:45:49 +0000 |
469 | +++ src/server/frontend/session_mediator.cpp 2016-11-18 09:52:03 +0000 |
470 | @@ -1109,6 +1109,28 @@ |
471 | done->Run(); |
472 | } |
473 | |
474 | +void mf::SessionMediator::apply_input_device_configuration( |
475 | + mir::protobuf::InputDeviceSetting const* request, |
476 | + mir::protobuf::Void*, |
477 | + google::protobuf::Closure* done) |
478 | +{ |
479 | + auto const session = weak_session.lock(); |
480 | + if (!session) |
481 | + BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session")); |
482 | + |
483 | + observer->session_apply_input_device_configuration_called(session->name()); |
484 | + |
485 | + hub->for_each_mutable_input_device( |
486 | + [request](mi::Device& device) |
487 | + { |
488 | + if (device.id() == request->id()) |
489 | + mfd::apply_protobuf_device_settting(*request, device); |
490 | + }); |
491 | + |
492 | + done->Run(); |
493 | +} |
494 | + |
495 | + |
496 | std::shared_ptr<mg::DisplayConfiguration> |
497 | mf::SessionMediator::unpack_and_sanitize_display_configuration( |
498 | mir::protobuf::DisplayConfiguration const* protobuf_config) |
499 | |
500 | === modified file 'src/server/frontend/session_mediator.h' |
501 | --- src/server/frontend/session_mediator.h 2016-11-15 23:48:01 +0000 |
502 | +++ src/server/frontend/session_mediator.h 2016-11-18 09:52:03 +0000 |
503 | @@ -224,6 +224,10 @@ |
504 | mir::protobuf::RaiseRequest const* request, |
505 | mir::protobuf::Void*, |
506 | google::protobuf::Closure* done) override; |
507 | + void apply_input_device_configuration( |
508 | + mir::protobuf::InputDeviceSetting const* request, |
509 | + mir::protobuf::Void* response, |
510 | + google::protobuf::Closure* done) override; |
511 | |
512 | // TODO: Split this into a separate thing |
513 | void translate_surface_to_screen( |
514 | |
515 | === modified file 'src/server/frontend/session_mediator_observer_multiplexer.cpp' |
516 | --- src/server/frontend/session_mediator_observer_multiplexer.cpp 2016-11-02 05:07:18 +0000 |
517 | +++ src/server/frontend/session_mediator_observer_multiplexer.cpp 2016-11-18 09:52:03 +0000 |
518 | @@ -126,6 +126,13 @@ |
519 | for_each_observer(&mf::SessionMediatorObserver::session_error, app_name, method, what); |
520 | } |
521 | |
522 | + |
523 | +void mf::SessionMediatorObserverMultiplexer::session_apply_input_device_configuration_called( |
524 | + std::string const& app_name) |
525 | +{ |
526 | + for_each_observer(&mf::SessionMediatorObserver::session_apply_input_device_configuration_called, app_name); |
527 | +} |
528 | + |
529 | mir::frontend::SessionMediatorObserverMultiplexer::SessionMediatorObserverMultiplexer( |
530 | std::shared_ptr<mir::Executor> const& default_executor) |
531 | : ObserverMultiplexer(*default_executor), |
532 | |
533 | === modified file 'src/server/frontend/session_mediator_observer_multiplexer.h' |
534 | --- src/server/frontend/session_mediator_observer_multiplexer.h 2016-11-02 05:07:18 +0000 |
535 | +++ src/server/frontend/session_mediator_observer_multiplexer.h 2016-11-18 09:52:03 +0000 |
536 | @@ -67,6 +67,8 @@ |
537 | |
538 | void session_error(std::string const& app_name, char const* method, std::string const& what) override; |
539 | |
540 | + void session_apply_input_device_configuration_called(std::string const& app_name) override; |
541 | + |
542 | private: |
543 | std::shared_ptr<Executor> const executor; |
544 | }; |
545 | |
546 | === modified file 'src/server/input/default_device.cpp' |
547 | --- src/server/input/default_device.cpp 2016-07-18 07:38:38 +0000 |
548 | +++ src/server/input/default_device.cpp 2016-11-18 09:52:03 +0000 |
549 | @@ -18,6 +18,7 @@ |
550 | */ |
551 | |
552 | #include "default_device.h" |
553 | +#include "default_input_device_hub.h" |
554 | #include "mir/dispatch/action_queue.h" |
555 | #include "mir/input/device_capability.h" |
556 | #include "mir/input/input_device.h" |
557 | @@ -31,9 +32,10 @@ |
558 | namespace mi = mir::input; |
559 | |
560 | mi::DefaultDevice::DefaultDevice(MirInputDeviceId id, std::shared_ptr<dispatch::ActionQueue> const& actions, |
561 | - InputDevice& device, std::shared_ptr<KeyMapper> const& key_mapper) |
562 | + InputDevice& device, std::shared_ptr<KeyMapper> const& key_mapper, |
563 | + std::function<void(Device*)> const& callback) |
564 | : device_id{id}, device{device}, info(device.get_device_info()), pointer{device.get_pointer_settings()}, |
565 | - touchpad{device.get_touchpad_settings()}, actions{actions}, key_mapper{key_mapper} |
566 | + touchpad{device.get_touchpad_settings()}, actions{actions}, key_mapper{key_mapper}, device_changed_callback{callback} |
567 | { |
568 | if (contains(info.capabilities, mi::DeviceCapability::keyboard)) |
569 | { |
570 | @@ -42,6 +44,12 @@ |
571 | } |
572 | } |
573 | |
574 | +mi::DefaultDevice::DefaultDevice(MirInputDeviceId id, std::shared_ptr<dispatch::ActionQueue> const& actions, |
575 | + InputDevice& device, std::shared_ptr<KeyMapper> const& key_mapper) |
576 | + : DefaultDevice(id, actions, device, key_mapper, [](Device*){}) |
577 | +{ |
578 | +} |
579 | + |
580 | mi::DeviceCapabilities mi::DefaultDevice::capabilities() const |
581 | { |
582 | return info.capabilities; |
583 | @@ -107,6 +115,7 @@ |
584 | { |
585 | dev->apply_settings(settings); |
586 | }); |
587 | + device_changed_callback(this); |
588 | } |
589 | |
590 | void mi::DefaultDevice::apply_touchpad_configuration(mi::TouchpadConfiguration const& conf) |
591 | @@ -132,6 +141,7 @@ |
592 | { |
593 | dev->apply_settings(settings); |
594 | }); |
595 | + device_changed_callback(this); |
596 | } |
597 | |
598 | mir::optional_value<mi::KeyboardConfiguration> mi::DefaultDevice::keyboard_configuration() const |
599 | @@ -148,5 +158,8 @@ |
600 | { |
601 | keyboard = conf; |
602 | key_mapper->set_keymap_for_device(device_id, conf.device_keymap); |
603 | + |
604 | + device_changed_callback(this); |
605 | } |
606 | } |
607 | + |
608 | |
609 | === modified file 'src/server/input/default_device.h' |
610 | --- src/server/input/default_device.h 2016-07-18 07:38:38 +0000 |
611 | +++ src/server/input/default_device.h 2016-11-18 09:52:03 +0000 |
612 | @@ -29,6 +29,7 @@ |
613 | #include "mir/optional_value.h" |
614 | |
615 | #include <memory> |
616 | +#include <functional> |
617 | |
618 | namespace mir |
619 | { |
620 | @@ -41,12 +42,16 @@ |
621 | |
622 | class KeyMapper; |
623 | class InputDevice; |
624 | +class DefaultInputDeviceHub; |
625 | |
626 | class DefaultDevice : public Device |
627 | { |
628 | public: |
629 | DefaultDevice(MirInputDeviceId id, std::shared_ptr<dispatch::ActionQueue> const& actions, |
630 | InputDevice& device, std::shared_ptr<KeyMapper> const& key_mapper); |
631 | + DefaultDevice(MirInputDeviceId id, std::shared_ptr<dispatch::ActionQueue> const& actions, |
632 | + InputDevice& device, std::shared_ptr<KeyMapper> const& key_mapper, |
633 | + std::function<void(Device*)> const& change_callback); |
634 | MirInputDeviceId id() const override; |
635 | DeviceCapabilities capabilities() const override; |
636 | std::string name() const override; |
637 | @@ -59,6 +64,7 @@ |
638 | optional_value<KeyboardConfiguration> keyboard_configuration() const override; |
639 | void apply_keyboard_configuration(KeyboardConfiguration const&) override; |
640 | private: |
641 | + void wake_hub_for_device_change(); |
642 | MirInputDeviceId const device_id; |
643 | InputDevice& device; |
644 | InputDeviceInfo const info; |
645 | @@ -67,6 +73,7 @@ |
646 | optional_value<KeyboardConfiguration> keyboard; |
647 | std::shared_ptr<dispatch::ActionQueue> const actions; |
648 | std::shared_ptr<KeyMapper> const key_mapper; |
649 | + std::function<void(Device*)> device_changed_callback; |
650 | }; |
651 | |
652 | } |
653 | |
654 | === modified file 'src/server/input/default_input_device_hub.cpp' |
655 | --- src/server/input/default_input_device_hub.cpp 2016-11-09 02:30:14 +0000 |
656 | +++ src/server/input/default_input_device_hub.cpp 2016-11-18 09:52:03 +0000 |
657 | @@ -35,6 +35,7 @@ |
658 | |
659 | #include <algorithm> |
660 | #include <atomic> |
661 | +#include <memory> |
662 | |
663 | namespace mi = mir::input; |
664 | namespace mf = mir::frontend; |
665 | @@ -75,7 +76,7 @@ |
666 | if (it == end(devices)) |
667 | { |
668 | auto id = create_new_device_id(); |
669 | - auto handle = std::make_shared<DefaultDevice>(id, device_queue, *device, key_mapper); |
670 | + auto handle = std::make_shared<DefaultDevice>(id, device_queue, *device, key_mapper, [this](Device *d){device_changed(d);}); |
671 | // send input device info to observer loop.. |
672 | devices.push_back(std::make_unique<RegisteredDevice>( |
673 | device, id, input_dispatchable, cookie_authority, handle)); |
674 | @@ -244,6 +245,22 @@ |
675 | callback(*item); |
676 | } |
677 | |
678 | +void mi::DefaultInputDeviceHub::for_each_mutable_input_device(std::function<void(Device&)> const& callback) |
679 | +{ |
680 | + { |
681 | + std::unique_lock<std::mutex> lock(changed_devices_guard); |
682 | + changed_devices = std::make_unique<std::vector<std::shared_ptr<Device>>>(); |
683 | + } |
684 | + |
685 | + { |
686 | + std::unique_lock<std::mutex> lock(observer_guard); |
687 | + for (auto const& item : handles) |
688 | + callback(*item); |
689 | + } |
690 | + |
691 | + emit_changed_devices(); |
692 | +} |
693 | + |
694 | void mi::DefaultInputDeviceHub::remove_observer(std::weak_ptr<InputDeviceObserver> const& element) |
695 | { |
696 | auto observer = element.lock(); |
697 | @@ -305,3 +322,58 @@ |
698 | server_status_listener->stop_receiving_input(); |
699 | } |
700 | } |
701 | + |
702 | +void mi::DefaultInputDeviceHub::device_changed(Device* dev) |
703 | +{ |
704 | + auto more_changes_in_progress = false; |
705 | + { |
706 | + std::unique_lock<std::mutex> lock(changed_devices_guard); |
707 | + if (changed_devices) |
708 | + { |
709 | + more_changes_in_progress = true; |
710 | + auto dev_it = find_if(begin(handles), end(handles), [dev](auto const& ptr){return ptr.get() == dev;}); |
711 | + changed_devices->push_back(*dev_it); |
712 | + } |
713 | + } |
714 | + |
715 | + if (!more_changes_in_progress) |
716 | + { |
717 | + std::unique_lock<std::mutex> lock(observer_guard); |
718 | + sink->handle_input_device_change(handles); |
719 | + auto dev_it = find_if(begin(handles), end(handles), [dev](auto const& ptr){return ptr.get() == dev;}); |
720 | + |
721 | + if (dev_it==end(handles)) |
722 | + return; |
723 | + |
724 | + for (auto const& observer : observers) |
725 | + { |
726 | + observer->device_changed(*dev_it); |
727 | + observer->changes_complete(); |
728 | + } |
729 | + } |
730 | +} |
731 | + |
732 | +void mi::DefaultInputDeviceHub::emit_changed_devices() |
733 | +{ |
734 | + std::vector<std::shared_ptr<mi::Device>> devices_to_notify; |
735 | + { |
736 | + std::unique_lock<std::mutex> lock(changed_devices_guard); |
737 | + if (changed_devices) |
738 | + { |
739 | + std::swap(devices_to_notify, *changed_devices); |
740 | + changed_devices.reset(); |
741 | + } |
742 | + } |
743 | + { |
744 | + std::unique_lock<std::mutex> lock(observer_guard); |
745 | + for (auto const& observer : observers) |
746 | + { |
747 | + for (auto const& dev : devices_to_notify) |
748 | + observer->device_changed(dev); |
749 | + observer->changes_complete(); |
750 | + } |
751 | + |
752 | + sink->handle_input_device_change(handles); |
753 | + } |
754 | +} |
755 | + |
756 | |
757 | === modified file 'src/server/input/default_input_device_hub.h' |
758 | --- src/server/input/default_input_device_hub.h 2016-10-12 06:03:15 +0000 |
759 | +++ src/server/input/default_input_device_hub.h 2016-11-18 09:52:03 +0000 |
760 | @@ -79,11 +79,15 @@ |
761 | void add_observer(std::shared_ptr<InputDeviceObserver> const&) override; |
762 | void remove_observer(std::weak_ptr<InputDeviceObserver> const&) override; |
763 | void for_each_input_device(std::function<void(Device const& device)> const& callback) override; |
764 | + void for_each_mutable_input_device(std::function<void(Device& device)> const& callback) override; |
765 | + |
766 | |
767 | private: |
768 | void update_spots(); |
769 | void add_device_handle(std::shared_ptr<DefaultDevice> const& handle); |
770 | void remove_device_handle(MirInputDeviceId id); |
771 | + void device_changed(Device* dev); |
772 | + void emit_changed_devices(); |
773 | MirInputDeviceId create_new_device_id(); |
774 | std::shared_ptr<Seat> const seat; |
775 | std::shared_ptr<frontend::EventSink> const sink; |
776 | @@ -125,6 +129,8 @@ |
777 | std::vector<std::shared_ptr<Device>> handles; |
778 | std::vector<std::unique_ptr<RegisteredDevice>> devices; |
779 | std::vector<std::shared_ptr<InputDeviceObserver>> observers; |
780 | + std::mutex changed_devices_guard; |
781 | + std::unique_ptr<std::vector<std::shared_ptr<Device>>> changed_devices; |
782 | |
783 | MirInputDeviceId device_id_generator; |
784 | bool ready{false}; |
785 | |
786 | === modified file 'src/server/report/logging/session_mediator_report.cpp' |
787 | --- src/server/report/logging/session_mediator_report.cpp 2016-10-05 08:42:26 +0000 |
788 | +++ src/server/report/logging/session_mediator_report.cpp 2016-11-18 09:52:03 +0000 |
789 | @@ -118,6 +118,11 @@ |
790 | log->log(ml::Severity::informational, "session_release_buffer_stream_called(\"" + app_name + "\")", component); |
791 | } |
792 | |
793 | +void mrl::SessionMediatorReport::session_apply_input_device_configuration_called(std::string const& app_name) |
794 | +{ |
795 | + log->log(ml::Severity::informational, "session_apply_input_device_configuration_called(\"" + app_name + "\")", component); |
796 | +} |
797 | + |
798 | void mrl::SessionMediatorReport::session_error( |
799 | std::string const& app_name, |
800 | char const* method, |
801 | |
802 | === modified file 'src/server/report/logging/session_mediator_report.h' |
803 | --- src/server/report/logging/session_mediator_report.h 2016-11-02 05:07:18 +0000 |
804 | +++ src/server/report/logging/session_mediator_report.h 2016-11-18 09:52:03 +0000 |
805 | @@ -74,6 +74,8 @@ |
806 | void session_create_buffer_stream_called(std::string const& app_name) override; |
807 | void session_release_buffer_stream_called(std::string const& app_name) override; |
808 | |
809 | + void session_apply_input_device_configuration_called(std::string const& app_name) override; |
810 | + |
811 | virtual void session_error( |
812 | std::string const& app_name, |
813 | char const* method, |
814 | |
815 | === modified file 'src/server/report/lttng/session_mediator_report.cpp' |
816 | --- src/server/report/lttng/session_mediator_report.cpp 2016-10-05 08:42:26 +0000 |
817 | +++ src/server/report/lttng/session_mediator_report.cpp 2016-11-18 09:52:03 +0000 |
818 | @@ -46,6 +46,7 @@ |
819 | MIR_SESSION_MEDIATOR_EVENT_METHOD(session_stop_prompt_session_called) |
820 | MIR_SESSION_MEDIATOR_EVENT_METHOD(session_create_buffer_stream_called) |
821 | MIR_SESSION_MEDIATOR_EVENT_METHOD(session_release_buffer_stream_called) |
822 | +MIR_SESSION_MEDIATOR_EVENT_METHOD(session_apply_input_device_configuration_called) |
823 | |
824 | |
825 | void mir::report::lttng::SessionMediatorReport::session_start_prompt_session_called(std::string const& app_name, pid_t application_process) |
826 | |
827 | === modified file 'src/server/report/lttng/session_mediator_report.h' |
828 | --- src/server/report/lttng/session_mediator_report.h 2016-11-02 05:07:18 +0000 |
829 | +++ src/server/report/lttng/session_mediator_report.h 2016-11-18 09:52:03 +0000 |
830 | @@ -50,6 +50,7 @@ |
831 | void session_stop_prompt_session_called(std::string const& app_name) override; |
832 | void session_create_buffer_stream_called(std::string const& app_name) override; |
833 | void session_release_buffer_stream_called(std::string const& app_name) override; |
834 | + void session_apply_input_device_configuration_called(std::string const& app_name) override; |
835 | |
836 | void session_error(std::string const& app_name, char const* method, std::string const& what) override; |
837 | private: |
838 | |
839 | === modified file 'src/server/report/lttng/session_mediator_report_tp.h' |
840 | --- src/server/report/lttng/session_mediator_report_tp.h 2016-10-05 08:42:26 +0000 |
841 | +++ src/server/report/lttng/session_mediator_report_tp.h 2016-11-18 09:52:03 +0000 |
842 | @@ -56,6 +56,7 @@ |
843 | MIR_SESSION_MEDIATOR_EVENT(session_stop_prompt_session_called) |
844 | MIR_SESSION_MEDIATOR_EVENT(session_create_buffer_stream_called) |
845 | MIR_SESSION_MEDIATOR_EVENT(session_release_buffer_stream_called) |
846 | +MIR_SESSION_MEDIATOR_EVENT(session_apply_input_device_configuration_called) |
847 | |
848 | TRACEPOINT_EVENT( |
849 | mir_server_session_mediator, |
850 | |
851 | === modified file 'src/server/report/null/session_mediator_report.cpp' |
852 | --- src/server/report/null/session_mediator_report.cpp 2016-10-05 08:42:26 +0000 |
853 | +++ src/server/report/null/session_mediator_report.cpp 2016-11-18 09:52:03 +0000 |
854 | @@ -86,6 +86,10 @@ |
855 | { |
856 | } |
857 | |
858 | +void mir::report::null::SessionMediatorReport::session_apply_input_device_configuration_called(std::string const&) |
859 | +{ |
860 | +} |
861 | + |
862 | void mir::report::null::SessionMediatorReport::session_error( |
863 | std::string const&, |
864 | char const* , |
865 | |
866 | === modified file 'src/server/report/null/session_mediator_report.h' |
867 | --- src/server/report/null/session_mediator_report.h 2016-11-02 05:07:18 +0000 |
868 | +++ src/server/report/null/session_mediator_report.h 2016-11-18 09:52:03 +0000 |
869 | @@ -69,6 +69,8 @@ |
870 | |
871 | void session_release_buffer_stream_called(std::string const& app_name) override; |
872 | |
873 | + void session_apply_input_device_configuration_called(std::string const& app_name) override; |
874 | + |
875 | void session_error( |
876 | std::string const& app_name, |
877 | char const* method, |
878 | |
879 | === modified file 'tests/acceptance-tests/test_client_input.cpp' |
880 | --- tests/acceptance-tests/test_client_input.cpp 2016-11-15 20:53:57 +0000 |
881 | +++ tests/acceptance-tests/test_client_input.cpp 2016-11-18 09:52:03 +0000 |
882 | @@ -54,7 +54,6 @@ |
883 | |
884 | using namespace std::chrono_literals; |
885 | using namespace testing; |
886 | -using namespace std::chrono_literals; |
887 | |
888 | namespace |
889 | { |
890 | @@ -1100,4 +1099,39 @@ |
891 | mir_input_config_destroy(config); |
892 | } |
893 | |
894 | - |
895 | +TEST_F(TestClientInput, changes_on_input_configuration) |
896 | +{ |
897 | + wait_for_input_devices(); |
898 | + |
899 | + Client a_client(new_connection(), first); |
900 | + auto config = mir_connection_create_input_config(a_client.connection); |
901 | + auto mouse = get_mutable_device_with_capabilities(config, mir_input_device_capability_pointer); |
902 | + auto pointer_config = mir_input_device_get_mutable_pointer_configuration(mouse); |
903 | + auto increased_acceleration = 0.7; |
904 | + |
905 | + mir_pointer_configuration_set_acceleration(pointer_config, mir_pointer_acceleration_adaptive); |
906 | + mir_pointer_configuration_set_acceleration_bias(pointer_config, increased_acceleration); |
907 | + |
908 | + mt::Signal changes_complete; |
909 | + mir_connection_set_input_config_change_callback( |
910 | + a_client.connection, |
911 | + [](MirConnection*, void* context) |
912 | + { |
913 | + static_cast<mt::Signal*>(context)->raise(); |
914 | + }, |
915 | + &changes_complete |
916 | + ); |
917 | + mir_connection_apply_input_device_configuration(a_client.connection, mouse); |
918 | + mir_input_config_destroy(config); |
919 | + |
920 | + EXPECT_THAT(changes_complete.wait_for(2s), Eq(true)); |
921 | + |
922 | + config = mir_connection_create_input_config(a_client.connection); |
923 | + mouse = get_mutable_device_with_capabilities(config, mir_input_device_capability_pointer); |
924 | + pointer_config = mir_input_device_get_mutable_pointer_configuration(mouse); |
925 | + |
926 | + EXPECT_THAT(mir_pointer_configuration_get_acceleration(pointer_config), Eq(mir_pointer_acceleration_adaptive)); |
927 | + EXPECT_THAT(mir_pointer_configuration_get_acceleration_bias(pointer_config), Eq(increased_acceleration)); |
928 | + |
929 | + mir_input_config_destroy(config); |
930 | +} |
931 | |
932 | === modified file 'tests/acceptance-tests/test_nested_mir.cpp' |
933 | --- tests/acceptance-tests/test_nested_mir.cpp 2016-11-15 23:48:01 +0000 |
934 | +++ tests/acceptance-tests/test_nested_mir.cpp 2016-11-18 09:52:03 +0000 |
935 | @@ -110,6 +110,7 @@ |
936 | void session_confirm_base_display_configuration_called(std::string const&) override {}; |
937 | void session_create_buffer_stream_called(std::string const&) override {} |
938 | void session_release_buffer_stream_called(std::string const&) override {} |
939 | + void session_apply_input_device_configuration_called(std::string const&) override {} |
940 | void session_error(const std::string&, const char*, const std::string&) override {}; |
941 | }; |
942 | |
943 | |
944 | === modified file 'tests/acceptance-tests/test_session_mediator_report.cpp' |
945 | --- tests/acceptance-tests/test_session_mediator_report.cpp 2016-11-15 04:59:25 +0000 |
946 | +++ tests/acceptance-tests/test_session_mediator_report.cpp 2016-11-18 09:52:03 +0000 |
947 | @@ -61,6 +61,7 @@ |
948 | void session_set_base_display_configuration_called(std::string const&) override {}; |
949 | void session_preview_base_display_configuration_called(std::string const&) override {}; |
950 | void session_confirm_base_display_configuration_called(std::string const&) override {}; |
951 | + void session_apply_input_device_configuration_called(std::string const&) override {}; |
952 | void session_error(const std::string&, const char*, const std::string&) override {}; |
953 | }; |
954 | |
955 | |
956 | === modified file 'tests/include/mir/test/doubles/mock_rpc_report.h' |
957 | --- tests/include/mir/test/doubles/mock_rpc_report.h 2016-01-29 08:18:22 +0000 |
958 | +++ tests/include/mir/test/doubles/mock_rpc_report.h 2016-11-18 09:52:03 +0000 |
959 | @@ -67,6 +67,10 @@ |
960 | MOCK_METHOD2(file_descriptors_received, |
961 | void(google::protobuf::MessageLite const&, |
962 | std::vector<Fd> const&)); |
963 | + |
964 | + MOCK_METHOD1(input_device_configuration_received, |
965 | + void(mir::protobuf::InputDevices const&)); |
966 | + |
967 | }; |
968 | |
969 | |
970 | |
971 | === modified file 'tests/include/mir/test/doubles/stub_display_server.h' |
972 | --- tests/include/mir/test/doubles/stub_display_server.h 2016-10-12 06:03:15 +0000 |
973 | +++ tests/include/mir/test/doubles/stub_display_server.h 2016-11-18 09:52:03 +0000 |
974 | @@ -150,6 +150,11 @@ |
975 | mir::protobuf::RaiseRequest const* /*request*/, |
976 | mir::protobuf::Void* /*response*/, |
977 | google::protobuf::Closure* /*done*/) {} |
978 | + void apply_input_device_configuration( |
979 | + mir::protobuf::InputDeviceSetting const* /*request*/, |
980 | + mir::protobuf::Void* /*response*/, |
981 | + google::protobuf::Closure* /*done*/) {} |
982 | + |
983 | }; |
984 | |
985 | } |
986 | |
987 | === modified file 'tests/include/mir/test/stub_server_tool.h' |
988 | --- tests/include/mir/test/stub_server_tool.h 2016-10-05 08:42:26 +0000 |
989 | +++ tests/include/mir/test/stub_server_tool.h 2016-11-18 09:52:03 +0000 |
990 | @@ -108,6 +108,14 @@ |
991 | done->Run(); |
992 | } |
993 | |
994 | + virtual void apply_input_device_configuration( |
995 | + mir::protobuf::InputDeviceSetting const* /*request*/, |
996 | + mir::protobuf::Void* /*response*/, |
997 | + google::protobuf::Closure* done) override |
998 | + { |
999 | + done->Run(); |
1000 | + } |
1001 | + |
1002 | std::string application_name() const |
1003 | { |
1004 | std::lock_guard<std::mutex> lock(guard); |
1005 | |
1006 | === modified file 'tests/unit-tests/input/test_default_input_device_hub.cpp' |
1007 | --- tests/unit-tests/input/test_default_input_device_hub.cpp 2016-10-27 14:31:48 +0000 |
1008 | +++ tests/unit-tests/input/test_default_input_device_hub.cpp 2016-11-18 09:52:03 +0000 |
1009 | @@ -236,3 +236,57 @@ |
1010 | observer_loop.trigger_server_actions(); |
1011 | } |
1012 | |
1013 | +TEST_F(InputDeviceHubTest, when_pointer_configuration_is_applied_successfully_observer_is_triggerd) |
1014 | +{ |
1015 | + std::shared_ptr<mi::Device> dev_ptr; |
1016 | + mi::PointerConfiguration pointer_conf; |
1017 | + |
1018 | + ON_CALL(mock_observer, device_added(WithName("mouse"))).WillByDefault(SaveArg<0>(&dev_ptr)); |
1019 | + |
1020 | + hub.add_device(mt::fake_shared(mouse)); |
1021 | + hub.add_observer(mt::fake_shared(mock_observer)); |
1022 | + observer_loop.trigger_server_actions(); |
1023 | + |
1024 | + EXPECT_CALL(mock_observer, device_changed(WithName("mouse"))); |
1025 | + EXPECT_CALL(mock_observer, changes_complete()); |
1026 | + |
1027 | + dev_ptr->apply_pointer_configuration(pointer_conf); |
1028 | + observer_loop.trigger_server_actions(); |
1029 | +} |
1030 | + |
1031 | +TEST_F(InputDeviceHubTest, when_tpd_configuration_is_applied_successfully_observer_is_triggerd) |
1032 | +{ |
1033 | + std::shared_ptr<mi::Device> dev_ptr; |
1034 | + mi::TouchpadConfiguration tpd_conf; |
1035 | + |
1036 | + ON_CALL(mock_observer, device_added(WithName("tpd"))).WillByDefault(SaveArg<0>(&dev_ptr)); |
1037 | + |
1038 | + hub.add_device(mt::fake_shared(touchpad)); |
1039 | + hub.add_observer(mt::fake_shared(mock_observer)); |
1040 | + observer_loop.trigger_server_actions(); |
1041 | + |
1042 | + EXPECT_CALL(mock_observer, device_changed(WithName("tpd"))); |
1043 | + EXPECT_CALL(mock_observer, changes_complete()); |
1044 | + |
1045 | + dev_ptr->apply_touchpad_configuration(tpd_conf); |
1046 | + observer_loop.trigger_server_actions(); |
1047 | +} |
1048 | + |
1049 | +TEST_F(InputDeviceHubTest, when_configuration_attempt_fails_observer_is_not_triggerd) |
1050 | +{ |
1051 | + std::shared_ptr<mi::Device> dev_ptr; |
1052 | + mi::TouchpadConfiguration tpd_conf; |
1053 | + |
1054 | + ON_CALL(mock_observer, device_added(WithName("mouse"))).WillByDefault(SaveArg<0>(&dev_ptr)); |
1055 | + |
1056 | + hub.add_device(mt::fake_shared(mouse)); |
1057 | + hub.add_observer(mt::fake_shared(mock_observer)); |
1058 | + observer_loop.trigger_server_actions(); |
1059 | + |
1060 | + EXPECT_CALL(mock_observer, device_changed(WithName("mouse"))).Times(0); |
1061 | + EXPECT_CALL(mock_observer, changes_complete()).Times(0); |
1062 | + |
1063 | + try {dev_ptr->apply_touchpad_configuration(tpd_conf); } catch (...) {} |
1064 | + observer_loop.trigger_server_actions(); |
1065 | + ::testing::Mock::VerifyAndClearExpectations(&mock_observer); |
1066 | +} |
FAILED: Continuous integration, rev:3800 /mir-jenkins. ubuntu. com/job/ mir-ci/ 2149/ /mir-jenkins. ubuntu. com/job/ build-mir/ 2785/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/2850/ console /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 2842/console /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 2842/console /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 2842/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= yakkety/ 2814/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2814/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= yakkety/ 2814/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 2814/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 2814/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2814/console
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 2149/rebuild
https:/