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

Proposed by Lukáš Tinkl
Status: Superseded
Proposed branch: lp:~lukas-kde/qtubuntu/fixWheel
Merge into: lp:qtubuntu
Diff against target: 26 lines (+5/-6)
1 file modified
src/ubuntumirclient/input.cpp (+5/-6)
To merge this branch: bzr merge lp:~lukas-kde/qtubuntu/fixWheel
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Approve
PS Jenkins bot continuous-integration Approve
Gerry Boland Pending
Review via email: mp+276251@code.launchpad.net

This proposal has been superseded by a proposal from 2015-11-17.

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: lp:~lukas-kde/qtmir/fixWheel

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
Daniel d'Andrada (dandrader) wrote :

Not specifying the window only for wheel events make the code inconsistent. So mouse movement can go to a window A but mouse wheel events to a window B.

It also breaks the contract of the method dispatchPointerEvent. Its first parameter is the QWindow where events are supposed to go to. It should obey it.

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

merge trunk

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

pass wheel events to window

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

> Not specifying the window only for wheel events make the code inconsistent. So
> mouse movement can go to a window A but mouse wheel events to a window B.
>
> It also breaks the contract of the method dispatchPointerEvent. Its first
> parameter is the QWindow where events are supposed to go to. It should obey
> it.

Fixed

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

I don't think s/localPoint/QCursor::pos() makes any difference as I think we are currently not informing the global position of the cursor.

I think we can find out the global cursor position by doing:
window->position() + localPoint

What do you think?

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

wow, I said "think" too many times on my last comment :)

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

> I don't think s/localPoint/QCursor::pos() makes any difference as I think we
> are currently not informing the global position of the cursor.
>
> I think we can find out the global cursor position by doing:
> window->position() + localPoint
>
> What do you think?

OK, I can try that but still I guess we should stay as close to qtmir as possible, what do you think? :p

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

For the record, both work equally fine.

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

On 10/11/2015 17:15, Lukáš Tinkl wrote:
>> I don't think s/localPoint/QCursor::pos() makes any difference as I think we
>> are currently not informing the global position of the cursor.
>>
>> I think we can find out the global cursor position by doing:
>> window->position() + localPoint
>>
>> What do you think?
> OK, I can try that but still I guess we should stay as close to qtmir as possible, what do you think? :p

The thing is the way mir events are formatted, there's no way for
qtmir/unity8 to tell the global position of the cursor to applications.
That's why qtubuntu should do this math on its own.

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

On 10/11/2015 17:36, Lukáš Tinkl wrote:
> For the record, both work equally fine.

Both will return the same in a single-monitor scenario.

lp:~lukas-kde/qtubuntu/fixWheel updated
287. By Lukáš Tinkl

use window->position() + localPoint() instead of globalPos

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

> On 10/11/2015 17:15, Lukáš Tinkl wrote:
> >> I don't think s/localPoint/QCursor::pos() makes any difference as I think
> we
> >> are currently not informing the global position of the cursor.
> >>
> >> I think we can find out the global cursor position by doing:
> >> window->position() + localPoint
> >>
> >> What do you think?
> > OK, I can try that but still I guess we should stay as close to qtmir as
> possible, what do you think? :p
>
>
> The thing is the way mir events are formatted, there's no way for
> qtmir/unity8 to tell the global position of the cursor to applications.
> That's why qtubuntu should do this math on its own.

Ok, done

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

Code looks ok, didn't test though.

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

And works too.

review: Approve

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntumirclient/input.cpp'
2--- src/ubuntumirclient/input.cpp 2015-10-26 18:27:26 +0000
3+++ src/ubuntumirclient/input.cpp 2015-11-10 22:33:20 +0000
4@@ -448,17 +448,16 @@
5
6 if (hDelta != 0 || vDelta != 0) {
7 const QPoint angleDelta = QPoint(hDelta * 15, vDelta * 15);
8- QWindowSystemInterface::handleWheelEvent(window, timestamp, localPoint, localPoint,
9+ QWindowSystemInterface::handleWheelEvent(window, timestamp, localPoint, window->position() + localPoint,
10 QPoint(), angleDelta, modifiers, Qt::ScrollUpdate);
11- } else {
12- auto buttons = extract_buttons(pev);
13- QWindowSystemInterface::handleMouseEvent(window, timestamp, localPoint, localPoint /* Should we omit global point instead? */,
14- buttons, modifiers);
15 }
16+ auto buttons = extract_buttons(pev);
17+ QWindowSystemInterface::handleMouseEvent(window, timestamp, localPoint, window->position() + localPoint /* Should we omit global point instead? */,
18+ buttons, modifiers);
19 break;
20 }
21 case mir_pointer_action_enter:
22- QWindowSystemInterface::handleEnterEvent(window, localPoint, localPoint);
23+ QWindowSystemInterface::handleEnterEvent(window, localPoint, window->position() + localPoint);
24 break;
25 case mir_pointer_action_leave:
26 QWindowSystemInterface::handleLeaveEvent(window);

Subscribers

People subscribed via source and target branches