Merge lp:~robertcarr/mir/input-lttng into lp:~mir-team/mir/trunk
- input-lttng
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Robert Ancell |
Approved revision: | no longer in the source branch. |
Merged at revision: | 709 |
Proposed branch: | lp:~robertcarr/mir/input-lttng |
Merge into: | lp:~mir-team/mir/trunk |
Diff against target: |
1815 lines (+531/-711) 35 files modified
3rd_party/android-input/CMakeLists.txt (+0/-5) 3rd_party/android-input/android/CMakeLists.txt (+2/-1) 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp (+8/-1) 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h (+13/-1) 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp (+19/-6) 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h (+12/-1) 3rd_party/android-input/android/frameworks/base/services/input/InputManager.cpp (+0/-93) 3rd_party/android-input/tools/CMakeLists.txt (+0/-101) 3rd_party/android-input/tools/cooked_event_printer.cpp (+0/-127) 3rd_party/android-input/tools/dispatcher_check.cpp (+0/-302) 3rd_party/android-input/tools/raw_event_printer.cpp (+0/-34) include/server/mir/default_server_configuration.h (+4/-0) include/server/mir/input/input_report.h (+52/-0) include/server/mir/input/null_input_report.h (+47/-0) include/server/mir/logging/input_report.h (+22/-1) include/server/mir/lttng/input_report.h (+51/-0) include/test/mir_test/fake_event_hub_input_configuration.h (+5/-3) src/server/default_server_configuration.cpp (+33/-4) src/server/input/CMakeLists.txt (+1/-0) src/server/input/android/default_android_input_configuration.cpp (+6/-4) src/server/input/android/default_android_input_configuration.h (+4/-1) src/server/input/null_input_report.cpp (+39/-0) src/server/logging/input_report.cpp (+62/-12) src/server/lttng/CMakeLists.txt (+2/-0) src/server/lttng/input_report.cpp (+45/-0) src/server/lttng/input_report_tp.c (+4/-0) src/server/lttng/input_report_tp.h (+78/-0) tests/acceptance-tests/test_client_input.cpp (+1/-1) tests/acceptance-tests/test_server_shutdown.cpp (+2/-1) tests/integration-tests/input/android/test_android_cursor_listener.cpp (+3/-1) tests/integration-tests/input/android/test_android_input_manager.cpp (+6/-4) tests/integration-tests/input/android/test_fake_event_hub_to_event_filter.cpp (+4/-2) tests/mir_test_doubles/fake_event_hub_input_configuration.cpp (+4/-3) tests/unit-tests/logging/CMakeLists.txt (+1/-1) tests/unit-tests/logging/test_legacy_input_report.cpp (+1/-1) |
To merge this branch: | bzr merge lp:~robertcarr/mir/input-lttng |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alan Griffiths | Approve | ||
Alexandros Frantzis (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+166123@code.launchpad.net |
Commit message
Demote old input logs to a legacy report. Replace with a new InputReport interface and both logging and LTTNG based implementations.
Description of the change
This branch starts to gather some useful input statistics through input-lttng.
The old input log is demoted to a LegacyInputReport.
A new InputReport interface is created.
Logger and lttng implementations are provided.
Unfortunately I am unable to make lttng work (with both the existing message processor report and my new report) so I haven't been able to confirm the output. Logging works fine of course.
Need to sync in morning on how to fix lttng!
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:712
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
> Unfortunately I am unable to make lttng work (with both the existing message processor
> report and my new report) so I haven't been able to confirm the output
Did you follow the instructions in HACKING.md (especially the LD_PRELOAD note)?
984 +protected:
985 + InputReport() = default;
986 +
987 +private:
988 + InputReport(
989 + InputReport& operator=
The preferred form is to make the deleted copy constructor and assignment operator protected too, for compactness.
1043 + protected:
1044 + NullInputReport
1045 + NullInputReport& operator=
1088 +protected:
1089 + InputReport(
1090 + InputReport& operator=
There is no need to repeat the deletions, they are enforced by the base class.
Alan Griffiths (alan-griffiths) wrote : | # |
> > Unfortunately I am unable to make lttng work (with both the existing message
> processor
> > report and my new report) so I haven't been able to confirm the output
>
> Did you follow the instructions in HACKING.md (especially the LD_PRELOAD
> note)?
libmirserverltt
vis:
$ lttng create mirsession -o /tmp/mirsession
Session mirsession created.
Traces will be written in /tmp/mirsession
$ lttng enable-event -u -a
All UST events are enabled in channel channel0
$ lttng start
Tracing started for session mirsession
$ LD_PRELOAD=
...
[ FAILED ] 13 tests, listed below:
[ FAILED ] SurfaceLoop.
[ FAILED ] SurfaceLoop.
[ FAILED ] SurfaceLoop.
[ FAILED ] SurfaceLoop.
[ FAILED ] ErrorReporting.
[ FAILED ] BespokeDisplayS
[ FAILED ] BespokeDisplayS
[ FAILED ] SurfaceFirstFra
[ FAILED ] ApplicationMedi
[ FAILED ] ApplicationMedi
[ FAILED ] ApplicationMedi
[ FAILED ] ApplicationMedi
[ FAILED ] ApplicationMedi
13 FAILED TESTS
Alan Griffiths (alan-griffiths) wrote : | # |
Oops:
> $ LD_PRELOAD=
that should be:
$ LD_PRELOAD=
Alan Griffiths (alan-griffiths) wrote : | # |
25 + ${PROJECT_
It doesn't seem right for 3rd_party code to depend on mir code.
The status of the forked "android" input is odd - I suspect it should move out of 3rd_party (it isn't as though we'll ever try to puck up the latest version after all the changes we've applied).
~~~~
+1 on Alexandros's comments about deleting CopyAssign
Robert Carr (robertcarr) wrote : | # |
Lttng works for me with the LD_PRELOAD. Thanks!
Removed the extra copy assign.
Robert Carr (robertcarr) wrote : | # |
>> 25 + ${PROJECT_
>> It doesn't seem right for 3rd_party code to depend on mir code.
>> The status of the forked "android" input is odd - I suspect it should move out of 3rd_party (it isn't as
>> though we'll ever try to puck up the latest version after all the changes we've applied).
It doesn't seem right but also doesn't feel like a huge priority to move. I would like to come to some sort of decision about the input stack trajectory though. (Feels pretty forked).
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:713
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good.
Nit:
1031 + NullInputReport() = default;
1032 + virtual ~NullInputReport() noexcept(true) = default;
1073 + virtual ~InputReport() noexcept(true) = default;
Is there a real need for these?
Alexandros Frantzis (afrantzis) wrote : | # |
1127 + InputReport() = default;
1128 + virtual ~InputReport() noexcept(true) = default;
These, too.
Alan Griffiths (alan-griffiths) wrote : | # |
Yeah, as Alexandros notes there's some overly verbose text - but nothing worth blocking on.
Preview Diff
1 | === modified file '3rd_party/android-input/CMakeLists.txt' |
2 | --- 3rd_party/android-input/CMakeLists.txt 2013-02-11 12:50:00 +0000 |
3 | +++ 3rd_party/android-input/CMakeLists.txt 2013-05-29 14:16:28 +0000 |
4 | @@ -13,11 +13,6 @@ |
5 | |
6 | add_subdirectory(android) |
7 | |
8 | -#we don't have these tools dependencies hybrisized to build the tool |
9 | -if(MIR_PLATFORM STREQUAL "gbm") |
10 | - add_subdirectory(tools) |
11 | -endif() |
12 | - |
13 | # Make those include directories available to mir source code |
14 | list( |
15 | APPEND MIR_ANDROID_INCLUDE_DIRECTORIES |
16 | |
17 | === modified file '3rd_party/android-input/android/CMakeLists.txt' |
18 | --- 3rd_party/android-input/android/CMakeLists.txt 2013-05-04 00:53:42 +0000 |
19 | +++ 3rd_party/android-input/android/CMakeLists.txt 2013-05-29 14:16:28 +0000 |
20 | @@ -5,6 +5,8 @@ |
21 | hardware/libhardware_legacy/include |
22 | system/core/include |
23 | system/extras/ext4_utils |
24 | + |
25 | + ${PROJECT_SOURCE_DIR}/include/server |
26 | ) |
27 | |
28 | add_definitions( |
29 | @@ -28,7 +30,6 @@ |
30 | frameworks/base/services/input/InputApplication.cpp |
31 | frameworks/base/services/input/InputDispatcher.cpp |
32 | frameworks/base/services/input/InputListener.cpp |
33 | - frameworks/base/services/input/InputManager.cpp |
34 | frameworks/base/services/input/InputReader.cpp |
35 | frameworks/base/services/input/InputTransport.cpp |
36 | frameworks/base/services/input/InputWindow.cpp |
37 | |
38 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp' |
39 | --- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2013-05-13 09:35:44 +0000 |
40 | +++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2013-05-29 14:16:28 +0000 |
41 | @@ -23,6 +23,8 @@ |
42 | #define acquire_wake_lock(lock, id) {} |
43 | #define release_wake_lock(id) {} |
44 | |
45 | +#include "mir/input/input_report.h" |
46 | + |
47 | #include <cutils/properties.h> |
48 | #include <std/Log.h> |
49 | #include <std/Timers.h> |
50 | @@ -71,6 +73,7 @@ |
51 | #define INDENT2 " " |
52 | #define INDENT3 " " |
53 | |
54 | +namespace mi = mir::input; |
55 | |
56 | namespace android { |
57 | |
58 | @@ -207,7 +210,8 @@ |
59 | const int EventHub::EPOLL_SIZE_HINT; |
60 | const int EventHub::EPOLL_MAX_EVENTS; |
61 | |
62 | -EventHub::EventHub(void) : |
63 | +EventHub::EventHub(std::shared_ptr<mi::InputReport> const& input_report) : |
64 | + input_report(input_report), |
65 | mBuiltInKeyboardId(NO_BUILT_IN_KEYBOARD), mNextDeviceId(1), |
66 | mOpeningDevices(0), mClosingDevices(0), |
67 | mNeedToSendFinishedDeviceScan(false), |
68 | @@ -808,6 +812,9 @@ |
69 | event->type = iev.type; |
70 | event->code = iev.code; |
71 | event->value = iev.value; |
72 | + |
73 | + input_report->received_event_from_kernel(event->when, event->type, event->code, event->value); |
74 | + |
75 | event += 1; |
76 | } |
77 | capacity -= count; |
78 | |
79 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.h' |
80 | --- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2013-05-13 09:35:44 +0000 |
81 | +++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2013-05-29 14:16:28 +0000 |
82 | @@ -35,6 +35,16 @@ |
83 | #include <linux/input.h> |
84 | #include <sys/epoll.h> |
85 | |
86 | +#include <memory> |
87 | + |
88 | +namespace mir |
89 | +{ |
90 | +namespace input |
91 | +{ |
92 | +class InputReport; |
93 | +} |
94 | +} |
95 | + |
96 | /* Convenience constants. */ |
97 | |
98 | #define BTN_FIRST 0x100 // first button code |
99 | @@ -244,7 +254,7 @@ |
100 | class EventHub : public EventHubInterface |
101 | { |
102 | public: |
103 | - EventHub(); |
104 | + EventHub(std::shared_ptr<mir::input::InputReport> const& input_report); |
105 | |
106 | virtual uint32_t getDeviceClasses(int32_t deviceId) const; |
107 | |
108 | @@ -302,6 +312,8 @@ |
109 | virtual ~EventHub(); |
110 | |
111 | private: |
112 | + std::shared_ptr<mir::input::InputReport> const input_report; |
113 | + |
114 | struct Device { |
115 | Device* next; |
116 | |
117 | |
118 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp' |
119 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2013-05-01 16:53:31 +0000 |
120 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2013-05-29 14:16:28 +0000 |
121 | @@ -45,6 +45,8 @@ |
122 | |
123 | #include "InputDispatcher.h" |
124 | |
125 | +#include "mir/input/input_report.h" |
126 | + |
127 | #include <cutils/log.h> |
128 | #include <android/keycodes.h> |
129 | |
130 | @@ -59,6 +61,8 @@ |
131 | #define INDENT3 " " |
132 | #define INDENT4 " " |
133 | |
134 | +namespace mi = mir::input; |
135 | + |
136 | namespace android { |
137 | |
138 | // Default input dispatching timeout if there is no focused application or paused window |
139 | @@ -167,12 +171,14 @@ |
140 | |
141 | // --- InputDispatcher --- |
142 | |
143 | -InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy) : |
144 | - mPolicy(policy), |
145 | - mPendingEvent(NULL), mAppSwitchSawKeyDown(false), mAppSwitchDueTime(LONG_LONG_MAX), |
146 | - mNextUnblockedEvent(NULL), |
147 | - mDispatchEnabled(false), mDispatchFrozen(false), mInputFilterEnabled(false), |
148 | - mInputTargetWaitCause(INPUT_TARGET_WAIT_CAUSE_NONE) { |
149 | +InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy, |
150 | + std::shared_ptr<mi::InputReport> const& input_report) : |
151 | + input_report(input_report), |
152 | + mPolicy(policy), |
153 | + mPendingEvent(NULL), mAppSwitchSawKeyDown(false), mAppSwitchDueTime(LONG_LONG_MAX), |
154 | + mNextUnblockedEvent(NULL), |
155 | + mDispatchEnabled(false), mDispatchFrozen(false), mInputFilterEnabled(false), |
156 | + mInputTargetWaitCause(INPUT_TARGET_WAIT_CAUSE_NONE) { |
157 | mLooper = new Looper(false); |
158 | |
159 | mKeyRepeatState.lastKeyEntry = NULL; |
160 | @@ -1846,6 +1852,9 @@ |
161 | keyEntry->keyCode, keyEntry->scanCode, |
162 | keyEntry->metaState, keyEntry->repeatCount, keyEntry->downTime, |
163 | keyEntry->eventTime); |
164 | + input_report->published_key_event(connection->inputChannel->getFd(), |
165 | + dispatchEntry->seq, |
166 | + keyEntry->eventTime); |
167 | break; |
168 | } |
169 | |
170 | @@ -1893,6 +1902,9 @@ |
171 | motionEntry->downTime, motionEntry->eventTime, |
172 | motionEntry->pointerCount, motionEntry->pointerProperties, |
173 | usingCoords); |
174 | + input_report->published_motion_event(connection->inputChannel->getFd(), |
175 | + dispatchEntry->seq, |
176 | + motionEntry->eventTime); |
177 | break; |
178 | } |
179 | |
180 | @@ -2021,6 +2033,7 @@ |
181 | if (status) { |
182 | break; |
183 | } |
184 | + d->input_report->received_event_finished_signal(connection->inputChannel->getFd(), seq); |
185 | d->finishDispatchCycleLocked(currentTime, connection, seq, handled); |
186 | gotOne = true; |
187 | } |
188 | |
189 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h' |
190 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h 2013-05-22 08:53:56 +0000 |
191 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h 2013-05-29 14:16:28 +0000 |
192 | @@ -39,6 +39,15 @@ |
193 | #include "InputApplication.h" |
194 | #include "InputListener.h" |
195 | |
196 | +#include <memory> |
197 | + |
198 | +namespace mir |
199 | +{ |
200 | +namespace input |
201 | +{ |
202 | +class InputReport; |
203 | +} |
204 | +} |
205 | |
206 | namespace android { |
207 | |
208 | @@ -367,7 +376,7 @@ |
209 | virtual ~InputDispatcher(); |
210 | |
211 | public: |
212 | - explicit InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy); |
213 | + explicit InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy, std::shared_ptr<mir::input::InputReport> const& input_report); |
214 | |
215 | virtual void dump(String8& dump); |
216 | virtual void monitor(); |
217 | @@ -397,6 +406,8 @@ |
218 | virtual status_t unregisterInputChannel(const sp<InputChannel>& inputChannel); |
219 | |
220 | private: |
221 | + std::shared_ptr<mir::input::InputReport> const input_report; |
222 | + |
223 | template <typename T> |
224 | struct Link { |
225 | T* next; |
226 | |
227 | === removed file '3rd_party/android-input/android/frameworks/base/services/input/InputManager.cpp' |
228 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputManager.cpp 2012-11-06 18:05:11 +0000 |
229 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputManager.cpp 1970-01-01 00:00:00 +0000 |
230 | @@ -1,93 +0,0 @@ |
231 | -/* |
232 | - * Copyright (C) 2010 The Android Open Source Project |
233 | - * |
234 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
235 | - * you may not use this file except in compliance with the License. |
236 | - * You may obtain a copy of the License at |
237 | - * |
238 | - * http://www.apache.org/licenses/LICENSE-2.0 |
239 | - * |
240 | - * Unless required by applicable law or agreed to in writing, software |
241 | - * distributed under the License is distributed on an "AS IS" BASIS, |
242 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
243 | - * See the License for the specific language governing permissions and |
244 | - * limitations under the License. |
245 | - */ |
246 | - |
247 | -#define LOG_TAG "InputManager" |
248 | - |
249 | -//#define LOG_NDEBUG 0 |
250 | - |
251 | -#include "InputManager.h" |
252 | - |
253 | -#include <cutils/log.h> |
254 | - |
255 | -namespace android { |
256 | - |
257 | -InputManager::InputManager( |
258 | - const sp<EventHubInterface>& eventHub, |
259 | - const sp<InputReaderPolicyInterface>& readerPolicy, |
260 | - const sp<InputDispatcherPolicyInterface>& dispatcherPolicy) { |
261 | - mDispatcher = new InputDispatcher(dispatcherPolicy); |
262 | - mReader = new InputReader(eventHub, readerPolicy, mDispatcher); |
263 | - initialize(); |
264 | -} |
265 | - |
266 | -InputManager::InputManager( |
267 | - const sp<InputReaderInterface>& reader, |
268 | - const sp<InputDispatcherInterface>& dispatcher) : |
269 | - mReader(reader), |
270 | - mDispatcher(dispatcher) { |
271 | - initialize(); |
272 | -} |
273 | - |
274 | -InputManager::~InputManager() { |
275 | - stop(); |
276 | -} |
277 | - |
278 | -void InputManager::initialize() { |
279 | - mReaderThread = new InputReaderThread(mReader); |
280 | - mDispatcherThread = new InputDispatcherThread(mDispatcher); |
281 | -} |
282 | - |
283 | -status_t InputManager::start() { |
284 | - status_t result = mDispatcherThread->run("InputDispatcher", PRIORITY_URGENT_DISPLAY); |
285 | - if (result) { |
286 | - ALOGE("Could not start InputDispatcher thread due to error %d.", result); |
287 | - return result; |
288 | - } |
289 | - |
290 | - result = mReaderThread->run("InputReader", PRIORITY_URGENT_DISPLAY); |
291 | - if (result) { |
292 | - ALOGE("Could not start InputReader thread due to error %d.", result); |
293 | - |
294 | - mDispatcherThread->requestExit(); |
295 | - return result; |
296 | - } |
297 | - |
298 | - return OK; |
299 | -} |
300 | - |
301 | -status_t InputManager::stop() { |
302 | - status_t result = mReaderThread->requestExitAndWait(); |
303 | - if (result) { |
304 | - ALOGW("Could not stop InputReader thread due to error %d.", result); |
305 | - } |
306 | - |
307 | - result = mDispatcherThread->requestExitAndWait(); |
308 | - if (result) { |
309 | - ALOGW("Could not stop InputDispatcher thread due to error %d.", result); |
310 | - } |
311 | - |
312 | - return OK; |
313 | -} |
314 | - |
315 | -sp<InputReaderInterface> InputManager::getReader() { |
316 | - return mReader; |
317 | -} |
318 | - |
319 | -sp<InputDispatcherInterface> InputManager::getDispatcher() { |
320 | - return mDispatcher; |
321 | -} |
322 | - |
323 | -} // namespace android |
324 | |
325 | === removed file '3rd_party/android-input/tools/CMakeLists.txt' |
326 | --- 3rd_party/android-input/tools/CMakeLists.txt 2013-05-04 00:53:42 +0000 |
327 | +++ 3rd_party/android-input/tools/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
328 | @@ -1,101 +0,0 @@ |
329 | -include_directories( |
330 | - ../android/external/kernel-headers/original |
331 | - ../android/frameworks/base/include |
332 | - ../android/frameworks/base/services/input |
333 | - ../android/frameworks/native/include |
334 | - ../android/hardware/libhardware_legacy/include |
335 | - ../android/system/core/include |
336 | - ../android/system/extras/ext4_utils |
337 | - /usr/include |
338 | - ) |
339 | - |
340 | -###### raw-event-printer |
341 | - |
342 | -add_executable( |
343 | - raw-event-printer |
344 | - raw_event_printer.cpp |
345 | - ) |
346 | - |
347 | -set_target_properties( |
348 | - raw-event-printer |
349 | - PROPERTIES |
350 | - COMPILE_FLAGS ${ANDROID_INPUT_COMPILE_FLAGS} |
351 | - ) |
352 | - |
353 | -if(MIR_PLATFORM STREQUAL "gbm") |
354 | - target_link_libraries( |
355 | - raw-event-printer |
356 | - |
357 | - android-input |
358 | - ) |
359 | -endif() |
360 | - |
361 | -if(MIR_PLATFORM STREQUAL "android") |
362 | - target_link_libraries( |
363 | - raw-event-printer |
364 | - |
365 | - android-input |
366 | - ) |
367 | -endif() |
368 | - |
369 | -###### cooked-event-printer |
370 | - |
371 | -add_executable( |
372 | - cooked-event-printer |
373 | - cooked_event_printer.cpp |
374 | - ) |
375 | - |
376 | -set_target_properties( |
377 | - cooked-event-printer |
378 | - PROPERTIES |
379 | - COMPILE_FLAGS ${ANDROID_INPUT_COMPILE_FLAGS} |
380 | - ) |
381 | - |
382 | -if(MIR_PLATFORM STREQUAL "gbm") |
383 | - target_link_libraries( |
384 | - cooked-event-printer |
385 | - android-input |
386 | - ) |
387 | -endif() |
388 | - |
389 | -if(MIR_PLATFORM STREQUAL "android") |
390 | - target_link_libraries( |
391 | - cooked-event-printer |
392 | - android-input |
393 | - ) |
394 | -endif() |
395 | - |
396 | -###### dispatcher-check |
397 | - |
398 | -add_executable( |
399 | - dispatcher-check |
400 | - dispatcher_check.cpp |
401 | - ) |
402 | - |
403 | -set_target_properties( |
404 | - dispatcher-check |
405 | - PROPERTIES |
406 | - COMPILE_FLAGS ${ANDROID_INPUT_COMPILE_FLAGS} |
407 | - ) |
408 | - |
409 | -if(MIR_PLATFORM STREQUAL "gbm") |
410 | - target_link_libraries( |
411 | - dispatcher-check |
412 | - android-input |
413 | - -lrt |
414 | - -lpthread |
415 | - ) |
416 | -endif() |
417 | - |
418 | -if(MIR_PLATFORM STREQUAL "android") |
419 | - target_link_libraries( |
420 | - dispatcher-check |
421 | - android-input |
422 | - ) |
423 | -endif() |
424 | - |
425 | - |
426 | -target_link_libraries(cooked-event-printer ${Boost_LIBRARIES}) |
427 | -target_link_libraries(raw-event-printer ${Boost_LIBRARIES}) |
428 | -target_link_libraries(dispatcher-check ${Boost_LIBRARIES}) |
429 | - |
430 | |
431 | === removed file '3rd_party/android-input/tools/cooked_event_printer.cpp' |
432 | --- 3rd_party/android-input/tools/cooked_event_printer.cpp 2012-11-06 18:05:11 +0000 |
433 | +++ 3rd_party/android-input/tools/cooked_event_printer.cpp 1970-01-01 00:00:00 +0000 |
434 | @@ -1,127 +0,0 @@ |
435 | -#include <EventHub.h> |
436 | -#include <InputListener.h> |
437 | -#include <InputReader.h> |
438 | - |
439 | -#include <iostream> |
440 | - |
441 | -using namespace android; |
442 | - |
443 | -/****************************************************************************** |
444 | - * InputListener |
445 | - ******************************************************************************/ |
446 | - |
447 | -class InputListener : public android::InputListenerInterface { |
448 | -public: |
449 | - InputListener(); |
450 | - virtual ~InputListener(); |
451 | - |
452 | - virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args); |
453 | - virtual void notifyKey(const NotifyKeyArgs* args); |
454 | - virtual void notifyMotion(const NotifyMotionArgs* args); |
455 | - virtual void notifySwitch(const NotifySwitchArgs* args); |
456 | - virtual void notifyDeviceReset(const NotifyDeviceResetArgs* args); |
457 | -}; |
458 | - |
459 | -InputListener::InputListener() |
460 | -{ |
461 | -} |
462 | - |
463 | -InputListener::~InputListener() |
464 | -{ |
465 | -} |
466 | - |
467 | -void InputListener::notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) |
468 | -{ |
469 | -} |
470 | - |
471 | -void InputListener::notifyKey(const NotifyKeyArgs* args) |
472 | -{ |
473 | - std::cout << "key" << std::endl; |
474 | -} |
475 | - |
476 | -void InputListener::notifyMotion(const NotifyMotionArgs* args) |
477 | -{ |
478 | - std::cout << "motion" << std::endl; |
479 | -} |
480 | - |
481 | -void InputListener::notifySwitch(const NotifySwitchArgs* args) |
482 | -{ |
483 | -} |
484 | - |
485 | -void InputListener::notifyDeviceReset(const NotifyDeviceResetArgs* args) |
486 | -{ |
487 | -} |
488 | - |
489 | -/****************************************************************************** |
490 | - * InputReaderPolicy |
491 | - ******************************************************************************/ |
492 | - |
493 | -class InputReaderPolicy : public android::InputReaderPolicyInterface { |
494 | -public: |
495 | - InputReaderPolicy(); |
496 | - virtual ~InputReaderPolicy() { } |
497 | - |
498 | - virtual void getReaderConfiguration(InputReaderConfiguration* outConfig); |
499 | - virtual sp<PointerControllerInterface> obtainPointerController(int32_t deviceId); |
500 | - virtual void notifyInputDevicesChanged(const Vector<InputDeviceInfo>& inputDevices); |
501 | - virtual sp<KeyCharacterMap> getKeyboardLayoutOverlay(const String8& inputDeviceDescriptor); |
502 | - virtual String8 getDeviceAlias(const InputDeviceIdentifier& identifier); |
503 | -private: |
504 | - sp<android::PointerController> mPointerController; |
505 | -}; |
506 | - |
507 | -InputReaderPolicy::InputReaderPolicy() |
508 | -{ |
509 | - mPointerController = new android::PointerController; |
510 | - mPointerController->setDisplaySize(1280, 1024); |
511 | - mPointerController->setDisplayOrientation(android::DISPLAY_ORIENTATION_0); |
512 | -} |
513 | - |
514 | -void InputReaderPolicy::getReaderConfiguration(InputReaderConfiguration* outConfig) |
515 | -{ |
516 | - outConfig->setDisplayInfo(0, /* id */ |
517 | - false, /* external */ |
518 | - 1280, /* width */ |
519 | - 1024, /*height*/ |
520 | - DISPLAY_ORIENTATION_0 /* orientation */); |
521 | -} |
522 | - |
523 | -sp<PointerControllerInterface> InputReaderPolicy::obtainPointerController(int32_t deviceId) |
524 | -{ |
525 | - return mPointerController; |
526 | -} |
527 | - |
528 | -void InputReaderPolicy::notifyInputDevicesChanged(const Vector<InputDeviceInfo>& inputDevices) |
529 | -{ |
530 | -} |
531 | - |
532 | -sp<KeyCharacterMap> InputReaderPolicy::getKeyboardLayoutOverlay(const String8& inputDeviceDescriptor) |
533 | -{ |
534 | - return KeyCharacterMap::empty(); |
535 | -} |
536 | - |
537 | -String8 InputReaderPolicy::getDeviceAlias(const InputDeviceIdentifier& identifier) |
538 | -{ |
539 | - return String8(); |
540 | -} |
541 | - |
542 | -/****************************************************************************** |
543 | - * main |
544 | - ******************************************************************************/ |
545 | - |
546 | -int main() |
547 | -{ |
548 | - sp<EventHub> eventHub = new EventHub; |
549 | - sp<InputReaderPolicy> inputReaderPolicy = new InputReaderPolicy; |
550 | - sp<InputListener> inputListener = new InputListener; |
551 | - |
552 | - InputReader* inputReader = new InputReader(eventHub, |
553 | - inputReaderPolicy, |
554 | - inputListener); |
555 | - |
556 | - while (true) { |
557 | - inputReader->loopOnce(); |
558 | - } |
559 | - |
560 | - return 0; |
561 | -} |
562 | |
563 | === removed file '3rd_party/android-input/tools/dispatcher_check.cpp' |
564 | --- 3rd_party/android-input/tools/dispatcher_check.cpp 2013-05-03 16:38:07 +0000 |
565 | +++ 3rd_party/android-input/tools/dispatcher_check.cpp 1970-01-01 00:00:00 +0000 |
566 | @@ -1,302 +0,0 @@ |
567 | - |
568 | -#include <InputManager.h> |
569 | -#include <pthread.h> |
570 | -#include <std/Thread.h> |
571 | -#include <iostream> |
572 | - |
573 | -using namespace android; |
574 | - |
575 | -/****************************************************************************** |
576 | - * InputReaderPolicy |
577 | - ******************************************************************************/ |
578 | - |
579 | -class InputReaderPolicy : public InputReaderPolicyInterface |
580 | -{ |
581 | -public: |
582 | - InputReaderPolicy(); |
583 | - virtual ~InputReaderPolicy() { } |
584 | - |
585 | - virtual void getReaderConfiguration(InputReaderConfiguration* outConfig); |
586 | - virtual sp<PointerControllerInterface> obtainPointerController(int32_t deviceId); |
587 | - virtual void notifyInputDevicesChanged(const Vector<InputDeviceInfo>& inputDevices); |
588 | - virtual sp<KeyCharacterMap> getKeyboardLayoutOverlay(const String8& inputDeviceDescriptor); |
589 | - virtual String8 getDeviceAlias(const InputDeviceIdentifier& identifier); |
590 | -private: |
591 | - sp<android::PointerController> mPointerController; |
592 | -}; |
593 | - |
594 | -InputReaderPolicy::InputReaderPolicy() |
595 | -{ |
596 | - mPointerController = new android::PointerController; |
597 | - mPointerController->setDisplaySize(1280, 1024); |
598 | - mPointerController->setDisplayOrientation(android::DISPLAY_ORIENTATION_0); |
599 | -} |
600 | - |
601 | -void InputReaderPolicy::getReaderConfiguration(InputReaderConfiguration* outConfig) |
602 | -{ |
603 | - outConfig->setDisplayInfo(0, /* id */ |
604 | - false, /* external */ |
605 | - 1280, /* width */ |
606 | - 1024, /*height*/ |
607 | - DISPLAY_ORIENTATION_0 /* orientation */); |
608 | -} |
609 | - |
610 | -sp<PointerControllerInterface> InputReaderPolicy::obtainPointerController(int32_t deviceId) |
611 | -{ |
612 | - return mPointerController; |
613 | -} |
614 | - |
615 | -void InputReaderPolicy::notifyInputDevicesChanged(const Vector<InputDeviceInfo>& inputDevices) |
616 | -{ |
617 | -} |
618 | - |
619 | -sp<KeyCharacterMap> InputReaderPolicy::getKeyboardLayoutOverlay(const String8& inputDeviceDescriptor) |
620 | -{ |
621 | - return KeyCharacterMap::empty(); |
622 | -} |
623 | - |
624 | -String8 InputReaderPolicy::getDeviceAlias(const InputDeviceIdentifier& identifier) |
625 | -{ |
626 | - return String8(); |
627 | -} |
628 | - |
629 | -/****************************************************************************** |
630 | - * InputDispatcherPolicy |
631 | - ******************************************************************************/ |
632 | - |
633 | -class InputDispatcherPolicy : public InputDispatcherPolicyInterface |
634 | -{ |
635 | -public: |
636 | - InputDispatcherPolicy() {} |
637 | - virtual ~InputDispatcherPolicy() {} |
638 | - |
639 | - virtual void notifyConfigurationChanged(nsecs_t when); |
640 | - virtual nsecs_t notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle, |
641 | - const sp<InputWindowHandle>& inputWindowHandle); |
642 | - virtual void notifyInputChannelBroken(const sp<InputWindowHandle>& inputWindowHandle); |
643 | - virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig); |
644 | - virtual bool isKeyRepeatEnabled(); |
645 | - virtual bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags); |
646 | - virtual void interceptKeyBeforeQueueing(const KeyEvent* keyEvent, uint32_t& policyFlags); |
647 | - virtual void interceptMotionBeforeQueueing(nsecs_t when, uint32_t& policyFlags); |
648 | - virtual nsecs_t interceptKeyBeforeDispatching(const sp<InputWindowHandle>& inputWindowHandle, |
649 | - const KeyEvent* keyEvent, uint32_t policyFlags); |
650 | - virtual bool dispatchUnhandledKey(const sp<InputWindowHandle>& inputWindowHandle, |
651 | - const KeyEvent* keyEvent, uint32_t policyFlags, KeyEvent* outFallbackKeyEvent); |
652 | - virtual void notifySwitch(nsecs_t when, |
653 | - int32_t switchCode, int32_t switchValue, uint32_t policyFlags); |
654 | - virtual void pokeUserActivity(nsecs_t eventTime, int32_t eventType); |
655 | - virtual bool checkInjectEventsPermissionNonReentrant( |
656 | - int32_t injectorPid, int32_t injectorUid); |
657 | -}; |
658 | - |
659 | -void InputDispatcherPolicy::notifyConfigurationChanged(nsecs_t when) |
660 | -{ |
661 | - (void)when; |
662 | -} |
663 | - |
664 | -nsecs_t InputDispatcherPolicy::notifyANR( |
665 | - const sp<InputApplicationHandle>& inputApplicationHandle, |
666 | - const sp<InputWindowHandle>& inputWindowHandle) |
667 | -{ |
668 | - (void)inputApplicationHandle; |
669 | - (void)inputWindowHandle; |
670 | - return 0; |
671 | -} |
672 | - |
673 | -void InputDispatcherPolicy::notifyInputChannelBroken( |
674 | - const sp<InputWindowHandle>& inputWindowHandle) |
675 | -{ |
676 | - (void)inputWindowHandle; |
677 | -} |
678 | - |
679 | -void InputDispatcherPolicy::getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) |
680 | -{ |
681 | - (void)outConfig; |
682 | -} |
683 | - |
684 | -bool InputDispatcherPolicy::isKeyRepeatEnabled() |
685 | -{ |
686 | - return true; |
687 | -} |
688 | - |
689 | -bool InputDispatcherPolicy::filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) |
690 | -{ |
691 | - (void)inputEvent; |
692 | - (void)policyFlags; |
693 | - return true; |
694 | -} |
695 | - |
696 | -void InputDispatcherPolicy::interceptKeyBeforeQueueing(const KeyEvent* keyEvent, |
697 | - uint32_t& policyFlags) |
698 | -{ |
699 | - (void)keyEvent; |
700 | - policyFlags = POLICY_FLAG_PASS_TO_USER; |
701 | -} |
702 | - |
703 | -void InputDispatcherPolicy::interceptMotionBeforeQueueing(nsecs_t when, uint32_t& policyFlags) |
704 | -{ |
705 | - (void)when; |
706 | - policyFlags = POLICY_FLAG_PASS_TO_USER; |
707 | -} |
708 | - |
709 | -nsecs_t InputDispatcherPolicy::interceptKeyBeforeDispatching( |
710 | - const sp<InputWindowHandle>& inputWindowHandle, |
711 | - const KeyEvent* keyEvent, uint32_t policyFlags) |
712 | -{ |
713 | - (void)inputWindowHandle; |
714 | - (void)keyEvent; |
715 | - (void)policyFlags; |
716 | - return 0; |
717 | -} |
718 | - |
719 | -bool InputDispatcherPolicy::dispatchUnhandledKey(const sp<InputWindowHandle>& inputWindowHandle, |
720 | - const KeyEvent* keyEvent, uint32_t policyFlags, KeyEvent* outFallbackKeyEvent) |
721 | -{ |
722 | - (void)inputWindowHandle; |
723 | - (void)keyEvent; |
724 | - (void)policyFlags; |
725 | - (void)outFallbackKeyEvent; |
726 | - return false; |
727 | -} |
728 | - |
729 | -void InputDispatcherPolicy::notifySwitch(nsecs_t when, |
730 | - int32_t switchCode, int32_t switchValue, uint32_t policyFlags) |
731 | -{ |
732 | - (void)when; |
733 | - (void)switchCode; |
734 | - (void)switchValue; |
735 | - (void)policyFlags; |
736 | -} |
737 | - |
738 | -void InputDispatcherPolicy::pokeUserActivity(nsecs_t eventTime, int32_t eventType) |
739 | -{ |
740 | - (void)eventTime; |
741 | - (void)eventType; |
742 | -} |
743 | - |
744 | -bool InputDispatcherPolicy::checkInjectEventsPermissionNonReentrant( |
745 | - int32_t injectorPid, int32_t injectorUid) |
746 | -{ |
747 | - (void)injectorPid; |
748 | - (void)injectorUid; |
749 | - return true; |
750 | -} |
751 | - |
752 | -/****************************************************************************** |
753 | - * FakeWindowHandle |
754 | - ******************************************************************************/ |
755 | - |
756 | -class FakeWindowHandle : public InputWindowHandle |
757 | -{ |
758 | -public: |
759 | - FakeWindowHandle(const sp<InputApplicationHandle>& inputApplicationHandle) |
760 | - : InputWindowHandle(inputApplicationHandle) { |
761 | - mInfo = new InputWindowInfo; |
762 | - } |
763 | - virtual ~FakeWindowHandle() {} |
764 | - |
765 | - bool updateInfo() { return true; } |
766 | - |
767 | - InputWindowInfo* info() {return mInfo;} |
768 | -}; |
769 | - |
770 | -/****************************************************************************** |
771 | - * FakeApplicationHandle |
772 | - ******************************************************************************/ |
773 | - |
774 | -class FakeApplicationHandle : public InputApplicationHandle |
775 | -{ |
776 | -public: |
777 | - virtual bool updateInfo() { return true; } |
778 | -}; |
779 | - |
780 | -/****************************************************************************** |
781 | - * ClientThread |
782 | - ******************************************************************************/ |
783 | - |
784 | -class ClientThread : public Thread { |
785 | -public: |
786 | - explicit ClientThread(const sp<InputChannel>& inputChannel); |
787 | - ~ClientThread() {} |
788 | - |
789 | -private: |
790 | - virtual bool threadLoop(); |
791 | - void printEvent(InputEvent *event, uint32_t seq); |
792 | - |
793 | - InputConsumer inputConsumer; |
794 | - PooledInputEventFactory eventFactory; |
795 | -}; |
796 | - |
797 | -ClientThread::ClientThread(const sp<InputChannel>& inputChannel) |
798 | - : Thread(), inputConsumer(inputChannel) |
799 | -{ |
800 | -} |
801 | - |
802 | -bool ClientThread::threadLoop() |
803 | -{ |
804 | - status_t status; |
805 | - uint32_t seq; |
806 | - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); |
807 | - InputEvent *event; |
808 | - |
809 | - status = inputConsumer.consume(&eventFactory, true /* consumeBatches */, |
810 | - now, &seq, &event); |
811 | - |
812 | - if (status == OK) { |
813 | - printEvent(event, seq); |
814 | - inputConsumer.sendFinishedSignal(seq, true /* handled */); |
815 | - } |
816 | - |
817 | - // Continue the thread if this condition is met |
818 | - return status == OK || status == WOULD_BLOCK; |
819 | -} |
820 | - |
821 | -void ClientThread::printEvent(InputEvent *event, uint32_t seq) |
822 | -{ |
823 | - std::cout << "client got event, seq " << seq << std::endl; |
824 | -} |
825 | - |
826 | -/****************************************************************************** |
827 | - * main |
828 | - ******************************************************************************/ |
829 | - |
830 | -int main() |
831 | -{ |
832 | - sp<EventHub> eventHub = new EventHub; |
833 | - sp<InputReaderPolicy> inputReaderPolicy = new InputReaderPolicy; |
834 | - sp<InputDispatcherPolicy> inputDispatcherPolicy = new InputDispatcherPolicy; |
835 | - sp<InputManager> inputManager = new InputManager(eventHub, |
836 | - inputReaderPolicy, |
837 | - inputDispatcherPolicy); |
838 | - |
839 | - |
840 | - sp<FakeWindowHandle> windowHandle = new FakeWindowHandle(new FakeApplicationHandle); |
841 | - Vector<sp<InputWindowHandle> > inputWindowHandles; |
842 | - inputWindowHandles.push(windowHandle); |
843 | - |
844 | - sp<InputChannel> serverChannel, clientChannel; |
845 | - status_t status = InputChannel::openInputChannelPair(String8("foo"), |
846 | - serverChannel, |
847 | - clientChannel); |
848 | - assert(status == OK); |
849 | - |
850 | - windowHandle->info()->inputChannel = serverChannel; |
851 | - windowHandle->info()->hasFocus = true; |
852 | - |
853 | - sp<InputDispatcherInterface> dispatcher = inputManager->getDispatcher(); |
854 | - dispatcher->setInputWindows(inputWindowHandles); |
855 | - dispatcher->registerInputChannel(serverChannel, windowHandle, false); |
856 | - dispatcher->setInputDispatchMode(true /* enabled */, false /* frozen */); |
857 | - |
858 | - inputManager->start(); |
859 | - |
860 | - sp<ClientThread> clientThread = new ClientThread(clientChannel); |
861 | - clientThread->run(); |
862 | - |
863 | - clientThread->join(); |
864 | - |
865 | - inputManager->stop(); |
866 | - |
867 | - return 0; |
868 | -} |
869 | |
870 | === removed file '3rd_party/android-input/tools/raw_event_printer.cpp' |
871 | --- 3rd_party/android-input/tools/raw_event_printer.cpp 2012-11-06 18:05:11 +0000 |
872 | +++ 3rd_party/android-input/tools/raw_event_printer.cpp 1970-01-01 00:00:00 +0000 |
873 | @@ -1,34 +0,0 @@ |
874 | -#include <EventHub.h> |
875 | -#include <iostream> |
876 | - |
877 | -static void printRawEvent(const android::RawEvent &raw_event) |
878 | -{ |
879 | - std::cout << "==== RawEvent ====" << std::endl; |
880 | - std::cout << "when : " << raw_event.when << std::endl; |
881 | - std::cout << "deviceId: " << raw_event.deviceId << std::endl; |
882 | - std::cout << "type : " << raw_event.type << std::endl; |
883 | - std::cout << "code : " << raw_event.code << std::endl; |
884 | - std::cout << "value : " << raw_event.value << std::endl; |
885 | - std::cout << "==================" << std::endl; |
886 | - std::cout << std::endl; |
887 | -} |
888 | - |
889 | -int main() |
890 | -{ |
891 | - android::EventHub* event_hub = new android::EventHub; |
892 | - static const size_t buffer_size = 100; |
893 | - android::RawEvent raw_events[buffer_size]; |
894 | - |
895 | - size_t events_read; |
896 | - do |
897 | - { |
898 | - events_read = event_hub->getEvents(10000, raw_events, buffer_size); |
899 | - for (size_t i = 0; i < events_read; ++i) |
900 | - { |
901 | - printRawEvent(raw_events[i]); |
902 | - } |
903 | - } |
904 | - while(events_read > 0); |
905 | - |
906 | - return 0; |
907 | -} |
908 | |
909 | === modified file 'include/server/mir/default_server_configuration.h' |
910 | --- include/server/mir/default_server_configuration.h 2013-05-13 23:27:28 +0000 |
911 | +++ include/server/mir/default_server_configuration.h 2013-05-29 14:16:28 +0000 |
912 | @@ -82,6 +82,7 @@ |
913 | } |
914 | namespace input |
915 | { |
916 | +class InputReport; |
917 | class InputManager; |
918 | class EventFilter; |
919 | class InputChannelFactory; |
920 | @@ -183,6 +184,7 @@ |
921 | |
922 | /** @name input configuration |
923 | * @{ */ |
924 | + virtual std::shared_ptr<input::InputReport> the_input_report(); |
925 | virtual std::shared_ptr<input::android::InputConfiguration> the_input_configuration(); |
926 | virtual std::initializer_list<std::shared_ptr<input::EventFilter> const> the_event_filters(); |
927 | virtual std::shared_ptr<shell::InputTargetListener> the_input_target_listener(); |
928 | @@ -210,6 +212,8 @@ |
929 | |
930 | CachedPtr<frontend::Communicator> communicator; |
931 | CachedPtr<shell::SessionManager> session_manager; |
932 | + |
933 | + CachedPtr<input::InputReport> input_report; |
934 | std::shared_ptr<input::android::InputConfiguration> input_configuration; |
935 | CachedPtr<input::InputManager> input_manager; |
936 | CachedPtr<shell::InputTargetListener> input_target_listener; |
937 | |
938 | === added file 'include/server/mir/input/input_report.h' |
939 | --- include/server/mir/input/input_report.h 1970-01-01 00:00:00 +0000 |
940 | +++ include/server/mir/input/input_report.h 2013-05-29 14:16:28 +0000 |
941 | @@ -0,0 +1,52 @@ |
942 | +/* |
943 | + * Copyright © 2013 Canonical Ltd. |
944 | + * |
945 | + * This program is free software: you can redistribute it and/or modify it |
946 | + * under the terms of the GNU General Public License version 3, |
947 | + * as published by the Free Software Foundation. |
948 | + * |
949 | + * This program is distributed in the hope that it will be useful, |
950 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
951 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
952 | + * GNU General Public License for more details. |
953 | + * |
954 | + * You should have received a copy of the GNU General Public License |
955 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
956 | + * |
957 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
958 | + */ |
959 | + |
960 | + |
961 | +#ifndef MIR_INPUT_INPUT_REPORT_H_ |
962 | +#define MIR_INPUT_INPUT_REPORT_H_ |
963 | + |
964 | +#include <stdint.h> |
965 | + |
966 | +namespace mir |
967 | +{ |
968 | +namespace input |
969 | +{ |
970 | + |
971 | +class InputReport |
972 | +{ |
973 | +public: |
974 | + virtual ~InputReport() = default; |
975 | + |
976 | + virtual void received_event_from_kernel(int64_t when, int type, int code, int value) = 0; |
977 | + |
978 | + virtual void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0; |
979 | + |
980 | + virtual void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0; |
981 | + |
982 | + virtual void received_event_finished_signal(int src_fd, uint32_t seq_id) = 0; |
983 | + |
984 | +protected: |
985 | + InputReport() = default; |
986 | + InputReport(InputReport const&) = delete; |
987 | + InputReport& operator=(InputReport const&) = delete; |
988 | +}; |
989 | + |
990 | +} |
991 | +} |
992 | + |
993 | +#endif /* MIR_INPUT_INPUT_REPORT_H_ */ |
994 | |
995 | === added file 'include/server/mir/input/null_input_report.h' |
996 | --- include/server/mir/input/null_input_report.h 1970-01-01 00:00:00 +0000 |
997 | +++ include/server/mir/input/null_input_report.h 2013-05-29 14:16:28 +0000 |
998 | @@ -0,0 +1,47 @@ |
999 | +/* |
1000 | + * Copyright © 2013 Canonical Ltd. |
1001 | + * |
1002 | + * This program is free software: you can redistribute it and/or modify it |
1003 | + * under the terms of the GNU General Public License version 3, |
1004 | + * as published by the Free Software Foundation. |
1005 | + * |
1006 | + * This program is distributed in the hope that it will be useful, |
1007 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1008 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1009 | + * GNU General Public License for more details. |
1010 | + * |
1011 | + * You should have received a copy of the GNU General Public License |
1012 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1013 | + * |
1014 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
1015 | + */ |
1016 | + |
1017 | + |
1018 | +#ifndef MIR_INPUT_NULL_INPUT_REPORT_H_ |
1019 | +#define MIR_INPUT_NULL_INPUT_REPORT_H_ |
1020 | + |
1021 | +#include "mir/input/input_report.h" |
1022 | + |
1023 | +namespace mir |
1024 | +{ |
1025 | +namespace input |
1026 | +{ |
1027 | + |
1028 | +class NullInputReport : public InputReport |
1029 | +{ |
1030 | +public: |
1031 | + NullInputReport() = default; |
1032 | + virtual ~NullInputReport() noexcept(true) = default; |
1033 | + |
1034 | + void received_event_from_kernel(int64_t when, int type, int code, int value); |
1035 | + |
1036 | + void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
1037 | + void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
1038 | + |
1039 | + void received_event_finished_signal(int src_fd, uint32_t seq_id); |
1040 | +}; |
1041 | + |
1042 | +} |
1043 | +} |
1044 | + |
1045 | +#endif /* MIR_INPUT_NULL_INPUT_REPORT_H_ */ |
1046 | |
1047 | === modified file 'include/server/mir/logging/input_report.h' |
1048 | --- include/server/mir/logging/input_report.h 2013-05-03 23:19:47 +0000 |
1049 | +++ include/server/mir/logging/input_report.h 2013-05-29 14:16:28 +0000 |
1050 | @@ -19,6 +19,8 @@ |
1051 | #ifndef MIR_LOGGING_INPUT_REPORT_H_ |
1052 | #define MIR_LOGGING_INPUT_REPORT_H_ |
1053 | |
1054 | +#include "mir/input/input_report.h" |
1055 | + |
1056 | #include <memory> |
1057 | |
1058 | namespace mir |
1059 | @@ -27,10 +29,29 @@ |
1060 | { |
1061 | class Logger; |
1062 | |
1063 | -namespace input_report |
1064 | +namespace legacy_input_report |
1065 | { |
1066 | void initialize(std::shared_ptr<Logger> const& logger); |
1067 | } |
1068 | + |
1069 | +class InputReport : public input::InputReport |
1070 | +{ |
1071 | +public: |
1072 | + InputReport(std::shared_ptr<Logger> const& logger); |
1073 | + virtual ~InputReport() noexcept(true) = default; |
1074 | + |
1075 | + void received_event_from_kernel(int64_t when, int type, int code, int value); |
1076 | + |
1077 | + void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
1078 | + void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
1079 | + |
1080 | + void received_event_finished_signal(int src_fd, uint32_t seq_id); |
1081 | + |
1082 | +private: |
1083 | + char const* component(); |
1084 | + std::shared_ptr<Logger> const logger; |
1085 | +}; |
1086 | + |
1087 | } |
1088 | } |
1089 | |
1090 | |
1091 | === added file 'include/server/mir/lttng/input_report.h' |
1092 | --- include/server/mir/lttng/input_report.h 1970-01-01 00:00:00 +0000 |
1093 | +++ include/server/mir/lttng/input_report.h 2013-05-29 14:16:28 +0000 |
1094 | @@ -0,0 +1,51 @@ |
1095 | +/* |
1096 | + * Copyright © 2013 Canonical Ltd. |
1097 | + * |
1098 | + * This program is free software: you can redistribute it and/or modify it |
1099 | + * under the terms of the GNU General Public License version 3, |
1100 | + * as published by the Free Software Foundation. |
1101 | + * |
1102 | + * This program is distributed in the hope that it will be useful, |
1103 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1104 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1105 | + * GNU General Public License for more details. |
1106 | + * |
1107 | + * You should have received a copy of the GNU General Public License |
1108 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1109 | + * |
1110 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
1111 | + */ |
1112 | + |
1113 | +#ifndef MIR_LTTNG_INPUT_REPORT_H_ |
1114 | +#define MIR_LTTNG_INPUT_REPORT_H_ |
1115 | + |
1116 | +#include "mir/input/input_report.h" |
1117 | +#include "mir/lttng/tracepoint_provider.h" |
1118 | + |
1119 | +namespace mir |
1120 | +{ |
1121 | +namespace lttng |
1122 | +{ |
1123 | + |
1124 | +class InputReport : public input::InputReport |
1125 | +{ |
1126 | +public: |
1127 | + InputReport() = default; |
1128 | + virtual ~InputReport() noexcept(true) = default; |
1129 | + |
1130 | + void received_event_from_kernel(int64_t when, int type, int code, int value); |
1131 | + |
1132 | + void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
1133 | + void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
1134 | + |
1135 | + void received_event_finished_signal(int src_fd, uint32_t seq_id); |
1136 | + |
1137 | +private: |
1138 | + TracepointProvider tp_provider; |
1139 | +}; |
1140 | + |
1141 | +} |
1142 | +} |
1143 | + |
1144 | + |
1145 | +#endif /* MIR_LTTNG_INPUT_REPORT_H_ */ |
1146 | |
1147 | === modified file 'include/test/mir_test/fake_event_hub_input_configuration.h' |
1148 | --- include/test/mir_test/fake_event_hub_input_configuration.h 2013-04-26 16:12:22 +0000 |
1149 | +++ include/test/mir_test/fake_event_hub_input_configuration.h 2013-05-29 14:16:28 +0000 |
1150 | @@ -42,6 +42,7 @@ |
1151 | { |
1152 | class CursorListener; |
1153 | class EventFilter; |
1154 | +class InputReport; |
1155 | |
1156 | namespace android |
1157 | { |
1158 | @@ -56,9 +57,10 @@ |
1159 | class FakeEventHubInputConfiguration : public input::android::DefaultInputConfiguration |
1160 | { |
1161 | public: |
1162 | - FakeEventHubInputConfiguration(std::initializer_list<std::shared_ptr<mir::input::EventFilter> const> const& filters, |
1163 | - std::shared_ptr<mir::graphics::ViewableArea> const& view_area, |
1164 | - std::shared_ptr<mir::input::CursorListener> const& cursor_listener); |
1165 | + FakeEventHubInputConfiguration(std::initializer_list<std::shared_ptr<input::EventFilter> const> const& filters, |
1166 | + std::shared_ptr<graphics::ViewableArea> const& view_area, |
1167 | + std::shared_ptr<input::CursorListener> const& cursor_listener, |
1168 | + std::shared_ptr<input::InputReport> const& input_report); |
1169 | virtual ~FakeEventHubInputConfiguration(); |
1170 | |
1171 | droidinput::sp<droidinput::EventHubInterface> the_event_hub(); |
1172 | |
1173 | === modified file 'src/server/default_server_configuration.cpp' |
1174 | --- src/server/default_server_configuration.cpp 2013-05-22 17:41:14 +0000 |
1175 | +++ src/server/default_server_configuration.cpp 2013-05-29 14:16:28 +0000 |
1176 | @@ -50,6 +50,7 @@ |
1177 | #include "mir/input/cursor_listener.h" |
1178 | #include "mir/input/null_input_manager.h" |
1179 | #include "mir/input/null_input_target_listener.h" |
1180 | +#include "mir/input/null_input_report.h" |
1181 | #include "input/android/default_android_input_configuration.h" |
1182 | #include "input/android/android_input_manager.h" |
1183 | #include "input/android/android_dispatcher_controller.h" |
1184 | @@ -61,6 +62,7 @@ |
1185 | #include "mir/logging/message_processor_report.h" |
1186 | #include "mir/logging/display_report.h" |
1187 | #include "mir/lttng/message_processor_report.h" |
1188 | +#include "mir/lttng/input_report.h" |
1189 | #include "mir/shell/surface_source.h" |
1190 | #include "mir/surfaces/surface_stack.h" |
1191 | #include "mir/surfaces/surface_controller.h" |
1192 | @@ -141,6 +143,7 @@ |
1193 | char const* const session_mediator_report_opt = "session-mediator-report"; |
1194 | char const* const msg_processor_report_opt = "msg-processor-report"; |
1195 | char const* const display_report_opt = "display-report"; |
1196 | +char const* const legacy_input_report_opt = "legacy-input-report"; |
1197 | char const* const input_report_opt = "input-report"; |
1198 | |
1199 | char const* const glog = "glog"; |
1200 | @@ -215,7 +218,9 @@ |
1201 | (display_report_opt, po::value<std::string>(), |
1202 | "How to handle the Display report. [{log,off}:default=off]") |
1203 | (input_report_opt, po::value<std::string>(), |
1204 | - "How to handle the Input report. [{log,off}:default=off]") |
1205 | + "How to handle to Input report. [{log,lttng,off}:default=off]") |
1206 | + (legacy_input_report_opt, po::value<std::string>(), |
1207 | + "How to handle the Legacy Input report. [{log,off}:default=off]") |
1208 | (session_mediator_report_opt, po::value<std::string>(), |
1209 | "How to handle the SessionMediator report. [{log,off}:default=off]") |
1210 | (msg_processor_report_opt, po::value<std::string>(), |
1211 | @@ -412,6 +417,29 @@ |
1212 | return empty_filter_list; |
1213 | } |
1214 | |
1215 | +std::shared_ptr<mi::InputReport> |
1216 | +mir::DefaultServerConfiguration::the_input_report() |
1217 | +{ |
1218 | + return input_report( |
1219 | + [this]() -> std::shared_ptr<mi::InputReport> |
1220 | + { |
1221 | + auto opt = the_options()->get(input_report_opt, off_opt_value); |
1222 | + |
1223 | + if (opt == log_opt_value) |
1224 | + { |
1225 | + return std::make_shared<ml::InputReport>(the_logger()); |
1226 | + } |
1227 | + else if (opt == lttng_opt_value) |
1228 | + { |
1229 | + return std::make_shared<mir::lttng::InputReport>(); |
1230 | + } |
1231 | + else |
1232 | + { |
1233 | + return std::make_shared<mi::NullInputReport>(); |
1234 | + } |
1235 | + }); |
1236 | +} |
1237 | + |
1238 | std::shared_ptr<mia::InputConfiguration> |
1239 | mir::DefaultServerConfiguration::the_input_configuration() |
1240 | { |
1241 | @@ -438,7 +466,8 @@ |
1242 | input_configuration = std::make_shared<mia::DefaultInputConfiguration>( |
1243 | the_event_filters(), |
1244 | the_display(), |
1245 | - std::make_shared<DefaultCursorListener>(the_display()->the_cursor())); |
1246 | + std::make_shared<DefaultCursorListener>(the_display()->the_cursor()), |
1247 | + the_input_report()); |
1248 | } |
1249 | return input_configuration; |
1250 | } |
1251 | @@ -451,8 +480,8 @@ |
1252 | { |
1253 | if (the_options()->get("enable-input", enable_input_default)) |
1254 | { |
1255 | - if (the_options()->get(input_report_opt, off_opt_value) == log_opt_value) |
1256 | - ml::input_report::initialize(the_logger()); |
1257 | + if (the_options()->get(legacy_input_report_opt, off_opt_value) == log_opt_value) |
1258 | + ml::legacy_input_report::initialize(the_logger()); |
1259 | return std::make_shared<mia::InputManager>(the_input_configuration()); |
1260 | } |
1261 | else |
1262 | |
1263 | === modified file 'src/server/input/CMakeLists.txt' |
1264 | --- src/server/input/CMakeLists.txt 2013-04-24 05:22:20 +0000 |
1265 | +++ src/server/input/CMakeLists.txt 2013-05-29 14:16:28 +0000 |
1266 | @@ -2,6 +2,7 @@ |
1267 | INPUT_SOURCES |
1268 | |
1269 | event_filter_chain.cpp |
1270 | + null_input_report.cpp |
1271 | ) |
1272 | |
1273 | add_subdirectory(android) |
1274 | |
1275 | === modified file 'src/server/input/android/default_android_input_configuration.cpp' |
1276 | --- src/server/input/android/default_android_input_configuration.cpp 2013-05-02 00:11:18 +0000 |
1277 | +++ src/server/input/android/default_android_input_configuration.cpp 2013-05-29 14:16:28 +0000 |
1278 | @@ -73,10 +73,12 @@ |
1279 | |
1280 | mia::DefaultInputConfiguration::DefaultInputConfiguration(std::initializer_list<std::shared_ptr<mi::EventFilter> const> const& filters, |
1281 | std::shared_ptr<mg::ViewableArea> const& view_area, |
1282 | - std::shared_ptr<mi::CursorListener> const& cursor_listener) |
1283 | + std::shared_ptr<mi::CursorListener> const& cursor_listener, |
1284 | + std::shared_ptr<mi::InputReport> const& input_report) |
1285 | : filter_chain(std::make_shared<mi::EventFilterChain>(filters)), |
1286 | view_area(view_area), |
1287 | - cursor_listener(cursor_listener) |
1288 | + cursor_listener(cursor_listener), |
1289 | + input_report(input_report) |
1290 | { |
1291 | } |
1292 | |
1293 | @@ -89,7 +91,7 @@ |
1294 | return event_hub( |
1295 | [this]() |
1296 | { |
1297 | - return new droidinput::EventHub(); |
1298 | + return new droidinput::EventHub(input_report); |
1299 | }); |
1300 | } |
1301 | |
1302 | @@ -107,7 +109,7 @@ |
1303 | return dispatcher( |
1304 | [this]() |
1305 | { |
1306 | - return new droidinput::InputDispatcher(the_dispatcher_policy()); |
1307 | + return new droidinput::InputDispatcher(the_dispatcher_policy(), input_report); |
1308 | }); |
1309 | } |
1310 | |
1311 | |
1312 | === modified file 'src/server/input/android/default_android_input_configuration.h' |
1313 | --- src/server/input/android/default_android_input_configuration.h 2013-05-02 00:11:18 +0000 |
1314 | +++ src/server/input/android/default_android_input_configuration.h 2013-05-29 14:16:28 +0000 |
1315 | @@ -48,6 +48,7 @@ |
1316 | class EventFilter; |
1317 | class EventFilterChain; |
1318 | class CursorListener; |
1319 | +class InputReport; |
1320 | |
1321 | namespace android |
1322 | { |
1323 | @@ -57,7 +58,8 @@ |
1324 | public: |
1325 | DefaultInputConfiguration(std::initializer_list<std::shared_ptr<EventFilter> const> const& filters, |
1326 | std::shared_ptr<graphics::ViewableArea> const& view_area, |
1327 | - std::shared_ptr<CursorListener> const& cursor_listener); |
1328 | + std::shared_ptr<CursorListener> const& cursor_listener, |
1329 | + std::shared_ptr<input::InputReport> const& input_report); |
1330 | virtual ~DefaultInputConfiguration(); |
1331 | |
1332 | droidinput::sp<droidinput::EventHubInterface> the_event_hub(); |
1333 | @@ -102,6 +104,7 @@ |
1334 | std::shared_ptr<EventFilterChain> const filter_chain; |
1335 | std::shared_ptr<graphics::ViewableArea> const view_area; |
1336 | std::shared_ptr<CursorListener> const cursor_listener; |
1337 | + std::shared_ptr<input::InputReport> const input_report; |
1338 | |
1339 | CachedPtr<InputThread> dispatcher_thread; |
1340 | CachedPtr<InputThread> reader_thread; |
1341 | |
1342 | === added file 'src/server/input/null_input_report.cpp' |
1343 | --- src/server/input/null_input_report.cpp 1970-01-01 00:00:00 +0000 |
1344 | +++ src/server/input/null_input_report.cpp 2013-05-29 14:16:28 +0000 |
1345 | @@ -0,0 +1,39 @@ |
1346 | +/* |
1347 | + * Copyright © 2013 Canonical Ltd. |
1348 | + * |
1349 | + * This program is free software: you can redistribute it and/or modify it |
1350 | + * under the terms of the GNU General Public License version 3, |
1351 | + * as published by the Free Software Foundation. |
1352 | + * |
1353 | + * This program is distributed in the hope that it will be useful, |
1354 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1355 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1356 | + * GNU General Public License for more details. |
1357 | + * |
1358 | + * You should have received a copy of the GNU General Public License |
1359 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1360 | + * |
1361 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
1362 | + */ |
1363 | + |
1364 | +#include "mir/input/null_input_report.h" |
1365 | + |
1366 | +namespace mi = mir::input; |
1367 | + |
1368 | +void mi::NullInputReport::received_event_from_kernel(int64_t /* when */, int /* type */, int /* code */, int /* value */) |
1369 | +{ |
1370 | +} |
1371 | + |
1372 | +void mi::NullInputReport::published_key_event(int /* dest_fd */, uint32_t /* seq_id */, int64_t /* event_time */) |
1373 | +{ |
1374 | +} |
1375 | + |
1376 | +void mi::NullInputReport::published_motion_event(int /* dest_fd */, uint32_t /* seq_id */, int64_t /* event_time */) |
1377 | +{ |
1378 | +} |
1379 | + |
1380 | +void mi::NullInputReport::received_event_finished_signal(int /* src_fd */, uint32_t /* seq_id */) |
1381 | +{ |
1382 | +} |
1383 | + |
1384 | + |
1385 | |
1386 | === modified file 'src/server/logging/input_report.cpp' |
1387 | --- src/server/logging/input_report.cpp 2013-05-04 00:04:19 +0000 |
1388 | +++ src/server/logging/input_report.cpp 2013-05-29 14:16:28 +0000 |
1389 | @@ -22,24 +22,27 @@ |
1390 | #include "std/MirLog.h" |
1391 | #include <std/Log.h> |
1392 | |
1393 | + |
1394 | +#include <sstream> |
1395 | +#include <cstring> |
1396 | #include <mutex> |
1397 | |
1398 | namespace ml = mir::logging; |
1399 | -namespace mli = mir::logging::input_report; |
1400 | +namespace mlil = mir::logging::legacy_input_report; |
1401 | |
1402 | namespace |
1403 | { |
1404 | char const* const component = "android-input"; |
1405 | |
1406 | -class MyInputReport; |
1407 | +class LegacyInputReport; |
1408 | |
1409 | std::mutex mutex; |
1410 | -std::shared_ptr<MyInputReport> the_input_report; |
1411 | +std::shared_ptr<LegacyInputReport> the_legacy_input_report; |
1412 | |
1413 | -class MyInputReport |
1414 | +class LegacyInputReport |
1415 | { |
1416 | public: |
1417 | - MyInputReport(std::shared_ptr<ml::Logger> const& logger) : |
1418 | + LegacyInputReport(std::shared_ptr<ml::Logger> const& logger) : |
1419 | logger(logger) |
1420 | { |
1421 | } |
1422 | @@ -75,15 +78,62 @@ |
1423 | void my_write_to_log(int prio, char const* buffer) |
1424 | { |
1425 | std::unique_lock<std::mutex> lock(mutex); |
1426 | - the_input_report->log(prio, buffer); |
1427 | -} |
1428 | -} |
1429 | - |
1430 | - |
1431 | -void mli::initialize(std::shared_ptr<Logger> const& logger) |
1432 | + the_legacy_input_report->log(prio, buffer); |
1433 | +} |
1434 | +} |
1435 | + |
1436 | + |
1437 | +void mlil::initialize(std::shared_ptr<Logger> const& logger) |
1438 | { |
1439 | std::unique_lock<std::mutex> lock(mutex); |
1440 | - ::the_input_report = std::make_shared<MyInputReport>(logger); |
1441 | + ::the_legacy_input_report = std::make_shared<LegacyInputReport>(logger); |
1442 | |
1443 | mir::write_to_log = my_write_to_log; |
1444 | } |
1445 | + |
1446 | + |
1447 | +ml::InputReport::InputReport(const std::shared_ptr<Logger>& logger) |
1448 | + : logger(logger) |
1449 | +{ |
1450 | +} |
1451 | + |
1452 | +const char* ml::InputReport::component() |
1453 | +{ |
1454 | + static const char* s = "input"; |
1455 | + return s; |
1456 | +} |
1457 | + |
1458 | +void ml::InputReport::received_event_from_kernel(int64_t when, int type, int code, int value) |
1459 | +{ |
1460 | + std::stringstream ss; |
1461 | + |
1462 | + ss << "Received event (when, type, code, value) from kernel: " |
1463 | + << "(" << when << "ns, " << type << ", " << code << ", " << value << ")"; |
1464 | + logger->log<Logger::informational>(ss.str(), component()); |
1465 | +} |
1466 | + |
1467 | +void ml::InputReport::published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time) |
1468 | +{ |
1469 | + std::stringstream ss; |
1470 | + |
1471 | + ss << "Published key event (seq_id, event_time) to fd " << dest_fd << ": (" |
1472 | + << seq_id << ", " << event_time << ")"; |
1473 | + logger->log<Logger::informational>(ss.str(), component()); |
1474 | +} |
1475 | + |
1476 | +void ml::InputReport::published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time) |
1477 | +{ |
1478 | + std::stringstream ss; |
1479 | + |
1480 | + ss << "Published motion event (seq_id, event_time) to fd " << dest_fd << ": (" |
1481 | + << seq_id << ", " << event_time << ")"; |
1482 | + logger->log<Logger::informational>(ss.str(), component()); |
1483 | +} |
1484 | + |
1485 | +void ml::InputReport::received_event_finished_signal(int src_fd, uint32_t seq_id) |
1486 | +{ |
1487 | + std::stringstream ss; |
1488 | + |
1489 | + ss << "Received event finished (seq_id) from fd " << src_fd << ": " << seq_id; |
1490 | + logger->log<Logger::informational>(ss.str(), component()); |
1491 | +} |
1492 | |
1493 | === modified file 'src/server/lttng/CMakeLists.txt' |
1494 | --- src/server/lttng/CMakeLists.txt 2013-05-22 10:24:51 +0000 |
1495 | +++ src/server/lttng/CMakeLists.txt 2013-05-29 14:16:28 +0000 |
1496 | @@ -5,6 +5,7 @@ |
1497 | |
1498 | tracepoint_provider.cpp |
1499 | message_processor_report.cpp |
1500 | + input_report.cpp |
1501 | ) |
1502 | |
1503 | add_library( |
1504 | @@ -17,6 +18,7 @@ |
1505 | MIR_SERVER_LTTNG_SOURCES |
1506 | |
1507 | message_processor_report_tp.c |
1508 | + input_report_tp.c |
1509 | ) |
1510 | |
1511 | add_library( |
1512 | |
1513 | === added file 'src/server/lttng/input_report.cpp' |
1514 | --- src/server/lttng/input_report.cpp 1970-01-01 00:00:00 +0000 |
1515 | +++ src/server/lttng/input_report.cpp 2013-05-29 14:16:28 +0000 |
1516 | @@ -0,0 +1,45 @@ |
1517 | +/* |
1518 | + * Copyright © 2013 Canonical Ltd. |
1519 | + * |
1520 | + * This program is free software: you can redistribute it and/or modify it |
1521 | + * under the terms of the GNU General Public License version 3, |
1522 | + * as published by the Free Software Foundation. |
1523 | + * |
1524 | + * This program is distributed in the hope that it will be useful, |
1525 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1526 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1527 | + * GNU General Public License for more details. |
1528 | + * |
1529 | + * You should have received a copy of the GNU General Public License |
1530 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1531 | + * |
1532 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
1533 | + */ |
1534 | + |
1535 | +#include "mir/lttng/input_report.h" |
1536 | + |
1537 | +#define TRACEPOINT_DEFINE |
1538 | +#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE |
1539 | +#include "input_report_tp.h" |
1540 | + |
1541 | +#include "mir_tracepoint.h" |
1542 | + |
1543 | +void mir::lttng::InputReport::received_event_from_kernel(int64_t when, int type, int code, int value) |
1544 | +{ |
1545 | + mir_tracepoint(mir_server_input, received_event_from_kernel, when, type, code, value); |
1546 | +} |
1547 | + |
1548 | +void mir::lttng::InputReport::published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time) |
1549 | +{ |
1550 | + mir_tracepoint(mir_server_input, published_key_event, dest_fd, seq_id, event_time); |
1551 | +} |
1552 | + |
1553 | +void mir::lttng::InputReport::published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time) |
1554 | +{ |
1555 | + mir_tracepoint(mir_server_input, published_motion_event, dest_fd, seq_id, event_time); |
1556 | +} |
1557 | + |
1558 | +void mir::lttng::InputReport::received_event_finished_signal(int src_fd, uint32_t seq_id) |
1559 | +{ |
1560 | + mir_tracepoint(mir_server_input, received_event_finished_signal, src_fd, seq_id); |
1561 | +} |
1562 | |
1563 | === added file 'src/server/lttng/input_report_tp.c' |
1564 | --- src/server/lttng/input_report_tp.c 1970-01-01 00:00:00 +0000 |
1565 | +++ src/server/lttng/input_report_tp.c 2013-05-29 14:16:28 +0000 |
1566 | @@ -0,0 +1,4 @@ |
1567 | +/* The probes need to be compiled in a C file (not C++) */ |
1568 | +#define TRACEPOINT_CREATE_PROBES |
1569 | + |
1570 | +#include "input_report_tp.h" |
1571 | |
1572 | === added file 'src/server/lttng/input_report_tp.h' |
1573 | --- src/server/lttng/input_report_tp.h 1970-01-01 00:00:00 +0000 |
1574 | +++ src/server/lttng/input_report_tp.h 2013-05-29 14:16:28 +0000 |
1575 | @@ -0,0 +1,78 @@ |
1576 | +/* |
1577 | + * Copyright © 2013 Canonical Ltd. |
1578 | + * |
1579 | + * This program is free software: you can redistribute it and/or modify it |
1580 | + * under the terms of the GNU General Public License version 3, |
1581 | + * as published by the Free Software Foundation. |
1582 | + * |
1583 | + * This program is distributed in the hope that it will be useful, |
1584 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1585 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1586 | + * GNU General Public License for more details. |
1587 | + * |
1588 | + * You should have received a copy of the GNU General Public License |
1589 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1590 | + * |
1591 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
1592 | + */ |
1593 | + |
1594 | +#undef TRACEPOINT_PROVIDER |
1595 | +#define TRACEPOINT_PROVIDER mir_server_input |
1596 | + |
1597 | +#undef TRACEPOINT_INCLUDE |
1598 | +#define TRACEPOINT_INCLUDE "./input_report_tp.h" |
1599 | + |
1600 | +#if !defined(MIR_LTTNG_INPUT_REPORT_TP_H_) || defined(TRACEPOINT_HEADER_MULTI_READ) |
1601 | +#define MIR_LTTNG_INPUT_REPORT_TP_H_ |
1602 | + |
1603 | +#include <lttng/tracepoint.h> |
1604 | +#include <stdint.h> |
1605 | + |
1606 | +TRACEPOINT_EVENT( |
1607 | + mir_server_input, |
1608 | + received_event_from_kernel, |
1609 | + TP_ARGS(int64_t, when, int, type, int, code, int, value), |
1610 | + TP_FIELDS( |
1611 | + ctf_integer(int64_t, when, when) |
1612 | + ctf_integer(int, type, type) |
1613 | + ctf_integer(int, code, code) |
1614 | + ctf_integer(int, value, value) |
1615 | + ) |
1616 | +) |
1617 | + |
1618 | +TRACEPOINT_EVENT( |
1619 | + mir_server_input, |
1620 | + published_key_event, |
1621 | + TP_ARGS(int, dest_fd, uint32_t, seq_id, int64_t, event_time), |
1622 | + TP_FIELDS( |
1623 | + ctf_integer(int, dest_fd, dest_fd) |
1624 | + ctf_integer(uint32_t, seq_id, seq_id) |
1625 | + ctf_integer(int64_t, event_time, event_time) |
1626 | + ) |
1627 | +) |
1628 | + |
1629 | +TRACEPOINT_EVENT( |
1630 | + mir_server_input, |
1631 | + published_motion_event, |
1632 | + TP_ARGS(int, dest_fd, uint32_t, seq_id, int64_t, event_time), |
1633 | + TP_FIELDS( |
1634 | + ctf_integer(int, dest_fd, dest_fd) |
1635 | + ctf_integer(uint32_t, seq_id, seq_id) |
1636 | + ctf_integer(int64_t, event_time, event_time) |
1637 | + ) |
1638 | +) |
1639 | + |
1640 | +TRACEPOINT_EVENT( |
1641 | + mir_server_input, |
1642 | + received_event_finished_signal, |
1643 | + TP_ARGS(int, src_fd, uint32_t, seq_id), |
1644 | + TP_FIELDS( |
1645 | + ctf_integer(int, src_fd, src_fd) |
1646 | + ctf_integer(uint32_t, seq_id, seq_id) |
1647 | + ) |
1648 | +) |
1649 | + |
1650 | + |
1651 | +#endif /* MIR_LTTNG_MESSAGE_PROCESSOR_REPORT_TP_H_ */ |
1652 | + |
1653 | +#include <lttng/tracepoint-event.h> |
1654 | |
1655 | === modified file 'tests/acceptance-tests/test_client_input.cpp' |
1656 | --- tests/acceptance-tests/test_client_input.cpp 2013-05-02 00:11:18 +0000 |
1657 | +++ tests/acceptance-tests/test_client_input.cpp 2013-05-29 14:16:28 +0000 |
1658 | @@ -81,7 +81,7 @@ |
1659 | struct FakeInputServerConfiguration : public mir_test_framework::TestingServerConfiguration |
1660 | { |
1661 | FakeInputServerConfiguration() |
1662 | - : input_config(the_event_filters(), the_display(), std::shared_ptr<mi::CursorListener>()) |
1663 | + : input_config(the_event_filters(), the_display(), std::shared_ptr<mi::CursorListener>(), the_input_report()) |
1664 | { |
1665 | } |
1666 | |
1667 | |
1668 | === modified file 'tests/acceptance-tests/test_server_shutdown.cpp' |
1669 | --- tests/acceptance-tests/test_server_shutdown.cpp 2013-05-21 15:11:41 +0000 |
1670 | +++ tests/acceptance-tests/test_server_shutdown.cpp 2013-05-29 14:16:28 +0000 |
1671 | @@ -205,7 +205,8 @@ |
1672 | std::make_shared<mtd::FakeEventHubInputConfiguration>( |
1673 | std::initializer_list<std::shared_ptr<mi::EventFilter> const>{}, |
1674 | the_viewable_area(), |
1675 | - std::shared_ptr<mi::CursorListener>()); |
1676 | + std::shared_ptr<mi::CursorListener>(), |
1677 | + the_input_report()); |
1678 | } |
1679 | |
1680 | return input_configuration; |
1681 | |
1682 | === modified file 'tests/integration-tests/input/android/test_android_cursor_listener.cpp' |
1683 | --- tests/integration-tests/input/android/test_android_cursor_listener.cpp 2013-04-30 20:44:31 +0000 |
1684 | +++ tests/integration-tests/input/android/test_android_cursor_listener.cpp 2013-05-29 14:16:28 +0000 |
1685 | @@ -21,6 +21,7 @@ |
1686 | #include "src/server/input/android/android_input_manager.h" |
1687 | #include "src/server/input/android/default_android_input_configuration.h" |
1688 | #include "mir/input/cursor_listener.h" |
1689 | +#include "mir/input/null_input_report.h" |
1690 | |
1691 | #include "mir_test/fake_shared.h" |
1692 | #include "mir_test/fake_event_hub.h" |
1693 | @@ -70,7 +71,8 @@ |
1694 | configuration = std::make_shared<mtd::FakeEventHubInputConfiguration>( |
1695 | std::initializer_list<std::shared_ptr<mi::EventFilter> const>{event_filter}, |
1696 | mt::fake_shared(viewable_area), |
1697 | - mt::fake_shared(cursor_listener)); |
1698 | + mt::fake_shared(cursor_listener), |
1699 | + std::make_shared<mi::NullInputReport>()); |
1700 | |
1701 | ON_CALL(viewable_area, view_area()) |
1702 | .WillByDefault(Return(visible_rectangle)); |
1703 | |
1704 | === modified file 'tests/integration-tests/input/android/test_android_input_manager.cpp' |
1705 | --- tests/integration-tests/input/android/test_android_input_manager.cpp 2013-05-21 17:16:43 +0000 |
1706 | +++ tests/integration-tests/input/android/test_android_input_manager.cpp 2013-05-29 14:16:28 +0000 |
1707 | @@ -20,6 +20,7 @@ |
1708 | #include "mir/input/event_filter.h" |
1709 | #include "mir/shell/surface_creation_parameters.h" |
1710 | #include "mir/input/android/android_input_configuration.h" |
1711 | +#include "mir/input/null_input_report.h" |
1712 | |
1713 | #include "src/server/input/android/default_android_input_configuration.h" |
1714 | #include "src/server/input/android/android_input_manager.h" |
1715 | @@ -73,7 +74,7 @@ |
1716 | AndroidInputManagerAndEventFilterDispatcherSetup() |
1717 | { |
1718 | event_filter = std::make_shared<MockEventFilter>(); |
1719 | - configuration = std::make_shared<mtd::FakeEventHubInputConfiguration>(std::initializer_list<std::shared_ptr<mi::EventFilter> const>{event_filter}, mt::fake_shared(viewable_area), null_cursor_listener); |
1720 | + configuration = std::make_shared<mtd::FakeEventHubInputConfiguration>(std::initializer_list<std::shared_ptr<mi::EventFilter> const>{event_filter}, mt::fake_shared(viewable_area), null_cursor_listener, std::make_shared<mi::NullInputReport>()); |
1721 | ON_CALL(viewable_area, view_area()) |
1722 | .WillByDefault(Return(default_view_area)); |
1723 | |
1724 | @@ -218,8 +219,9 @@ |
1725 | { |
1726 | TestingInputConfiguration(std::shared_ptr<mi::EventFilter> const& filter, |
1727 | std::shared_ptr<mg::ViewableArea> const& view_area, |
1728 | - std::shared_ptr<mi::CursorListener> const& cursor_listener) |
1729 | - : FakeEventHubInputConfiguration({}, view_area, cursor_listener), |
1730 | + std::shared_ptr<mi::CursorListener> const& cursor_listener, |
1731 | + std::shared_ptr<mi::InputReport> const& input_report) |
1732 | + : FakeEventHubInputConfiguration({}, view_area, cursor_listener, input_report), |
1733 | dispatcher_policy(new MockDispatcherPolicy(filter)) |
1734 | { |
1735 | } |
1736 | @@ -242,7 +244,7 @@ |
1737 | event_filter = std::make_shared<MockEventFilter>(); |
1738 | configuration = std::make_shared<TestingInputConfiguration>( |
1739 | event_filter, |
1740 | - mt::fake_shared(viewable_area), null_cursor_listener); |
1741 | + mt::fake_shared(viewable_area), null_cursor_listener, std::make_shared<mi::NullInputReport>()); |
1742 | fake_event_hub = configuration->the_fake_event_hub(); |
1743 | |
1744 | ON_CALL(viewable_area, view_area()) |
1745 | |
1746 | === modified file 'tests/integration-tests/input/android/test_fake_event_hub_to_event_filter.cpp' |
1747 | --- tests/integration-tests/input/android/test_fake_event_hub_to_event_filter.cpp 2013-05-02 00:11:18 +0000 |
1748 | +++ tests/integration-tests/input/android/test_fake_event_hub_to_event_filter.cpp 2013-05-29 14:16:28 +0000 |
1749 | @@ -16,11 +16,13 @@ |
1750 | * Authored by: Robert Carr <robert.carr@canonical.com> |
1751 | * Daniel d'Andrada <daniel.dandrada@canonical.com> |
1752 | */ |
1753 | -#include "mir/input/event_filter.h" |
1754 | #include "src/server/input/android/event_filter_dispatcher_policy.h" |
1755 | #include "src/server/input/android/rudimentary_input_reader_policy.h" |
1756 | #include "src/server/input/android/android_input_constants.h" |
1757 | |
1758 | +#include "mir/input/event_filter.h" |
1759 | +#include "mir/input/null_input_report.h" |
1760 | + |
1761 | #include "mir_test/fake_shared.h" |
1762 | #include "mir_test/fake_event_hub.h" |
1763 | #include "mir_test_doubles/mock_event_filter.h" |
1764 | @@ -59,7 +61,7 @@ |
1765 | event_hub = new mia::FakeEventHub(); |
1766 | dispatcher_policy = new mia::EventFilterDispatcherPolicy(mt::fake_shared(event_filter), false); |
1767 | reader_policy = new mia::RudimentaryInputReaderPolicy(); |
1768 | - dispatcher = new droidinput::InputDispatcher(dispatcher_policy); |
1769 | + dispatcher = new droidinput::InputDispatcher(dispatcher_policy, std::make_shared<mi::NullInputReport>()); |
1770 | reader = new droidinput::InputReader(event_hub, reader_policy, dispatcher); |
1771 | reader_thread = new droidinput::InputReaderThread(reader); |
1772 | dispatcher_thread = new droidinput::InputDispatcherThread(dispatcher); |
1773 | |
1774 | === modified file 'tests/mir_test_doubles/fake_event_hub_input_configuration.cpp' |
1775 | --- tests/mir_test_doubles/fake_event_hub_input_configuration.cpp 2013-04-24 05:22:20 +0000 |
1776 | +++ tests/mir_test_doubles/fake_event_hub_input_configuration.cpp 2013-05-29 14:16:28 +0000 |
1777 | @@ -26,9 +26,10 @@ |
1778 | |
1779 | mtd::FakeEventHubInputConfiguration::FakeEventHubInputConfiguration( |
1780 | std::initializer_list<std::shared_ptr<mir::input::EventFilter> const> const& filters, |
1781 | - std::shared_ptr<mir::graphics::ViewableArea> const& view_area, |
1782 | - std::shared_ptr<mir::input::CursorListener> const& cursor_listener) |
1783 | - : DefaultInputConfiguration(filters, view_area, cursor_listener) |
1784 | + std::shared_ptr<mg::ViewableArea> const& view_area, |
1785 | + std::shared_ptr<mi::CursorListener> const& cursor_listener, |
1786 | + std::shared_ptr<mi::InputReport> const& input_report) |
1787 | + : DefaultInputConfiguration(filters, view_area, cursor_listener, input_report) |
1788 | { |
1789 | event_hub = new mia::FakeEventHub(); |
1790 | } |
1791 | |
1792 | === modified file 'tests/unit-tests/logging/CMakeLists.txt' |
1793 | --- tests/unit-tests/logging/CMakeLists.txt 2013-05-10 17:54:34 +0000 |
1794 | +++ tests/unit-tests/logging/CMakeLists.txt 2013-05-29 14:16:28 +0000 |
1795 | @@ -1,6 +1,6 @@ |
1796 | list(APPEND UNIT_TEST_SOURCES |
1797 | ${CMAKE_CURRENT_SOURCE_DIR}/message_processor_report.cpp |
1798 | - ${CMAKE_CURRENT_SOURCE_DIR}/test_input_report.cpp |
1799 | + ${CMAKE_CURRENT_SOURCE_DIR}/test_legacy_input_report.cpp |
1800 | ${CMAKE_CURRENT_SOURCE_DIR}/test_display_report.cpp |
1801 | ) |
1802 | |
1803 | |
1804 | === renamed file 'tests/unit-tests/logging/test_input_report.cpp' => 'tests/unit-tests/logging/test_legacy_input_report.cpp' |
1805 | --- tests/unit-tests/logging/test_input_report.cpp 2013-05-04 00:04:19 +0000 |
1806 | +++ tests/unit-tests/logging/test_legacy_input_report.cpp 2013-05-29 14:16:28 +0000 |
1807 | @@ -27,7 +27,7 @@ |
1808 | #include <gmock/gmock.h> |
1809 | |
1810 | namespace ml = mir::logging; |
1811 | -namespace mli = mir::logging::input_report; |
1812 | +namespace mli = mir::logging::legacy_input_report; |
1813 | |
1814 | namespace |
1815 | { |
FAILED: Continuous integration, rev:711 jenkins. qa.ubuntu. com/job/ mir-ci/ 634/ jenkins. qa.ubuntu. com/job/ mir-android- raring- i386-build/ 767/console jenkins. qa.ubuntu. com/job/ mir-clang- raring- amd64-build/ 649/console jenkins. qa.ubuntu. com/job/ mir-raring- amd64-ci/ 119/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ mir-ci/ 634/rebuild
http://