Mir

Merge lp:~vanvugt/mir/generalize-event into lp:~mir-team/mir/trunk

Proposed by Daniel van Vugt
Status: Merged
Approved by: Chris Halse Rogers
Approved revision: no longer in the source branch.
Merged at revision: 569
Proposed branch: lp:~vanvugt/mir/generalize-event
Merge into: lp:~mir-team/mir/trunk
Prerequisite: lp:~vanvugt/mir/doc-delegate
Diff against target: 302 lines (+31/-31)
14 files modified
include/client/mir_toolkit/mir_client_library.h (+2/-2)
include/server/mir/input/event_filter.h (+1/-1)
include/shared/mir/input/android/android_input_lexicon.h (+1/-1)
include/shared/mir_toolkit/c_types.h (+5/-5)
include/shared/mir_toolkit/event.h (+6/-6)
include/test/mir_test_doubles/mock_event_filter.h (+4/-4)
src/client/input/android_input_receiver.h (+1/-1)
src/client/input/android_input_receiver_thread.h (+1/-1)
src/client/input/input_platform.h (+1/-1)
src/client/mir_surface.cpp (+1/-1)
src/server/input/android/transport/android_input_lexicon.cpp (+2/-2)
tests/client-language/c89.c (+1/-1)
tests/unit-tests/client/input/test_android_input_receiver.cpp (+2/-2)
tests/unit-tests/input/android/test_android_input_lexicon.cpp (+3/-3)
To merge this branch: bzr merge lp:~vanvugt/mir/generalize-event
Reviewer Review Type Date Requested Status
Chris Halse Rogers Approve
Robert Ancell Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+157310@code.launchpad.net

Commit message

Generalize MirEvent so that it is no longer explicitly just for input events.

