Merge lp:~lukas-kde/qtmir/fixWheel into lp:qtmir

Proposed by Lukáš Tinkl
Status: Superseded
Proposed branch: lp:~lukas-kde/qtmir/fixWheel
Merge into: lp:qtmir
Diff against target: 100 lines (+9/-31)
3 files modified
src/platforms/mirserver/qteventfeeder.cpp (+7/-25)
src/platforms/mirserver/qteventfeeder.h (+1/-3)
tests/mirserver/QtEventFeeder/mock_qtwindowsystem.h (+1/-3)
To merge this branch: bzr merge lp:~lukas-kde/qtmir/fixWheel
Reviewer Review Type Date Requested Status
Gerry Boland (community) Needs Fixing
Daniel d'Andrada (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+276252@code.launchpad.net

Commit message

Fix inconsistent mouse wheel scrolling behavior

Description of the change

Fix inconsistent mouse wheel scrolling behavior

Need to pass a nullptr as a target, QWindowSystemInterface will internally choose the window to send the event to based on the globalPos only (QCursor::pos() in this case).

Related branch: https://code.launchpad.net/~unity-team/qtubuntu/fixWheel/+merge/277680

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

I doesn't make sense to handle enter and leave events in qtmir right now.

This might actually be harmful as the qt mouse pointer is defined and controlled by the Cursor qml plugin in unity8. Sending enter and leave events directly to Qt ourselves contradicts the mouse events generated by that qml element.

If unity8's QGuiApplication is to get any mouse enter and leave events, they should come from the Cursor plugin, not from qtmir.

Those enter and leave events are from the mir cursor, which we are ignoring right now.

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Thus I think the way to go is to remove this enter and leave event handling altogether. We should have it only once we ditch the qml Cursor approach and start using the mir cursor.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

The wheel events should be given to the platform cursor so it can be handled over to the qml Cursor just like we do with motion events.

review: Needs Fixing
lp:~lukas-kde/qtmir/fixWheel updated
400. By Lukáš Tinkl

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~lukas-kde/qtmir/fixWheel updated
401. By Lukáš Tinkl

remove handling of enter/leave events

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

> Thus I think the way to go is to remove this enter and leave event handling
> altogether. We should have it only once we ditch the qml Cursor approach and
> start using the mir cursor.

Removed, still working fine

lp:~lukas-kde/qtmir/fixWheel updated
402. By Lukáš Tinkl

also remove mock enter/leave events

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> The wheel events should be given to the platform cursor so it can be handled
> over to the qml Cursor just like we do with motion events.

hmmm... not really need in this case since you're using the static QCursor::pos() function which returns the position of our QML Cursor already.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> The wheel events should be given to the platform cursor so it can be handled
> over to the qml Cursor just like we do with motion events.

hmmm... not really need in this case since you're using the static QCursor::pos() function which returns the position of our QML Cursor already.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Please remove the now supeefluous code and document behavior a bit:
http://bazaar.launchpad.net/~dandrader/qtmir/fixWheel/revision/406

review: Needs Fixing
lp:~lukas-kde/qtmir/fixWheel updated
403. By Lukáš Tinkl

remove superfluous code, document the wheel behavior

merge lp:~dandrader/qtmir/fixWheel

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

> Please remove the now supeefluous code and document behavior a bit:
> http://bazaar.launchpad.net/~dandrader/qtmir/fixWheel/revision/406

Thanks for that, fixed

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Looking good. Didn't test though.

review: Approve (code)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

And works too

review: Approve
Revision history for this message
Gerry Boland (gerboland) wrote :

This is in silo48, and in testing, mouse wheel on external display is not working. It is working well on internal display though

