Mir

Merge lp:~andreas-pokorny/mir/fix-1496814 into lp:mir

Proposed by Andreas Pokorny
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 2950
Proposed branch: lp:~andreas-pokorny/mir/fix-1496814
Merge into: lp:mir
Diff against target: 79 lines (+19/-4)
1 file modified
3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp (+19/-4)
To merge this branch: bzr merge lp:~andreas-pokorny/mir/fix-1496814
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Kevin DuBois (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Approve
Review via email: mp+271626@code.launchpad.net

Commit message

Fix missing relative cursor movement information for touchpads

Since touchpads emit multi touch events that have to be translated to get to relative cursor movement they are handled by a different InputMapper than mice. To enable unity8 cursors on touchpads too, this change extends the various branches of touchpad gesture interpretation to also emit the relative change.

Description of the change

This is hopefully the last fix inside the android input stack. As soon as we turn libinput into the default input backend (which may or may not happen with 0.17) this is no longer needed. I am proposing this change so that any qtmir work on top of lp:mir can happen with a touchpad..

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

No tests?

The code looks plausible but I don't have the kit to check or tests to review.

Approving on the basis that we're not expecting to support for long and it is at worst harmless.

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

lgtm, would be better with tests of course... but like Alan notes, hopefully going away soon anyways.

review: Approve
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

Yes.. testing exactly that behaviour means recording a touchpad ioctl and evdev events with each code path case: one finger hovering, one finger down, multiple finger hovering and or down... My assumption was that this code wont be executed for long... yes there is still a lot of bad conscience to deal with left.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Cool

review: Approve

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-08-20 23:33:42 +0000
3+++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2015-09-18 09:41:00 +0000
4@@ -4583,13 +4583,15 @@
5 }
6 }
7
8+ float deltaX = 0.0f;
9+ float deltaY = 0.0f;
10 if (activeTouchId >= 0 && mLastFingerIds.contains(activeTouchId)) {
11 const RawPointerData::Pointer& currentPointer =
12 mCurrentRawPointerData.pointerForId(activeTouchId);
13 const RawPointerData::Pointer& lastPointer =
14 mLastRawPointerData.pointerForId(activeTouchId);
15- float deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale;
16- float deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale;
17+ deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale;
18+ deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale;
19
20 rotateDelta(mSurfaceOrientation, &deltaX, &deltaY);
21 mPointerVelocityControl.move(when, &deltaX, &deltaY);
22@@ -4614,6 +4616,8 @@
23 mPointerGesture.currentGestureCoords[0].clear();
24 mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x);
25 mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y);
26+ mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RX, deltaX);
27+ mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RY, deltaY);
28 mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
29 } else if (currentFingerCount == 0) {
30 // Case 3. No fingers down and button is not pressed. (NEUTRAL)
31@@ -4716,14 +4720,17 @@
32 mPointerGesture.currentGestureMode = PointerGesture::TAP_DRAG;
33 }
34
35+ float deltaX = 0.0f;
36+ float deltaY = 0.0f;
37+
38 if (mLastFingerIds.contains(activeTouchId)) {
39 const RawPointerData::Pointer& currentPointer =
40 mCurrentRawPointerData.pointerForId(activeTouchId);
41 const RawPointerData::Pointer& lastPointer =
42 mLastRawPointerData.pointerForId(activeTouchId);
43- float deltaX = (currentPointer.x - lastPointer.x)
44+ deltaX = (currentPointer.x - lastPointer.x)
45 * mPointerXMovementScale;
46- float deltaY = (currentPointer.y - lastPointer.y)
47+ deltaY = (currentPointer.y - lastPointer.y)
48 * mPointerYMovementScale;
49
50 rotateDelta(mSurfaceOrientation, &deltaX, &deltaY);
51@@ -4765,6 +4772,8 @@
52 mPointerGesture.currentGestureCoords[0].clear();
53 mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x);
54 mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y);
55+ mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RX, deltaX);
56+ mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RY, deltaY);
57 mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE,
58 down ? 1.0f : 0.0f);
59
60@@ -5011,6 +5020,8 @@
61 mPointerGesture.referenceGestureX);
62 mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y,
63 mPointerGesture.referenceGestureY);
64+ mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RX, commonDeltaX);
65+ mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RY, commonDeltaY);
66 mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
67 } else if (mPointerGesture.currentGestureMode == PointerGesture::FREEFORM) {
68 // FREEFORM mode.
69@@ -5108,6 +5119,10 @@
70 mPointerGesture.currentGestureCoords[i].setAxisValue(
71 AMOTION_EVENT_AXIS_Y, mPointerGesture.referenceGestureY + deltaY);
72 mPointerGesture.currentGestureCoords[i].setAxisValue(
73+ AMOTION_EVENT_AXIS_RX, deltaX);
74+ mPointerGesture.currentGestureCoords[i].setAxisValue(
75+ AMOTION_EVENT_AXIS_RY, deltaY);
76+ mPointerGesture.currentGestureCoords[i].setAxisValue(
77 AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
78
79 ++i;

Subscribers

People subscribed via source and target branches