This resolves some confusion (LP: #1110117) and also lays the foundation for
future support of non-input events.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Makes sense

review: Approve
Revision history for this message
Chris Halse Rogers (raof) wrote :

Looks sane

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/client/mir_toolkit/mir_client_library.h'
2--- include/client/mir_toolkit/mir_client_library.h 2013-04-05 07:32:57 +0000
3+++ include/client/mir_toolkit/mir_client_library.h 2013-04-08 03:00:29 +0000
4@@ -115,7 +115,7 @@
5 * released.
6 * \param [in] connection The connection
7 * \param [in] surface_parameters Request surface parameters
8- * \param [in] event_handler Callback to be invoked when input is
9+ * \param [in] event_handler Callback to be invoked when an event is
10 * received
11 * \param [in] callback Callback function to be invoked when
12 * request completes
13@@ -135,7 +135,7 @@
14 * to complete and return the resulting surface.
15 * \param [in] connection The connection
16 * \param [in] params Parameters describing the desired surface
17- * \param [in] event_handler Callback to be invoked when input is received
18+ * \param [in] event_handler Callback to be invoked when an event is received
19 * \return The resulting surface
20 */
21 MirSurface *mir_surface_create_sync(MirConnection *connection,
22
23=== modified file 'include/server/mir/input/event_filter.h'
24--- include/server/mir/input/event_filter.h 2013-03-13 04:54:15 +0000
25+++ include/server/mir/input/event_filter.h 2013-04-08 03:00:29 +0000
26@@ -19,7 +19,7 @@
27 #ifndef MIR_INPUT_EVENT_FILTER_H_
28 #define MIR_INPUT_EVENT_FILTER_H_
29
30-#include "mir_toolkit/input/event.h"
31+#include "mir_toolkit/event.h"
32
33 #include <memory>
34
35
36=== modified file 'include/shared/mir/input/android/android_input_lexicon.h'
37--- include/shared/mir/input/android/android_input_lexicon.h 2013-04-03 18:05:32 +0000
38+++ include/shared/mir/input/android/android_input_lexicon.h 2013-04-08 03:00:29 +0000
39@@ -20,7 +20,7 @@
40 #ifndef MIR_INPUT_ANDROID_INPUT_LEXICON_H_
41 #define MIR_INPUT_ANDROID_INPUT_LEXICON_H_
42
43-#include "mir_toolkit/input/event.h"
44+#include "mir_toolkit/event.h"
45
46 namespace android
47 {
48
49=== modified file 'include/shared/mir_toolkit/c_types.h'
50--- include/shared/mir_toolkit/c_types.h 2013-04-05 07:32:57 +0000
51+++ include/shared/mir_toolkit/c_types.h 2013-04-08 03:00:29 +0000
52@@ -19,7 +19,7 @@
53 #ifndef MIR_TOOLKIT_C_TYPES_H_
54 #define MIR_TOOLKIT_C_TYPES_H_
55
56-#include <mir_toolkit/input/event.h>
57+#include <mir_toolkit/event.h>
58
59 #ifdef __cplusplus
60 /**
61@@ -62,13 +62,13 @@
62 typedef void (*mir_surface_lifecycle_callback)(MirSurface *surface, void *client_context);
63
64 /**
65- * Callback member of MirEventDelegate for handling of input events.
66+ * Callback member of MirEventDelegate for handling of events.
67 * \param [in] surface The surface on which an event has occurred
68 * \param [in] event The event to be handled
69 * \param [in,out] context The context provided by client during delegate
70 * registration.
71 */
72-typedef void (*mir_event_delegate_handle_input_callback)(
73+typedef void (*mir_event_delegate_callback)(
74 MirSurface* surface, MirEvent* event, void* context);
75
76 /**
77@@ -172,11 +172,11 @@
78
79 /**
80 * MirEventDelegate may be used to specify (at surface creation time)
81- * callbacks for handling of input events.
82+ * callbacks for handling of events.
83 */
84 typedef struct MirEventDelegate
85 {
86- mir_event_delegate_handle_input_callback handle_input;
87+ mir_event_delegate_callback callback;
88 void *context;
89 } MirEventDelegate;
90
91
92=== renamed file 'include/shared/mir_toolkit/input/event.h' => 'include/shared/mir_toolkit/event.h'
93--- include/shared/mir_toolkit/input/event.h 2013-04-02 17:32:09 +0000
94+++ include/shared/mir_toolkit/event.h 2013-04-08 03:00:29 +0000
95@@ -16,8 +16,8 @@
96 * Authored by: Thomas Voss <thomas.voss@canonical.com>
97 */
98
99-#ifndef MIR_TOOLKIT_INPUT_EVENT_H_
100-#define MIR_TOOLKIT_INPUT_EVENT_H_
101+#ifndef MIR_TOOLKIT_EVENT_H_
102+#define MIR_TOOLKIT_EVENT_H_
103
104 #include <stddef.h>
105 #include <stdint.h>
106@@ -36,9 +36,9 @@
107
108 typedef enum
109 {
110- MIR_INPUT_EVENT_TYPE_KEY,
111- MIR_INPUT_EVENT_TYPE_MOTION,
112- MIR_INPUT_EVENT_TYPE_HW_SWITCH
113+ mir_event_type_key,
114+ mir_event_type_motion,
115+ mir_event_type_hw_switch
116 } MirEventType;
117
118 typedef struct MirEvent
119@@ -101,4 +101,4 @@
120 /**@}*/
121 #endif
122
123-#endif /* MIR_TOOLKIT_INPUT_EVENT_H_ */
124+#endif /* MIR_TOOLKIT_EVENT_H_ */
125
126=== removed directory 'include/shared/mir_toolkit/input'
127=== modified file 'include/test/mir_test_doubles/mock_event_filter.h'
128--- include/test/mir_test_doubles/mock_event_filter.h 2013-04-02 16:40:08 +0000
129+++ include/test/mir_test_doubles/mock_event_filter.h 2013-04-08 03:00:29 +0000
130@@ -39,21 +39,21 @@
131
132 MATCHER_P(IsKeyEventWithKey, key, "")
133 {
134- if (arg.type != MIR_INPUT_EVENT_TYPE_KEY)
135+ if (arg.type != mir_event_type_key)
136 return false;
137
138 return arg.details.key.key_code == key;
139 }
140 MATCHER(KeyDownEvent, "")
141 {
142- if (arg.type != MIR_INPUT_EVENT_TYPE_KEY)
143+ if (arg.type != mir_event_type_key)
144 return false;
145
146 return arg.action == AKEY_EVENT_ACTION_DOWN;
147 }
148 MATCHER(ButtonDownEvent, "")
149 {
150- if (arg.type != MIR_INPUT_EVENT_TYPE_MOTION)
151+ if (arg.type != mir_event_type_motion)
152 return false;
153 if (arg.details.motion.button_state == 0)
154 return false;
155@@ -61,7 +61,7 @@
156 }
157 MATCHER_P2(MotionEvent, dx, dy, "")
158 {
159- if (arg.type != MIR_INPUT_EVENT_TYPE_MOTION)
160+ if (arg.type != mir_event_type_motion)
161 return false;
162 auto coords = &arg.details.motion.pointer_coordinates[0];
163 return (coords->x == dx) && (coords->y == dy);
164
165=== modified file 'src/client/input/android_input_receiver.h'
166--- src/client/input/android_input_receiver.h 2013-04-03 18:41:09 +0000
167+++ src/client/input/android_input_receiver.h 2013-04-08 03:00:29 +0000
168@@ -19,7 +19,7 @@
169 #ifndef MIR_INPUT_ANDROID_INPUT_RECEIVER_H_
170 #define MIR_INPUT_ANDROID_INPUT_RECEIVER_H_
171
172-#include "mir_toolkit/input/event.h"
173+#include "mir_toolkit/event.h"
174
175 #include <utils/StrongPointer.h>
176 #include <androidfw/Input.h>
177
178=== modified file 'src/client/input/android_input_receiver_thread.h'
179--- src/client/input/android_input_receiver_thread.h 2013-03-27 06:46:22 +0000
180+++ src/client/input/android_input_receiver_thread.h 2013-04-08 03:00:29 +0000
181@@ -21,7 +21,7 @@
182
183 #include "input_receiver_thread.h"
184
185-#include "mir_toolkit/input/event.h"
186+#include "mir_toolkit/event.h"
187
188 #include <functional>
189 #include <memory>
190
191=== modified file 'src/client/input/input_platform.h'
192--- src/client/input/input_platform.h 2013-03-28 21:40:48 +0000
193+++ src/client/input/input_platform.h 2013-04-08 03:00:29 +0000
194@@ -19,7 +19,7 @@
195 #ifndef MIR_CLIENT_INPUT_PLATFORM_H_
196 #define MIR_CLIENT_INPUT_PLATFORM_H_
197
198-#include "mir_toolkit/input/event.h"
199+#include "mir_toolkit/event.h"
200
201 #include <memory>
202 #include <functional>
203
204=== modified file 'src/client/mir_surface.cpp'
205--- src/client/mir_surface.cpp 2013-04-02 17:32:09 +0000
206+++ src/client/mir_surface.cpp 2013-04-08 03:00:29 +0000
207@@ -55,7 +55,7 @@
208 message.set_buffer_usage(params.buffer_usage);
209
210 if (delegate)
211- handle_event_callback = std::bind(delegate->handle_input, this, std::placeholders::_1, delegate->context);
212+ handle_event_callback = std::bind(delegate->callback, this, std::placeholders::_1, delegate->context);
213
214 server.create_surface(0, &message, &surface, gp::NewCallback(this, &MirSurface::created, callback, context));
215
216
217=== modified file 'src/server/input/android/transport/android_input_lexicon.cpp'
218--- src/server/input/android/transport/android_input_lexicon.cpp 2013-03-25 18:40:44 +0000
219+++ src/server/input/android/transport/android_input_lexicon.cpp 2013-04-08 03:00:29 +0000
220@@ -30,7 +30,7 @@
221 case AINPUT_EVENT_TYPE_KEY:
222 {
223 const droidinput::KeyEvent* kev = static_cast<const droidinput::KeyEvent*>(android_event);
224- mir_event.type = MIR_INPUT_EVENT_TYPE_KEY;
225+ mir_event.type = mir_event_type_key;
226 mir_event.device_id = android_event->getDeviceId();
227 mir_event.source_id = android_event->getSource();
228 mir_event.action = kev->getAction();
229@@ -47,7 +47,7 @@
230 case AINPUT_EVENT_TYPE_MOTION:
231 {
232 const droidinput::MotionEvent* mev = static_cast<const droidinput::MotionEvent*>(android_event);
233- mir_event.type = MIR_INPUT_EVENT_TYPE_MOTION;
234+ mir_event.type = mir_event_type_motion;
235 mir_event.device_id = android_event->getDeviceId();
236 mir_event.source_id = android_event->getSource();
237 mir_event.action = mev->getAction();
238
239=== modified file 'tests/client-language/c89.c'
240--- tests/client-language/c89.c 2013-03-22 10:34:16 +0000
241+++ tests/client-language/c89.c 2013-04-08 03:00:29 +0000
242@@ -23,7 +23,7 @@
243 #include "mir_toolkit/mir_client_library.h"
244 #include "mir_toolkit/mir_client_library_drm.h"
245 #include "mir_toolkit/mir_client_library_lightdm.h"
246-#include "mir_toolkit/input/event.h"
247+#include "mir_toolkit/event.h"
248
249 int main()
250 {
251
252=== modified file 'tests/unit-tests/client/input/test_android_input_receiver.cpp'
253--- tests/unit-tests/client/input/test_android_input_receiver.cpp 2013-04-01 18:19:40 +0000
254+++ tests/unit-tests/client/input/test_android_input_receiver.cpp 2013-04-08 03:00:29 +0000
255@@ -17,7 +17,7 @@
256 */
257
258 #include "src/client/input/android_input_receiver.h"
259-#include "mir_toolkit/input/event.h"
260+#include "mir_toolkit/event.h"
261
262 #include <androidfw/InputTransport.h>
263
264@@ -157,7 +157,7 @@
265
266 MirEvent ev;
267 EXPECT_EQ(true, receiver.next_event(next_event_timeout, ev));
268- EXPECT_EQ(MIR_INPUT_EVENT_TYPE_KEY, ev.type);
269+ EXPECT_EQ(mir_event_type_key, ev.type);
270 EXPECT_EQ(producer.testing_key_event_key_code, ev.details.key.key_code);
271 }
272
273
274=== modified file 'tests/unit-tests/input/android/test_android_input_lexicon.cpp'
275--- tests/unit-tests/input/android/test_android_input_lexicon.cpp 2013-03-25 18:40:44 +0000
276+++ tests/unit-tests/input/android/test_android_input_lexicon.cpp 2013-04-08 03:00:29 +0000
277@@ -17,7 +17,7 @@
278 */
279
280 #include "mir/input/android/android_input_lexicon.h"
281-#include "mir_toolkit/input/event.h"
282+#include "mir_toolkit/event.h"
283
284 #include <androidfw/Input.h>
285
286@@ -59,7 +59,7 @@
287
288 auto mir_key_ev = &mir_ev.details.key;
289 // Key event specific properties
290- EXPECT_EQ(mir_ev.type, MIR_INPUT_EVENT_TYPE_KEY);
291+ EXPECT_EQ(mir_ev.type, mir_event_type_key);
292 EXPECT_EQ(mir_key_ev->key_code, key_code);
293 EXPECT_EQ(mir_key_ev->scan_code, scan_code);
294 EXPECT_EQ(mir_key_ev->repeat_count, repeat_count);
295@@ -131,7 +131,7 @@
296 EXPECT_EQ(meta_state, mir_ev.meta_state);
297
298 // Motion event specific properties
299- EXPECT_EQ(mir_ev.type, MIR_INPUT_EVENT_TYPE_MOTION);
300+ EXPECT_EQ(mir_ev.type, mir_event_type_motion);
301
302 auto mir_motion_ev = &mir_ev.details.motion;
303

Subscribers

People subscribed via source and target branches