Mir

Merge lp:~mir-team/mir/relative-pointer-events into lp:mir

Proposed by Robert Carr
Status: Merged
Approved by: Robert Carr
Approved revision: no longer in the source branch.
Merged at revision: 2770
Proposed branch: lp:~mir-team/mir/relative-pointer-events
Merge into: lp:mir
Diff against target: 356 lines (+120/-17)
17 files modified
3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp (+3/-0)
3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp (+3/-2)
include/client/mir/events/event_builders.h (+8/-0)
include/client/mir_toolkit/events/input/pointer_event.h (+6/-1)
include/test/mir/test/event_matchers.h (+14/-0)
src/client/event_printer.cpp (+2/-0)
src/client/events/event_builders.cpp (+14/-1)
src/client/input/android/android_input_lexicon.cpp (+3/-1)
src/client/input/input_event.cpp (+4/-0)
src/include/common/mir/events/event_private.h (+2/-0)
src/server/input/android/input_sender.cpp (+2/-0)
src/server/input/android/input_translator.cpp (+11/-7)
src/server/input/surface_input_dispatcher.cpp (+3/-2)
tests/acceptance-tests/test_client_input.cpp (+34/-0)
tests/mir_test_framework/fake_input_device_impl.cpp (+3/-1)
tests/unit-tests/input/android/test_android_input_sender.cpp (+1/-1)
tests/unit-tests/input/android/test_input_translator.cpp (+7/-1)
To merge this branch: bzr merge lp:~mir-team/mir/relative-pointer-events
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Chris Halse Rogers Approve
Kevin DuBois (community) Approve
Andreas Pokorny Pending
Cemil Azizoglu Pending
Review via email: mp+265424@code.launchpad.net

This proposal supersedes a proposal from 2015-07-16.

Commit message