review: Needs Fixing

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/mirserver/qteventfeeder.cpp'
2--- src/platforms/mirserver/qteventfeeder.cpp 2015-10-29 11:58:29 +0000
3+++ src/platforms/mirserver/qteventfeeder.cpp 2015-11-10 18:49:24 +0000
4@@ -435,25 +435,16 @@
5 }
6 }
7
8- void handleWheelEvent(ulong timestamp, const QPointF &localPoint, const QPointF &globalPoint,
9+ void handleWheelEvent(ulong timestamp, const QPointF &globalPoint,
10 QPoint pixelDelta, QPoint angleDelta,
11 Qt::KeyboardModifiers mods, Qt::ScrollPhase phase) override
12 {
13- QWindowSystemInterface::handleWheelEvent(m_screenController->getWindowForPoint(localPoint.toPoint()),
14- timestamp, localPoint, globalPoint,
15+ // NB: The target QWindow is deduced by Qt from globalPoint when null is passed.
16+ // localPoint is irrelevant as Qt will calculate it from the QWindow it sends it to.
17+ QWindowSystemInterface::handleWheelEvent(nullptr /* window */, timestamp, QPointF() /* localPoint */, globalPoint,
18 pixelDelta, angleDelta, mods, phase);
19 }
20
21- void handleEnterEvent(const QPointF &localPoint, const QPointF &globalPoint) override
22- {
23- QWindowSystemInterface::handleEnterEvent(m_screenController->getWindowForPoint(localPoint.toPoint()), localPoint, globalPoint);
24- }
25-
26- void handleLeaveEvent(const QPointF &localPoint) override
27- {
28- QWindowSystemInterface::handleLeaveEvent(m_screenController->getWindowForPoint(localPoint.toPoint()));
29- }
30-
31 private:
32 QSharedPointer<ScreenController> m_screenController;
33 };
34@@ -561,8 +552,6 @@
35
36 auto movement = QPointF(mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_x),
37 mir_pointer_event_axis_value(pev, mir_pointer_axis_relative_y));
38- auto local_point = QPointF(mir_pointer_event_axis_value(pev, mir_pointer_axis_x),
39- mir_pointer_event_axis_value(pev, mir_pointer_axis_y));
40
41 switch (action) {
42 case mir_pointer_action_button_up:
43@@ -574,20 +563,13 @@
44
45 if (hDelta != 0 || vDelta != 0) {
46 const QPoint angleDelta = QPoint(hDelta * 15, vDelta * 15);
47- mQtWindowSystem->handleWheelEvent(timestamp.count(), local_point, local_point,
48+ mQtWindowSystem->handleWheelEvent(timestamp.count(), QCursor::pos(),
49 QPoint(), angleDelta, modifiers, Qt::ScrollUpdate);
50- } else {
51- auto buttons = getQtMouseButtonsfromMirPointerEvent(pev);
52- mQtWindowSystem->handleMouseEvent(timestamp.count(), movement, buttons, modifiers);
53 }
54+ auto buttons = getQtMouseButtonsfromMirPointerEvent(pev);
55+ mQtWindowSystem->handleMouseEvent(timestamp.count(), movement, buttons, modifiers);
56 break;
57 }
58- case mir_pointer_action_enter:
59- mQtWindowSystem->handleEnterEvent(local_point, local_point);
60- break;
61- case mir_pointer_action_leave:
62- mQtWindowSystem->handleLeaveEvent(local_point);
63- break;
64 default:
65 qCDebug(QTMIR_MIR_INPUT) << "Unrecognized pointer event";
66 }
67
68=== modified file 'src/platforms/mirserver/qteventfeeder.h'
69--- src/platforms/mirserver/qteventfeeder.h 2015-10-14 13:36:25 +0000
70+++ src/platforms/mirserver/qteventfeeder.h 2015-11-10 18:49:24 +0000
71@@ -52,12 +52,10 @@
72 Qt::KeyboardModifiers mods = Qt::NoModifier) = 0;
73 virtual void handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButtons buttons,
74 Qt::KeyboardModifiers modifiers) = 0;
75- virtual void handleWheelEvent(ulong timestamp, const QPointF &localPoint, const QPointF &globalPoint,
76+ virtual void handleWheelEvent(ulong timestamp, const QPointF &globalPoint,
77 QPoint pixelDelta, QPoint angleDelta,
78 Qt::KeyboardModifiers mods = Qt::NoModifier,
79 Qt::ScrollPhase phase = Qt::ScrollUpdate) = 0;
80- virtual void handleEnterEvent(const QPointF &localPoint = QPointF(), const QPointF &globalPoint = QPointF()) = 0;
81- virtual void handleLeaveEvent(const QPointF &localPoint = QPointF()) = 0;
82 };
83
84 QtEventFeeder(const QSharedPointer<ScreenController> &screenController);
85
86=== modified file 'tests/mirserver/QtEventFeeder/mock_qtwindowsystem.h'
87--- tests/mirserver/QtEventFeeder/mock_qtwindowsystem.h 2015-10-14 13:36:25 +0000
88+++ tests/mirserver/QtEventFeeder/mock_qtwindowsystem.h 2015-11-10 18:49:24 +0000
89@@ -42,10 +42,8 @@
90 const QList<struct QWindowSystemInterface::TouchPoint> &points,
91 Qt::KeyboardModifiers mods));
92 MOCK_METHOD4(handleMouseEvent, void(ulong timestamp, QPointF point, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers));
93- MOCK_METHOD7(handleWheelEvent, void(ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta,
94+ MOCK_METHOD6(handleWheelEvent, void(ulong timestamp, const QPointF & global, QPoint pixelDelta, QPoint angleDelta,
95 Qt::KeyboardModifiers mods, Qt::ScrollPhase phase));
96- MOCK_METHOD2(handleEnterEvent, void(const QPointF &localPoint, const QPointF& globalPoint));
97- MOCK_METHOD1(handleLeaveEvent, void(const QPointF &localPoint));
98 };
99
100 namespace testing

Subscribers

People subscribed via source and target branches