Mir

Merge lp:~mir-team/mir/pluck-low-hanging-event-fruit into lp:mir

Proposed by Robert Carr on 2015-05-04
Status: Merged
Approved by: Robert Carr on 2015-05-06
Approved revision: 2542
Merged at revision: 2545
Proposed branch: lp:~mir-team/mir/pluck-low-hanging-event-fruit
Merge into: lp:mir
Diff against target: 677 lines (+45/-167)
10 files modified
src/client/events/event_builders.cpp (+4/-4)
src/client/input/android/android_input_lexicon.cpp (+0/-12)
src/include/common/mir/events/event_private.h (+2/-38)
src/server/graphics/nested/display_buffer.cpp (+0/-2)
src/server/input/android/android_input_dispatcher.cpp (+6/-7)
src/server/input/android/input_sender.cpp (+6/-7)
src/server/input/android/input_translator.cpp (+0/-19)
tests/unit-tests/input/android/test_android_input_dispatcher.cpp (+6/-19)
tests/unit-tests/input/android/test_android_input_lexicon.cpp (+0/-22)
tests/unit-tests/input/android/test_input_translator.cpp (+21/-37)
To merge this branch: bzr merge lp:~mir-team/mir/pluck-low-hanging-event-fruit
Reviewer Review Type Date Requested Status
Alan Griffiths 2015-05-04 Approve on 2015-05-06
Alexandros Frantzis (community) Approve on 2015-05-06
PS Jenkins bot continuous-integration Approve on 2015-05-05
Review via email: mp+258213@code.launchpad.net

Commit Message

Removed unused event MirKey and MirMotion event members. Next up: Enum unification.

This branch is part of the event cleaning pipeline:

Pluck-low-hanging-event-fruit: Remove unused event members.
Unify-event-modifiers: Consolidate modifier enums (https://code.launchpad.net/~mir-team/mir/unify-event-modifiers/+merge/258218)
Unify-keyboard-actions: Consolidate keyboard action enums and key repeat representation (https://code.launchpad.net/~mir-team/mir/unify-keyboard-actions/+merge/258288)
Remaining-nsec-removal: Remove usage of nsecs_t in event_private.h https://code.launchpad.net/~mir-team/mir/remaining-nsec-removal/+merge/258292
unify-pointer-button: Consolidate pointer button enums
https://code.launchpad.net/~mir-team/mir/unify-pointer-button

Description of the Change

Removed unused event MirKey and MirMotion event members. Next up: Enum unification.

To post a comment you must log in.
2542. By Robert Carr on 2015-05-05

Merge trunk

Alan Griffiths (alan-griffiths) wrote :

Are we breaking ABI here? AFAICS we're changing structs in published headers.

review: Needs Information
Robert Carr (robertcarr) wrote :

event_private has moved to a private location unless you mean another header I have missed

Alan Griffiths (alan-griffiths) wrote :

> event_private has moved to a private location unless you mean another header I
> have missed

Somehow I missed that

review: Abstain
Alan Griffiths (alan-griffiths) wrote :

> > event_private has moved to a private location unless you mean another header
> I
> > have missed
>
> Somehow I missed that

Although, shouldn't code compiled when the structs were public still be supported until we break ABI?

review: Needs Information
Robert Carr (robertcarr) wrote :

>> Although, shouldn't code compiled when the structs were public still be supported until we >> break ABI?

It's already been deprecated for one release and there are no downstream users as of release time (though I should double check GTK)...so I feel like this is a fair strategy.

Technically though I guess it could be an ABI break....

Alexandros Frantzis (afrantzis) wrote :

Looks good code-wise.

If this is technically an ABI break, then I propose we bump the ABI now to be on the safe side. We are planning to further break client ABI in 0.14 anyway (remove deprecated functions etc).

review: Needs Fixing
Alan Griffiths (alan-griffiths) wrote :

*Needs Discussion*

There's nothing "technical" about it - it is an ABI break. We've been pretty determinedly avoiding a client ABI break in the last few releases.

We do need to be explicit that we want to break client ABI this next cycle (it has my support BTW)

Assuming we do, we /1/ ought to be loud about it and /2/ ensure downstreams build with with the 0.13 API (preferably without deprecated calls) BEFORE we start thinking about the 0.14 release.

As far as this MP goes I'm happy to let it land and do the client ABI related changes separately - once we've confirmed that is our intent.

review: Needs Information
Alexandros Frantzis (afrantzis) wrote :

I am OK with bumping the ABI in a separate MP.

review: Approve
Alan Griffiths (alan-griffiths) wrote :

> As far as this MP goes I'm happy to let it land and do the client ABI related
> changes separately - once we've confirmed that is our intent.

Following team discussion that confirmed the intention to break ABI

review: Approve
Chris Halse Rogers (raof) wrote :

WOOO! ABI BREAK TIME!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/events/event_builders.cpp'
2--- src/client/events/event_builders.cpp 2015-04-01 19:39:19 +0000
3+++ src/client/events/event_builders.cpp 2015-05-05 05:52:39 +0000
4@@ -269,8 +269,8 @@
5 auto& pc = mev.pointer_coordinates[mev.pointer_count++];
6 pc.id = touch_id;
7 pc.tool_type = old_tooltype_from_new(tooltype);
8- pc.x = pc.raw_x = x_axis_value;
9- pc.y = pc.raw_y = y_axis_value;
10+ pc.x = x_axis_value;
11+ pc.y = y_axis_value;
12 pc.pressure = pressure_value;
13 pc.touch_major = touch_major_value;
14 pc.touch_minor = touch_minor_value;
15@@ -344,8 +344,8 @@
16
17 mev.pointer_count = 1;
18 auto& pc = mev.pointer_coordinates[0];
19- pc.x = pc.raw_x = x_axis_value;
20- pc.y = pc.raw_y = y_axis_value;
21+ pc.x = x_axis_value;
22+ pc.y = y_axis_value;
23 pc.hscroll = hscroll_value;
24 pc.vscroll = vscroll_value;
25
26
27=== modified file 'src/client/input/android/android_input_lexicon.cpp'
28--- src/client/input/android/android_input_lexicon.cpp 2015-04-01 19:39:19 +0000
29+++ src/client/input/android/android_input_lexicon.cpp 2015-05-05 05:52:39 +0000
30@@ -35,14 +35,11 @@
31 mir_event.key.device_id = android_event->getDeviceId();
32 mir_event.key.source_id = android_event->getSource();
33 mir_event.key.action = static_cast<MirKeyAction>(kev->getAction());
34- mir_event.key.flags = static_cast<MirKeyFlag>(kev->getFlags());
35 mir_event.key.modifiers = kev->getMetaState();
36 mir_event.key.key_code = kev->getKeyCode();
37 mir_event.key.scan_code = kev->getScanCode();
38 mir_event.key.repeat_count = kev->getRepeatCount();
39- mir_event.key.down_time = kev->getDownTime().count();
40 mir_event.key.event_time = kev->getEventTime().count();
41- mir_event.key.is_system_key = false; // TODO: Figure out what this is. //kev->isSystemKey();
42 break;
43 }
44 case AINPUT_EVENT_TYPE_MOTION:
45@@ -52,24 +49,15 @@
46 mir_event.motion.device_id = android_event->getDeviceId();
47 mir_event.motion.source_id = android_event->getSource();
48 mir_event.motion.action = mev->getAction();
49- mir_event.motion.flags = static_cast<MirMotionFlag>(mev->getFlags());
50 mir_event.motion.modifiers = mev->getMetaState();
51- mir_event.motion.edge_flags = mev->getEdgeFlags();
52 mir_event.motion.button_state = static_cast<MirMotionButton>(mev->getButtonState());
53- mir_event.motion.x_offset = mev->getXOffset();
54- mir_event.motion.y_offset = mev->getYOffset();
55- mir_event.motion.x_precision = mev->getXPrecision();
56- mir_event.motion.y_precision = mev->getYPrecision();
57- mir_event.motion.down_time = mev->getDownTime().count();
58 mir_event.motion.event_time = mev->getEventTime().count();
59 mir_event.motion.pointer_count = mev->getPointerCount();
60 for(unsigned int i = 0; i < mev->getPointerCount(); i++)
61 {
62 mir_event.motion.pointer_coordinates[i].id = mev->getPointerId(i);
63 mir_event.motion.pointer_coordinates[i].x = mev->getX(i);
64- mir_event.motion.pointer_coordinates[i].raw_x = mev->getRawX(i);
65 mir_event.motion.pointer_coordinates[i].y = mev->getY(i);
66- mir_event.motion.pointer_coordinates[i].raw_y = mev->getRawY(i);
67 mir_event.motion.pointer_coordinates[i].touch_major = mev->getTouchMajor(i);
68 mir_event.motion.pointer_coordinates[i].touch_minor = mev->getTouchMinor(i);
69 mir_event.motion.pointer_coordinates[i].size = mev->getSize(i);
70
71=== modified file 'src/include/common/mir/events/event_private.h'
72--- src/include/common/mir/events/event_private.h 2015-04-01 19:39:19 +0000
73+++ src/include/common/mir/events/event_private.h 2015-05-05 05:52:39 +0000
74@@ -51,20 +51,6 @@
75 } MirKeyAction;
76
77 typedef enum {
78- mir_key_flag_woke_here = 0x1,
79- mir_key_flag_soft_keyboard = 0x2,
80- mir_key_flag_keep_touch_mode = 0x4,
81- mir_key_flag_from_system = 0x8,
82- mir_key_flag_editor_action = 0x10,
83- mir_key_flag_canceled = 0x20,
84- mir_key_flag_virtual_hard_key = 0x40,
85- mir_key_flag_long_press = 0x80,
86- mir_key_flag_canceled_long_press = 0x100,
87- mir_key_flag_tracking = 0x200,
88- mir_key_flag_fallback = 0x400
89-} MirKeyFlag;
90-
91-typedef enum {
92 mir_key_modifier_none = 0,
93 mir_key_modifier_alt = 0x02,
94 mir_key_modifier_alt_left = 0x10,
95@@ -100,10 +86,6 @@
96 } MirMotionAction;
97
98 typedef enum {
99- mir_motion_flag_window_is_obscured = 0x1
100-} MirMotionFlag;
101-
102-typedef enum {
103 mir_motion_button_primary = 1 << 0,
104 mir_motion_button_secondary = 1 << 1,
105 mir_motion_button_tertiary = 1 << 2,
106@@ -129,23 +111,20 @@
107 int32_t device_id;
108 int32_t source_id;
109 MirKeyAction action;
110- MirKeyFlag flags;
111 unsigned int modifiers;
112
113 int32_t key_code;
114 int32_t scan_code;
115 int32_t repeat_count;
116- nsecs_t down_time;
117
118 nsecs_t event_time;
119- int is_system_key;
120 } MirKeyEvent;
121
122 typedef struct
123 {
124 int id;
125- float x, raw_x;
126- float y, raw_y;
127+ float x;
128+ float y;
129 float touch_major;
130 float touch_minor;
131 float size;
132@@ -154,9 +133,6 @@
133 float vscroll;
134 float hscroll;
135 MirMotionToolType tool_type;
136- int unused1;
137- int unused2;
138- int unused3;
139 } MirMotionPointer;
140
141 // PRIVATE
142@@ -174,27 +150,15 @@
143 * this way for now until we can drop SF/Hybris support in QtUbuntu.
144 */
145 int action;
146- MirMotionFlag flags;
147 unsigned int modifiers;
148
149- int32_t edge_flags;
150 MirMotionButton button_state;
151- float x_offset;
152- float y_offset;
153- float x_precision;
154- float y_precision;
155- nsecs_t down_time;
156 nsecs_t event_time;
157
158 size_t pointer_count;
159 MirMotionPointer pointer_coordinates[MIR_INPUT_EVENT_MAX_POINTER_COUNT];
160 /* "_coordinates" is a misnomer here because there's plenty more info than
161 just coordinates, but renaming it accurately would be an API break */
162-
163- int unused0;
164- int unused1;
165- int unused2;
166- int unused3;
167 } MirMotionEvent;
168
169 struct MirSurfaceEvent
170
171=== modified file 'src/server/graphics/nested/display_buffer.cpp'
172--- src/server/graphics/nested/display_buffer.cpp 2015-04-23 20:17:52 +0000
173+++ src/server/graphics/nested/display_buffer.cpp 2015-05-05 05:52:39 +0000
174@@ -126,8 +126,6 @@
175 if (event.type == mir_event_type_motion)
176 {
177 auto my_event = event;
178- my_event.motion.x_offset += area.top_left.x.as_float();
179- my_event.motion.y_offset += area.top_left.y.as_float();
180 dispatcher->dispatch(my_event);
181 }
182 else
183
184=== modified file 'src/server/input/android/android_input_dispatcher.cpp'
185--- src/server/input/android/android_input_dispatcher.cpp 2015-04-01 19:39:19 +0000
186+++ src/server/input/android/android_input_dispatcher.cpp 2015-05-05 05:52:39 +0000
187@@ -72,11 +72,11 @@
188 event.key.source_id,
189 policy_flags,
190 event.key.action,
191- event.key.flags,
192+ 0, /* flags */
193 event.key.key_code,
194 event.key.scan_code,
195 event.key.modifiers,
196- std::chrono::nanoseconds(event.key.down_time));
197+ std::chrono::nanoseconds(event.key.event_time));
198
199 dispatcher->notifyKey(&notify_key_args);
200
201@@ -110,16 +110,15 @@
202 event.motion.source_id,
203 policy_flags,
204 event.motion.action,
205- event.motion.flags,
206+ 0, /* flags */
207 event.motion.modifiers,
208 event.motion.button_state,
209- event.motion.edge_flags,
210+ 0, /* edge_flags */
211 event.motion.pointer_count,
212 pointer_properties.data(),
213 pointer_coords.data(),
214- event.motion.x_precision,
215- event.motion.y_precision,
216- std::chrono::nanoseconds(event.motion.down_time));
217+ 0, 0, /* unused x/y precision */
218+ std::chrono::nanoseconds(event.motion.event_time));
219
220 dispatcher->notifyMotion(&notify_motion_args);
221
222
223=== modified file 'src/server/input/android/input_sender.cpp'
224--- src/server/input/android/input_sender.cpp 2015-04-01 19:39:19 +0000
225+++ src/server/input/android/input_sender.cpp 2015-05-05 05:52:39 +0000
226@@ -241,12 +241,12 @@
227 event.device_id,
228 event.source_id,
229 event.action,
230- event.flags,
231+ 0, /* Flags */
232 event.key_code,
233 event.scan_code,
234 event.modifiers,
235 event.repeat_count,
236- std::chrono::nanoseconds(event.down_time),
237+ std::chrono::nanoseconds(event.event_time),
238 std::chrono::nanoseconds(event.event_time)
239 );
240 }
241@@ -282,15 +282,14 @@
242 event.device_id,
243 event.source_id,
244 event.action,
245- static_cast<int32_t>(event.flags),
246- event.edge_flags,
247+ 0, /* flags */
248+ 0, /* edge flags */
249 static_cast<int32_t>(event.modifiers),
250 static_cast<int32_t>(event.button_state),
251 0.0f, // event.x_offset,
252 0.0f, // event.y_offset,
253- event.x_precision,
254- event.y_precision,
255- std::chrono::nanoseconds(event.down_time),
256+ 0, 0, /* unused x/y precision */
257+ std::chrono::nanoseconds(event.event_time),
258 std::chrono::nanoseconds(event.event_time),
259 event.pointer_count,
260 properties,
261
262=== modified file 'src/server/input/android/input_translator.cpp'
263--- src/server/input/android/input_translator.cpp 2015-04-01 19:39:19 +0000
264+++ src/server/input/android/input_translator.cpp 2015-05-05 05:52:39 +0000
265@@ -101,10 +101,7 @@
266 return;
267 uint32_t policy_flags = args->policyFlags;
268 int32_t modifiers = args->metaState;
269- int32_t flags = args->flags;
270
271- if ((policy_flags & droidinput::POLICY_FLAG_VIRTUAL) || (flags & AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY))
272- flags |= mir_key_flag_virtual_hard_key;
273 if (policy_flags & droidinput::POLICY_FLAG_ALT)
274 modifiers |= mir_key_modifier_alt | mir_key_modifier_alt_left;
275 if (policy_flags & droidinput::POLICY_FLAG_ALT_GR)
276@@ -115,23 +112,17 @@
277 modifiers |= mir_key_modifier_caps_lock;
278 if (policy_flags & droidinput::POLICY_FLAG_FUNCTION)
279 modifiers |= mir_key_modifier_function;
280- if (policy_flags & droidinput::POLICY_FLAG_WOKE_HERE)
281- flags |= mir_key_flag_woke_here;
282
283 MirEvent mir_event;
284 mir_event.type = mir_event_type_key;
285 mir_event.key.device_id = args->deviceId;
286 mir_event.key.source_id = args->source;
287 mir_event.key.action = static_cast<MirKeyAction>(args->action);
288- mir_event.key.flags = static_cast<MirKeyFlag>(flags);
289 mir_event.key.modifiers = modifiers;
290 mir_event.key.key_code = args->keyCode;
291 mir_event.key.scan_code = args->scanCode;
292 mir_event.key.repeat_count = 0;
293- mir_event.key.down_time = args->downTime.count();
294 mir_event.key.event_time = args->eventTime.count();
295- mir_event.key.is_system_key = false; // TODO: Figure out what this is. //kev->isSystemKey();
296-
297
298 if (!valid_key_event(mir_event.key))
299 return;
300@@ -149,15 +140,8 @@
301 mir_event.motion.device_id = args->deviceId;
302 mir_event.motion.source_id = args->source;
303 mir_event.motion.action = args->action;
304- mir_event.motion.flags = static_cast<MirMotionFlag>(args->flags);
305 mir_event.motion.modifiers = args->metaState;
306- mir_event.motion.edge_flags = args->edgeFlags;
307 mir_event.motion.button_state = static_cast<MirMotionButton>(args->buttonState);
308- mir_event.motion.x_offset = 0; // offsets or axis positions are calculated in dispatcher
309- mir_event.motion.y_offset = 0;
310- mir_event.motion.x_precision = args->xPrecision;
311- mir_event.motion.y_precision = args->yPrecision;
312- mir_event.motion.down_time = args->downTime.count();
313 mir_event.motion.event_time = args->eventTime.count();
314 mir_event.motion.pointer_count = args->pointerCount;
315 for(unsigned int i = 0; i < args->pointerCount; i++)
316@@ -165,9 +149,6 @@
317 mir_event.motion.pointer_coordinates[i].id = args->pointerProperties[i].id;
318 mir_event.motion.pointer_coordinates[i].x = args->pointerCoords[i].getX();
319 mir_event.motion.pointer_coordinates[i].y = args->pointerCoords[i].getY();
320- // offsets or axis positions are calculated in dispatcher:
321- mir_event.motion.pointer_coordinates[i].raw_x = args->pointerCoords[i].getX();
322- mir_event.motion.pointer_coordinates[i].raw_y = args->pointerCoords[i].getY();
323 mir_event.motion.pointer_coordinates[i].touch_major =
324 args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR);
325 mir_event.motion.pointer_coordinates[i].touch_minor =
326
327=== modified file 'tests/unit-tests/input/android/test_android_input_dispatcher.cpp'
328--- tests/unit-tests/input/android/test_android_input_dispatcher.cpp 2015-04-01 19:39:19 +0000
329+++ tests/unit-tests/input/android/test_android_input_dispatcher.cpp 2015-05-05 05:52:39 +0000
330@@ -179,23 +179,14 @@
331 event.motion.device_id = 3;
332 event.motion.source_id = 4;
333 event.motion.action = mir_motion_action_scroll;
334- event.motion.flags = mir_motion_flag_window_is_obscured;
335 event.motion.modifiers = 6;
336- event.motion.edge_flags = 7;
337 event.motion.button_state =
338 static_cast<MirMotionButton>(mir_motion_button_forward | mir_motion_button_secondary);
339- event.motion.x_offset = 0.0f;
340- event.motion.y_offset = 0.0f;
341- event.motion.x_precision = 9.0f;
342- event.motion.y_precision = 10.0f;
343- event.motion.down_time = 11;
344
345 auto & pointer = event.motion.pointer_coordinates[0];
346 pointer.id = 1;
347 pointer.x = 12.0f;
348- pointer.raw_x = 12.0f;
349 pointer.y = 13.0f;
350- pointer.raw_y = 13.0f;
351 pointer.touch_major = 14.0f;
352 pointer.touch_minor = 15.0f;
353 pointer.size = 16.0f;
354@@ -222,16 +213,15 @@
355 event.motion.source_id,
356 default_policy_flags,
357 event.motion.action,
358- event.motion.flags,
359+ 0, /* flags */
360 event.motion.modifiers,
361 event.motion.button_state,
362- event.motion.edge_flags,
363+ 0, /* edge_flags */
364 event.motion.pointer_count,
365 expected_properties,
366 expected_coords,
367- event.motion.x_precision,
368- event.motion.y_precision,
369- std::chrono::nanoseconds(event.motion.down_time));
370+ 0, 0, /* unused x/y precision */
371+ std::chrono::nanoseconds(event.motion.event_time));
372
373 EXPECT_CALL(*dispatcher, notifyMotion(MotionArgsMatches(expected)));
374
375@@ -247,24 +237,21 @@
376 event.key.device_id = 2;
377 event.key.source_id = 3;
378 event.key.action = mir_key_action_down;
379- event.key.flags = mir_key_flag_long_press;
380 event.key.scan_code = 4;
381 event.key.key_code = 5;
382 event.key.repeat_count = 0;
383- event.key.down_time = 6;
384 event.key.modifiers = 7;
385- event.key.is_system_key = false;
386
387 droidinput::NotifyKeyArgs expected(std::chrono::nanoseconds(event.key.event_time),
388 event.key.device_id,
389 event.key.source_id,
390 default_policy_flags,
391 event.key.action,
392- event.key.flags,
393+ 0, /* flags */
394 event.key.key_code,
395 event.key.scan_code,
396 event.key.modifiers,
397- std::chrono::nanoseconds(event.key.down_time));
398+ std::chrono::nanoseconds(event.key.event_time));
399
400 EXPECT_CALL(*dispatcher, notifyKey(KeyArgsMatches(expected)));
401
402
403=== modified file 'tests/unit-tests/input/android/test_android_input_lexicon.cpp'
404--- tests/unit-tests/input/android/test_android_input_lexicon.cpp 2015-04-01 19:39:19 +0000
405+++ tests/unit-tests/input/android/test_android_input_lexicon.cpp 2015-05-05 05:52:39 +0000
406@@ -54,7 +54,6 @@
407 EXPECT_EQ(device_id, mir_ev.key.device_id);
408 EXPECT_EQ(source_id, mir_ev.key.source_id);
409 EXPECT_EQ(action, mir_ev.key.action);
410- EXPECT_EQ(flags, mir_ev.key.flags);
411 EXPECT_EQ((unsigned int)meta_state, mir_ev.key.modifiers);
412
413 auto mir_key_ev = &mir_ev.key;
414@@ -63,10 +62,7 @@
415 EXPECT_EQ(mir_key_ev->key_code, key_code);
416 EXPECT_EQ(mir_key_ev->scan_code, scan_code);
417 EXPECT_EQ(mir_key_ev->repeat_count, repeat_count);
418- EXPECT_EQ(mir_key_ev->down_time, down_time.count());
419 EXPECT_EQ(mir_key_ev->event_time, event_time.count());
420- // What is this flag and where does it come from?
421- EXPECT_EQ(mir_key_ev->is_system_key, false);
422
423 delete android_key_ev;
424 }
425@@ -133,7 +129,6 @@
426 EXPECT_EQ(device_id, mir_ev.motion.device_id);
427 EXPECT_EQ(source_id, mir_ev.motion.source_id);
428 EXPECT_EQ(action, mir_ev.motion.action);
429- EXPECT_EQ(flags, mir_ev.motion.flags);
430 EXPECT_EQ((unsigned int)meta_state, mir_ev.motion.modifiers);
431
432 // Motion event specific properties
433@@ -141,13 +136,7 @@
434
435 auto mir_motion_ev = &mir_ev.motion;
436
437- EXPECT_EQ(mir_motion_ev->edge_flags, edge_flags);
438 EXPECT_EQ(mir_motion_ev->button_state, button_state);
439- EXPECT_EQ(mir_motion_ev->x_offset, x_offset);
440- EXPECT_EQ(mir_motion_ev->y_offset, y_offset);
441- EXPECT_EQ(mir_motion_ev->x_precision, x_precision);
442- EXPECT_EQ(mir_motion_ev->y_precision, y_precision);
443- EXPECT_EQ(mir_motion_ev->down_time, down_time.count());
444 EXPECT_EQ(mir_motion_ev->event_time, event_time.count());
445
446 EXPECT_EQ(mir_motion_ev->pointer_count, pointer_count);
447@@ -158,8 +147,6 @@
448 // Notice these two coordinates are offset by x/y offset
449 EXPECT_EQ(mir_pointer_coords->x, x_axis + x_offset);
450 EXPECT_EQ(mir_pointer_coords->y, y_axis + y_offset);
451- EXPECT_EQ(mir_pointer_coords->raw_x, x_axis);
452- EXPECT_EQ(mir_pointer_coords->raw_y, y_axis);
453 EXPECT_EQ(mir_pointer_coords->touch_major, touch_major);
454 EXPECT_EQ(mir_pointer_coords->touch_minor, touch_minor);
455 EXPECT_EQ(mir_pointer_coords->size, size);
456@@ -250,7 +237,6 @@
457 EXPECT_EQ(device_id, mir_ev.motion.device_id);
458 EXPECT_EQ(source_id, mir_ev.motion.source_id);
459 EXPECT_EQ(action, mir_ev.motion.action);
460- EXPECT_EQ(flags, mir_ev.motion.flags);
461 EXPECT_EQ((unsigned int)meta_state, mir_ev.motion.modifiers);
462
463 // Motion event specific properties
464@@ -258,13 +244,7 @@
465
466 auto mir_motion_ev = &mir_ev.motion;
467
468- EXPECT_EQ(mir_motion_ev->edge_flags, edge_flags);
469 EXPECT_EQ(mir_motion_ev->button_state, button_state);
470- EXPECT_EQ(mir_motion_ev->x_offset, x_offset);
471- EXPECT_EQ(mir_motion_ev->y_offset, y_offset);
472- EXPECT_EQ(mir_motion_ev->x_precision, x_precision);
473- EXPECT_EQ(mir_motion_ev->y_precision, y_precision);
474- EXPECT_EQ(mir_motion_ev->down_time, down_time.count());
475 EXPECT_EQ(mir_motion_ev->event_time, event_time.count());
476 EXPECT_EQ(mir_motion_ev->pointer_count, pointer_count);
477
478@@ -275,8 +255,6 @@
479 EXPECT_EQ(pointer[p].id, pointer_id[p]);
480 EXPECT_EQ(pointer[p].x, x_axis[p] + x_offset);
481 EXPECT_EQ(pointer[p].y, y_axis[p] + y_offset);
482- EXPECT_EQ(pointer[p].raw_x, x_axis[p]);
483- EXPECT_EQ(pointer[p].raw_y, y_axis[p]);
484 EXPECT_EQ(pointer[p].touch_major, touch_major[p]);
485 EXPECT_EQ(pointer[p].touch_minor, touch_minor[p]);
486 EXPECT_EQ(pointer[p].size, size[p]);
487
488=== modified file 'tests/unit-tests/input/android/test_input_translator.cpp'
489--- tests/unit-tests/input/android/test_input_translator.cpp 2015-04-01 19:39:19 +0000
490+++ tests/unit-tests/input/android/test_input_translator.cpp 2015-05-05 05:52:39 +0000
491@@ -72,7 +72,6 @@
492 struct PolicyFlagTestParameter
493 {
494 const uint32_t policy_flag;
495- const MirKeyFlag expected_key_flag;
496 const unsigned int expected_modifiers;
497 };
498
499@@ -112,7 +111,7 @@
500 translator.notifyKey(nullptr);
501
502 const int32_t invalid_action = 5;
503- droidinput::NotifyKeyArgs key(some_time, device_id, source_id, default_policy_flags, invalid_action, no_flags,
504+ droidinput::NotifyKeyArgs key(some_time, device_id, source_id, 0, invalid_action, no_flags,
505 arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time);
506
507 translator.notifyKey(&key);
508@@ -126,7 +125,7 @@
509
510 const int32_t invalid_motion_action = 20;
511
512- droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, default_policy_flags, invalid_motion_action,
513+ droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, 0, invalid_motion_action,
514 no_flags, meta_state, button_state, edge_flags, zero_pointers, properties,
515 coords, x_precision, y_precision, later_time);
516
517@@ -141,7 +140,7 @@
518
519 const int32_t invalid_motion_action = mir_motion_action_pointer_up | (3 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
520
521- droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, default_policy_flags, invalid_motion_action,
522+ droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, 0, invalid_motion_action,
523 no_flags, meta_state, button_state, edge_flags, zero_pointers, properties,
524 coords, x_precision, y_precision, later_time);
525
526@@ -161,7 +160,7 @@
527 properties[1].id = 2;
528 properties[2].id = 3;
529
530- droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, default_policy_flags, valid_motion_action,
531+ droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, 0, valid_motion_action,
532 no_flags, meta_state, button_state, edge_flags, three_pointers, properties,
533 coords, x_precision, y_precision, later_time);
534
535@@ -180,7 +179,7 @@
536 properties[1].id = 1;
537 properties[2].id = 3;
538
539- droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, default_policy_flags, motion_action, no_flags,
540+ droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, 0, motion_action, no_flags,
541 meta_state, button_state, edge_flags, three_pointers, properties, coords,
542 x_precision, y_precision, later_time);
543 translator.notifyMotion(&motion);
544@@ -198,7 +197,7 @@
545 properties[1].id = 1;
546 properties[2].id = 3;
547
548- droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, default_policy_flags, motion_action, no_flags,
549+ droidinput::NotifyMotionArgs motion(some_time, device_id, source_id, 0, motion_action, no_flags,
550 meta_state, button_state, edge_flags, three_pointers, properties, coords,
551 x_precision, y_precision, later_time);
552 translator.notifyMotion(&motion);
553@@ -218,7 +217,7 @@
554 coords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x_pos);
555 coords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y_pos);
556
557- droidinput::NotifyMotionArgs motion(some_time, device_id, AINPUT_SOURCE_MOUSE, default_policy_flags, motion_action, no_flags,
558+ droidinput::NotifyMotionArgs motion(some_time, device_id, AINPUT_SOURCE_MOUSE, 0, motion_action, no_flags,
559 meta_state, button_state, edge_flags, one_pointer, properties, coords,
560 x_precision, y_precision, later_time);
561 translator.notifyMotion(&motion);
562@@ -232,9 +231,9 @@
563 EXPECT_CALL(dispatcher, dispatch(mt::KeyDownEvent())).Times(1);
564 EXPECT_CALL(dispatcher, dispatch(mt::KeyUpEvent())).Times(1);
565
566- droidinput::NotifyKeyArgs down(some_time, device_id, source_id, default_policy_flags, mir_key_action_down,
567+ droidinput::NotifyKeyArgs down(some_time, device_id, source_id, 0, mir_key_action_down,
568 no_flags, arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time);
569- droidinput::NotifyKeyArgs up(some_time, device_id, source_id, default_policy_flags, mir_key_action_up,
570+ droidinput::NotifyKeyArgs up(some_time, device_id, source_id, 0, mir_key_action_up,
571 no_flags, arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time);
572
573 translator.notifyKey(&down);
574@@ -250,13 +249,10 @@
575 expected.key.device_id = 2;
576 expected.key.source_id = 3;
577 expected.key.action = mir_key_action_down;
578- expected.key.flags = mir_key_flag_long_press;
579 expected.key.scan_code = 4;
580 expected.key.key_code = 5;
581 expected.key.repeat_count = 0;
582- expected.key.down_time = 6;
583 expected.key.modifiers = 7;
584- expected.key.is_system_key = false;
585
586 InSequence seq;
587 EXPECT_CALL(dispatcher, dispatch(mt::MirKeyEventMatches(expected))).Times(1);
588@@ -266,11 +262,11 @@
589 expected.key.source_id,
590 default_policy_flags,
591 expected.key.action,
592- expected.key.flags,
593+ 0, /* flags */
594 expected.key.key_code,
595 expected.key.scan_code,
596 expected.key.modifiers,
597- std::chrono::nanoseconds(expected.key.down_time));
598+ std::chrono::nanoseconds(expected.key.event_time));
599
600 translator.notifyKey(&notified);
601 }
602@@ -285,23 +281,14 @@
603 expected.motion.device_id = 3;
604 expected.motion.source_id = 4;
605 expected.motion.action = mir_motion_action_scroll;
606- expected.motion.flags = mir_motion_flag_window_is_obscured;
607 expected.motion.modifiers = 6;
608- expected.motion.edge_flags = 7;
609 expected.motion.button_state =
610 static_cast<MirMotionButton>(mir_motion_button_forward | mir_motion_button_secondary);
611- expected.motion.x_offset = 0.0f;
612- expected.motion.y_offset = 0.0f;
613- expected.motion.x_precision = 9.0f;
614- expected.motion.y_precision = 10.0f;
615- expected.motion.down_time = 11;
616
617 auto & pointer = expected.motion.pointer_coordinates[0];
618 pointer.id = 1;
619 pointer.x = 12.0f;
620- pointer.raw_x = 12.0f;
621 pointer.y = 13.0f;
622- pointer.raw_y = 13.0f;
623 pointer.touch_major = 14.0f;
624 pointer.touch_minor = 15.0f;
625 pointer.size = 16.0f;
626@@ -330,16 +317,15 @@
627 expected.motion.source_id,
628 default_policy_flags,
629 expected.motion.action,
630- expected.motion.flags,
631+ 0, /* flags */
632 expected.motion.modifiers,
633 expected.motion.button_state,
634- expected.motion.edge_flags,
635+ 0, /* edge flags */
636 expected.motion.pointer_count,
637 properties,
638 coords,
639- expected.motion.x_precision,
640- expected.motion.y_precision,
641- std::chrono::nanoseconds(expected.motion.down_time));
642+ 0, 0, /* unused x/y precision */
643+ std::chrono::nanoseconds(expected.motion.event_time));
644
645 translator.notifyMotion(&notified);
646 }
647@@ -355,26 +341,24 @@
648 ).Times(1);
649
650 droidinput::NotifyKeyArgs tester(some_time, device_id, source_id,
651- default_policy_flags | GetParam().policy_flag, mir_key_action_down,
652+ GetParam().policy_flag, mir_key_action_down,
653 no_flags, arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time);
654
655 translator.notifyKey(&tester);
656 }
657
658-const MirKeyFlag default_key_flag = static_cast<MirKeyFlag>(0);
659 INSTANTIATE_TEST_CASE_P(VariousPolicyFlags, InputTranslatorWithPolicyParam,
660- ::testing::Values(PolicyFlagTestParameter{droidinput::POLICY_FLAG_CAPS_LOCK, default_key_flag,
661+ ::testing::Values(PolicyFlagTestParameter{droidinput::POLICY_FLAG_CAPS_LOCK,
662 mir_input_event_modifier_caps_lock},
663- PolicyFlagTestParameter{droidinput::POLICY_FLAG_ALT, default_key_flag,
664+ PolicyFlagTestParameter{droidinput::POLICY_FLAG_ALT,
665 mir_input_event_modifier_alt | mir_input_event_modifier_alt_left},
666- PolicyFlagTestParameter{droidinput::POLICY_FLAG_ALT_GR, default_key_flag,
667+ PolicyFlagTestParameter{droidinput::POLICY_FLAG_ALT_GR,
668 mir_input_event_modifier_alt | mir_input_event_modifier_alt_right},
669- PolicyFlagTestParameter{droidinput::POLICY_FLAG_FUNCTION, default_key_flag,
670+ PolicyFlagTestParameter{droidinput::POLICY_FLAG_FUNCTION,
671 mir_input_event_modifier_function},
672- PolicyFlagTestParameter{droidinput::POLICY_FLAG_SHIFT, default_key_flag,
673+ PolicyFlagTestParameter{droidinput::POLICY_FLAG_SHIFT,
674 mir_input_event_modifier_shift | mir_input_event_modifier_shift_left},
675 PolicyFlagTestParameter{droidinput::POLICY_FLAG_VIRTUAL,
676- mir_key_flag_virtual_hard_key,
677 mir_input_event_modifier_none}));
678
679

Subscribers

People subscribed via source and target branches