Provide relative cursor axes as a way to allow Unity8 to draw the pointer.
(LP: #1276322)

Description of the change

Resubmit without prereq

====

Provide relative cursor axes as a way to allow Unity8 to draw the cursor.

This is provided in lieu of the full raw events API we have discussed. The raw events API may still come at a later time other use cases. I wanted to avoid hacking up the android input layer too much when we are intending to replace it soon though.

I have a concern with this branch in that it leaks the location of clients in some cases. If a client receives a stream of input events where dx/dy is changing but x/y is constant then they now know they are on the edge of the screen. I wonder if this is a real problem? If so we could only allow fullscreen surfaces to receive relative coordinates...or brainstorm for more solutions!

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

It would be nice to also have a test case that moves the mouse beyond the border of the screen, and verify that even when - from the pov of the pointer controller - the mouse did not move due to the screen boundaries we still send out relative position changes.

From a short dive through our pointer controller - we seem to override that position related filtering.

review: Approve
Revision history for this message
Robert Carr (robertcarr) wrote : Posted in a previous version of this proposal

Good idea Andreas I manually tested this but something came up in doing the automated testing! Notably it turns out we are batching pointer events which made verifying large streams of events difficult (e.g. sometimes I would get (0,0) -> (1, 1) -> (2, 2) and sometimes (0, 0) -> (2, 2)).

I've updated the test to feature your suggestion and proposed a dependency branch which ensures only touch events are batched.

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote : Posted in a previous version of this proposal

ok

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

still looks good

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote : Posted in a previous version of this proposal

some of the x/y coords like:
32 + float x_axis_value, float y_axis_value,
could make use of some of the mir::geometry stuff, but probably more in line with the existing code's style to have them as floats.

229 + mir_pointer_event_axis_value(pev,mir_pointer_axis_vscroll),
space after comma

323 + const float dx = 7.0f;
324 + const float dy = 9.3f;
const ordering

suppose the last two are hygenic/nits, and the first is a minor suggestion for improvement, so approve overall

review: Approve
Revision history for this message
Robert Carr (robertcarr) wrote : Posted in a previous version of this proposal

In order to avoid controversy I've merged prevent-cursor-batching back out of this branch and implemented a workaround using MIR_CLIENT_INPUT_RATE=0

MIR_CLIENT_INPUT_RATE only disables RESAMPLING and not BATCHING so I've modified that in r2755 to allow disabling batching.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

<copy of review from before resubmission>

some of the x/y coords like:
32 + float x_axis_value, float y_axis_value,
could make use of some of the mir::geometry stuff, but probably more in line with the existing code's style to have them as floats.

229 + mir_pointer_event_axis_value(pev,mir_pointer_axis_vscroll),
space after comma

323 + const float dx = 7.0f;
324 + const float dy = 9.3f;
const ordering

suppose the last two are hygenic/nits, and the first is a minor suggestion for improvement, so approve overall

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

Looks sensible, although I thought we'd be exposing these as a different form of opt-in event?

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Robert Carr (robertcarr) wrote :

Jenkins error unrelated.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp'
2--- 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2015-06-17 05:20:42 +0000
3+++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2015-07-22 17:02:36 +0000
4@@ -2445,6 +2445,9 @@
5
6 mPointerVelocityControl.move(when, &deltaX, &deltaY);
7
8+ pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_RX, deltaX);
9+ pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_RY, deltaY);
10+
11 if (mPointerController != NULL) {
12 if (moved || scrolled || buttonsChanged) {
13 mPointerController->setPresentation(
14
15=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp'
16--- 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2015-04-28 07:54:10 +0000
17+++ 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2015-07-22 17:02:36 +0000
18@@ -462,8 +462,9 @@
19 }
20
21 // Start a new batch if needed.
22- if (mMsg.body.motion.action == AMOTION_EVENT_ACTION_MOVE
23- || mMsg.body.motion.action == AMOTION_EVENT_ACTION_HOVER_MOVE) {
24+ if ((mMsg.body.motion.action == AMOTION_EVENT_ACTION_MOVE
25+ || mMsg.body.motion.action == AMOTION_EVENT_ACTION_HOVER_MOVE)
26+ && frameTime.count() >= 0) {
27 mBatches.push();
28 Batch& batch = mBatches.editTop();
29 batch.samples.push(mMsg);
30
31=== modified file 'include/client/mir/events/event_builders.h'
32--- include/client/mir/events/event_builders.h 2015-06-18 02:46:16 +0000
33+++ include/client/mir/events/event_builders.h 2015-07-22 17:02:36 +0000
34@@ -60,12 +60,20 @@
35 float pressure_value, float touch_major_value, float touch_minor_value, float size_value);
36
37 // Pointer event
38+// Deprecated version without relative axis
39 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
40 MirInputEventModifiers modifiers, MirPointerAction action,
41 MirPointerButtons buttons_pressed,
42 float x_axis_value, float y_axis_value,
43 float hscroll_value, float vscroll_value);
44
45+EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
46+ MirInputEventModifiers modifiers, MirPointerAction action,
47+ MirPointerButtons buttons_pressed,
48+ float x_axis_value, float y_axis_value,
49+ float hscroll_value, float vscroll_value,
50+ float relative_x_value, float relative_y_value);
51+
52 // Input configuration event
53 EventUPtr make_event(MirInputConfigurationAction action,
54 MirInputDeviceId id, std::chrono::nanoseconds time);
55
56=== modified file 'include/client/mir_toolkit/events/input/pointer_event.h'
57--- include/client/mir_toolkit/events/input/pointer_event.h 2015-06-25 11:26:34 +0000
58+++ include/client/mir_toolkit/events/input/pointer_event.h 2015-07-22 17:02:36 +0000
59@@ -61,7 +61,12 @@
60 /* Relative axis containing ticks reported by the vertical scroll wheel */
61 mir_pointer_axis_vscroll = 2,
62 /* Relative axis containing ticks reported by the horizontal scroll wheel */
63- mir_pointer_axis_hscroll = 3
64+ mir_pointer_axis_hscroll = 3,
65+/* Relative axis containing the last reported x differential from the pointer */
66+ mir_pointer_axis_relative_x = 4,
67+/* Relative axis containing the last reported y differential from the pointer */
68+ mir_pointer_axis_relative_y = 5
69+
70 } MirPointerAxis;
71
72 /*
73
74=== modified file 'include/test/mir/test/event_matchers.h'
75--- include/test/mir/test/event_matchers.h 2015-06-22 03:03:59 +0000
76+++ include/test/mir/test/event_matchers.h 2015-07-22 17:02:36 +0000
77@@ -308,6 +308,20 @@
78 return true;
79 }
80
81+MATCHER_P2(PointerEventWithDiff, dx, dy, "")
82+{
83+ auto pev = maybe_pointer_event(to_address(arg));
84+ if (pev == nullptr)
85+ return false;
86+ if (mir_pointer_event_action(pev) != mir_pointer_action_motion)
87+ return false;
88+ if (mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_x) != dx)
89+ return false;
90+ if (mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_y) != dy)
91+ return false;
92+ return true;
93+}
94+
95 MATCHER_P4(TouchEventInDirection, x0, y0, x1, y1, "")
96 {
97 auto tev = maybe_touch_event(to_address(arg));
98
99=== modified file 'src/client/event_printer.cpp'
100--- src/client/event_printer.cpp 2015-05-19 21:34:34 +0000
101+++ src/client/event_printer.cpp 2015-07-22 17:02:36 +0000
102@@ -249,6 +249,8 @@
103 << mir_pointer_event_action(pointer_event) << ", button_state=" << button_state
104 << ", x=" << mir_pointer_event_axis_value(pointer_event, mir_pointer_axis_x)
105 << ", y=" << mir_pointer_event_axis_value(pointer_event, mir_pointer_axis_y)
106+ << ", dx=" << mir_pointer_event_axis_value(pointer_event, mir_pointer_axis_relative_x)
107+ << ", dy=" << mir_pointer_event_axis_value(pointer_event, mir_pointer_axis_relative_y)
108 << ", vscroll=" << mir_pointer_event_axis_value(pointer_event, mir_pointer_axis_vscroll)
109 << ", hscroll=" << mir_pointer_event_axis_value(pointer_event, mir_pointer_axis_hscroll)
110 << ", modifiers=" << mir_pointer_event_modifiers(pointer_event) << ')';
111
112=== modified file 'src/client/events/event_builders.cpp'
113--- src/client/events/event_builders.cpp 2015-06-18 02:46:16 +0000
114+++ src/client/events/event_builders.cpp 2015-07-22 17:02:36 +0000
115@@ -183,7 +183,8 @@
116 MirInputEventModifiers modifiers, MirPointerAction action,
117 MirPointerButtons buttons_pressed,
118 float x_axis_value, float y_axis_value,
119- float hscroll_value, float vscroll_value)
120+ float hscroll_value, float vscroll_value,
121+ float relative_x_value, float relative_y_value)
122 {
123 auto e = new MirEvent;
124 memset(e, 0, sizeof (MirEvent));
125@@ -201,12 +202,24 @@
126 mev.pointer_coordinates[0].action = action;
127 pc.x = x_axis_value;
128 pc.y = y_axis_value;
129+ pc.dx = relative_x_value;
130+ pc.dy = relative_y_value;
131 pc.hscroll = hscroll_value;
132 pc.vscroll = vscroll_value;
133
134 return make_event_uptr(e);
135 }
136
137+mir::EventUPtr mev::make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
138+ MirInputEventModifiers modifiers, MirPointerAction action,
139+ MirPointerButtons buttons_pressed,
140+ float x_axis_value, float y_axis_value,
141+ float hscroll_value, float vscroll_value)
142+{
143+ return make_event(device_id, timestamp, modifiers, action, buttons_pressed,
144+ x_axis_value, y_axis_value, hscroll_value, vscroll_value, 0, 0);
145+}
146+
147 mir::EventUPtr mev::make_event(mf::SurfaceId const& surface_id, xkb_rule_names const& rules)
148 {
149 auto e = new MirEvent;
150
151=== modified file 'src/client/input/android/android_input_lexicon.cpp'
152--- src/client/input/android/android_input_lexicon.cpp 2015-06-17 05:20:42 +0000
153+++ src/client/input/android/android_input_lexicon.cpp 2015-07-22 17:02:36 +0000
154@@ -57,7 +57,9 @@
155 mia::mir_pointer_buttons_from_android(mev->getButtonState()),
156 mev->getX(0), mev->getY(0),
157 mev->getRawAxisValue(AMOTION_EVENT_AXIS_HSCROLL, 0),
158- mev->getRawAxisValue(AMOTION_EVENT_AXIS_VSCROLL, 0));
159+ mev->getRawAxisValue(AMOTION_EVENT_AXIS_VSCROLL, 0),
160+ mev->getRawAxisValue(AMOTION_EVENT_AXIS_RX, 0),
161+ mev->getRawAxisValue(AMOTION_EVENT_AXIS_RY, 0));
162 }
163 else
164 {
165
166=== modified file 'src/client/input/input_event.cpp'
167--- src/client/input/input_event.cpp 2015-06-29 03:29:31 +0000
168+++ src/client/input/input_event.cpp 2015-07-22 17:02:36 +0000
169@@ -399,6 +399,10 @@
170 return old_mev.pointer_coordinates[0].x;
171 case mir_pointer_axis_y:
172 return old_mev.pointer_coordinates[0].y;
173+ case mir_pointer_axis_relative_x:
174+ return old_mev.pointer_coordinates[0].dx;
175+ case mir_pointer_axis_relative_y:
176+ return old_mev.pointer_coordinates[0].dy;
177 case mir_pointer_axis_vscroll:
178 return old_mev.pointer_coordinates[0].vscroll;
179 case mir_pointer_axis_hscroll:
180
181=== modified file 'src/include/common/mir/events/event_private.h'
182--- src/include/common/mir/events/event_private.h 2015-06-18 02:46:16 +0000
183+++ src/include/common/mir/events/event_private.h 2015-07-22 17:02:36 +0000
184@@ -68,6 +68,8 @@
185 int id;
186 float x;
187 float y;
188+ float dx;
189+ float dy;
190 float touch_major;
191 float touch_minor;
192 float size;
193
194=== modified file 'src/server/input/android/input_sender.cpp'
195--- src/server/input/android/input_sender.cpp 2015-06-26 08:00:59 +0000
196+++ src/server/input/android/input_sender.cpp 2015-07-22 17:02:36 +0000
197@@ -277,6 +277,8 @@
198 // here x, y is used instead of the raw co-ordinates and offset is set to zero
199 coords[i].setAxisValue(AMOTION_EVENT_AXIS_X, event.pointer_coordinates[i].x);
200 coords[i].setAxisValue(AMOTION_EVENT_AXIS_Y, event.pointer_coordinates[i].y);
201+ coords[i].setAxisValue(AMOTION_EVENT_AXIS_RX, event.pointer_coordinates[i].dx);
202+ coords[i].setAxisValue(AMOTION_EVENT_AXIS_RY, event.pointer_coordinates[i].dy);
203
204 coords[i].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, event.pointer_coordinates[i].touch_major);
205 coords[i].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, event.pointer_coordinates[i].touch_minor);
206
207=== modified file 'src/server/input/android/input_translator.cpp'
208--- src/server/input/android/input_translator.cpp 2015-06-17 05:20:42 +0000
209+++ src/server/input/android/input_translator.cpp 2015-07-22 17:02:36 +0000
210@@ -112,14 +112,18 @@
211
212 if (mia::android_source_id_is_pointer_device(args->source))
213 {
214+ auto const& pc = args->pointerCoords[0];
215 auto mir_event = mev::make_event(MirInputDeviceId(args->deviceId),
216- args->eventTime,
217- mia::mir_modifiers_from_android(args->metaState),
218- mia::mir_pointer_action_from_masked_android(args->action & AMOTION_EVENT_ACTION_MASK),
219- mia::mir_pointer_buttons_from_android(args->buttonState),
220- args->pointerCoords[0].getX(), args->pointerCoords[0].getY(),
221- args->pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_HSCROLL),
222- args->pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_VSCROLL));
223+ args->eventTime,
224+ mia::mir_modifiers_from_android(args->metaState),
225+ mia::mir_pointer_action_from_masked_android(args->action & AMOTION_EVENT_ACTION_MASK),
226+ mia::mir_pointer_buttons_from_android(args->buttonState),
227+ pc.getX(), pc.getY(),
228+ pc.getAxisValue(AMOTION_EVENT_AXIS_HSCROLL),
229+ pc.getAxisValue(AMOTION_EVENT_AXIS_VSCROLL),
230+ pc.getAxisValue(AMOTION_EVENT_AXIS_RX),
231+ pc.getAxisValue(AMOTION_EVENT_AXIS_RY)
232+ );
233
234 if (!valid_motion_event(mir_event->motion))
235 return;
236
237=== modified file 'src/server/input/surface_input_dispatcher.cpp'
238--- src/server/input/surface_input_dispatcher.cpp 2015-06-24 20:46:14 +0000
239+++ src/server/input/surface_input_dispatcher.cpp 2015-07-22 17:02:36 +0000
240@@ -225,7 +225,9 @@
241 mir_pointer_event_axis_value(pev,mir_pointer_axis_x),
242 mir_pointer_event_axis_value(pev,mir_pointer_axis_y),
243 mir_pointer_event_axis_value(pev,mir_pointer_axis_hscroll),
244- mir_pointer_event_axis_value(pev,mir_pointer_axis_vscroll)));
245+ mir_pointer_event_axis_value(pev,mir_pointer_axis_vscroll),
246+ mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_x),
247+ mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_y)));
248 }
249
250 mi::SurfaceInputDispatcher::PointerInputState& mi::SurfaceInputDispatcher::ensure_pointer_state(MirInputDeviceId id)
251@@ -299,7 +301,6 @@
252 {
253 pointer_state.gesture_owner = target;
254 }
255-
256 deliver(target, pev);
257 return true;
258 }
259
260=== modified file 'tests/acceptance-tests/test_client_input.cpp'
261--- tests/acceptance-tests/test_client_input.cpp 2015-06-26 08:00:59 +0000
262+++ tests/acceptance-tests/test_client_input.cpp 2015-07-22 17:02:36 +0000
263@@ -239,6 +239,40 @@
264 first_client.all_events_received.wait_for_at_most_seconds(120);
265 }
266
267+TEST_F(TestClientInput, clients_receive_relative_pointer_events)
268+{
269+ using namespace ::testing;
270+
271+ mtf::TemporaryEnvironmentValue disable_batching("MIR_CLIENT_INPUT_RATE", "0");
272+
273+ positions[first] = geom::Rectangle{{0,0}, {surface_width, surface_height}};
274+ Client first_client(new_connection(), first);
275+
276+ InSequence seq;
277+ EXPECT_CALL(first_client, handle_input(mt::PointerEnterEvent()));
278+ EXPECT_CALL(first_client, handle_input(AllOf(mt::PointerEventWithPosition(1, 1), mt::PointerEventWithDiff(1, 1))));
279+ EXPECT_CALL(first_client, handle_input(AllOf(mt::PointerEventWithPosition(2, 2), mt::PointerEventWithDiff(1, 1))));
280+ EXPECT_CALL(first_client, handle_input(AllOf(mt::PointerEventWithPosition(3, 3), mt::PointerEventWithDiff(1, 1))));
281+ EXPECT_CALL(first_client, handle_input(AllOf(mt::PointerEventWithPosition(2, 2), mt::PointerEventWithDiff(-1, -1))));
282+ EXPECT_CALL(first_client, handle_input(AllOf(mt::PointerEventWithPosition(1, 1), mt::PointerEventWithDiff(-1, -1))));
283+ // Ensure we continue to receive relative moement even when absolute movement is constrained.
284+ EXPECT_CALL(first_client, handle_input(AllOf(mt::PointerEventWithPosition(0, 0), mt::PointerEventWithDiff(-1, -1))));
285+ EXPECT_CALL(first_client, handle_input(AllOf(mt::PointerEventWithPosition(0, 0), mt::PointerEventWithDiff(-1, -1))));
286+ EXPECT_CALL(first_client, handle_input(AllOf(mt::PointerEventWithPosition(0, 0), mt::PointerEventWithDiff(-1, -1))))
287+ .WillOnce(mt::WakeUp(&first_client.all_events_received));
288+
289+ fake_mouse->emit_event(mis::a_pointer_event().with_movement(1, 1));
290+ fake_mouse->emit_event(mis::a_pointer_event().with_movement(1, 1));
291+ fake_mouse->emit_event(mis::a_pointer_event().with_movement(1, 1));
292+ fake_mouse->emit_event(mis::a_pointer_event().with_movement(-1, -1));
293+ fake_mouse->emit_event(mis::a_pointer_event().with_movement(-1, -1));
294+ fake_mouse->emit_event(mis::a_pointer_event().with_movement(-1, -1));
295+ fake_mouse->emit_event(mis::a_pointer_event().with_movement(-1, -1));
296+ fake_mouse->emit_event(mis::a_pointer_event().with_movement(-1, -1));
297+
298+ first_client.all_events_received.wait_for_at_most_seconds(120);
299+}
300+
301 TEST_F(TestClientInput, clients_receive_button_events_inside_window)
302 {
303 Client first_client(new_connection(), first);
304
305=== modified file 'tests/mir_test_framework/fake_input_device_impl.cpp'
306--- tests/mir_test_framework/fake_input_device_impl.cpp 2015-06-17 05:20:42 +0000
307+++ tests/mir_test_framework/fake_input_device_impl.cpp 2015-07-22 17:02:36 +0000
308@@ -224,7 +224,9 @@
309 pos.x.as_float(),
310 pos.y.as_float(),
311 scroll.x.as_float(),
312- scroll.y.as_float());
313+ scroll.y.as_float(),
314+ pointer.rel_x,
315+ pointer.rel_y);
316
317 sink->handle_input(*pointer_event);
318 }
319
320=== modified file 'tests/unit-tests/input/android/test_android_input_sender.cpp'
321--- tests/unit-tests/input/android/test_android_input_sender.cpp 2015-06-25 03:00:08 +0000
322+++ tests/unit-tests/input/android/test_android_input_sender.cpp 2015-07-22 17:02:36 +0000
323@@ -103,7 +103,7 @@
324 float test_y_coord[2] = {17, 9};
325
326 AndroidInputSender()
327- : key_event(mev::make_event(MirInputDeviceId(), std::chrono::nanoseconds(1), mir_keyboard_action_down,
328+ : key_event(mev::make_event(MirInputDeviceId(), std::chrono::nanoseconds(1), mir_keyboard_action_down,
329 7, test_scan_code, mir_input_event_modifier_none)),
330 motion_event(mev::make_event(MirInputDeviceId(), std::chrono::nanoseconds(-1), mir_input_event_modifier_none))
331 {
332
333=== modified file 'tests/unit-tests/input/android/test_input_translator.cpp'
334--- tests/unit-tests/input/android/test_input_translator.cpp 2015-06-26 08:00:59 +0000
335+++ tests/unit-tests/input/android/test_input_translator.cpp 2015-07-22 17:02:36 +0000
336@@ -167,13 +167,19 @@
337
338 const float x_pos = 12.0f;
339 const float y_pos = 30.0f;
340- EXPECT_CALL(dispatcher, dispatch(mt::PointerEventWithPosition(x_pos, y_pos))).Times(1);
341+ const float dx = 7.0f;
342+ const float dy = 9.3f;
343+ EXPECT_CALL(dispatcher, dispatch(AllOf(
344+ mt::PointerEventWithPosition(x_pos, y_pos),
345+ mt::PointerEventWithDiff(dx, dy)))).Times(1);
346
347 const uint32_t one_pointer = 1;
348
349 properties[0].id = 23;
350 coords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x_pos);
351 coords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y_pos);
352+ coords[0].setAxisValue(AMOTION_EVENT_AXIS_RX, dx);
353+ coords[0].setAxisValue(AMOTION_EVENT_AXIS_RY, dy);
354
355 droidinput::NotifyMotionArgs motion(some_time, device_id, AINPUT_SOURCE_MOUSE, 0, motion_action, no_flags,
356 meta_state, button_state, edge_flags, one_pointer, properties, coords,

Subscribers

People subscribed via source and target branches