Merge lp:~lukas-kde/unity8/eatDecorationMouseEvents into lp:unity8

Proposed by Lukáš Tinkl
Status: Superseded
Proposed branch: lp:~lukas-kde/unity8/eatDecorationMouseEvents
Merge into: lp:unity8
Diff against target: 139 lines (+74/-3)
2 files modified
qml/Stages/WindowDecoration.qml (+10/-3)
tests/qmltests/Stages/tst_DesktopStage.qml (+64/-0)
To merge this branch: bzr merge lp:~lukas-kde/unity8/eatDecorationMouseEvents
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Needs Fixing
Daniel d'Andrada (community) Needs Fixing
Review via email: mp+296438@code.launchpad.net

This proposal has been superseded by a proposal from 2016-06-15.

Commit message

Do not let mouse and wheel events pass thru the titlebar

Description of the change

Do not let mouse and wheel events pass thru the titlebar

* Are there any related MPs required for this MP to build/function as expected? Please list.

No

* Did you perform an exploratory manual test run of your code change and any related functionality?

Yes

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

N/A

* If you changed the UI, has there been a design review?

N/A

To post a comment you must log in.
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

"""
- hoverEnabled: true
"""

So you never needed hover events in that MouseArea?

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

> """
> - hoverEnabled: true
> """
>
> So you never needed hover events in that MouseArea?

Correct, they are needed in WindowControlButtons but not here

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2442
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1376/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/1841
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/925
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/925
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/925
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1867
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1805
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1805
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1805
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1796
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1796/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1796
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1796/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1796
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1796/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1796
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1796/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1796
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1796/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1796
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1796/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1796
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1796/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1796
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1796/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1796
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1796/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1376/rebuild

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

You're now able to move the window around by dragging with any mouse button pressed.

Please write a regression test for that

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

What about having the test in a tst_WindowDecoration instead of in tst_DesktopStage? No need to involve the whole desktop stage.

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

And please try to make tests a such a way that they can be executed manually in "make tryFoo". For this specific case, see "make tryPanel" for an example. It's background goes read when a mouse press reaches it.

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

> It's background goes read when a mouse press reaches it.

s/It's/Its
s/read/red

2443. By Lukáš Tinkl

don't accept drags with button != left; fix the tests

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

> And please try to make tests a such a way that they can be executed manually
> in "make tryFoo". For this specific case, see "make tryPanel" for an example.
> It's background goes read when a mouse press reaches it.

The functionality can be tried out in either make tryShell or make tryDesktopStage.

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

> You're now able to move the window around by dragging with any mouse button
> pressed.
>
> Please write a regression test for that

Thanks for spotting, fixed! Also corrected the test so that it checks for the "pressed" signal instead of "clicked" (which was the source of this "regression").

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2443
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1455/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/1933
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/993
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/993
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/993
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1959
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1894
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1894
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1894
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1885
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1885/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1885
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1885/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1885
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1885/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1885
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1885/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1885
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1885/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1885
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1885/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1885
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1885/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1885
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1885/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1885
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1885/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1455/rebuild

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

Imagine the replacement of all stages with a single, new, one that mzanetti is working on. With this branch, there's yet another test he has to juggle around and mind about. But it's unnecessary as the test is not about stages code. It's a DecoratedWindow internal detail he shouldn't bother about when refactoring stages code.

It would make our qmltests code base more modular if this was moved to a tst_DecoratedWindow or a tst_WindowDecoration (ie, having it as, or closer to being, a unit test). Unless you think it's interesting to also exercise surrounding code along with it (ie, as a integration test). But following this rationale we could just as well move it to tst_OrientedShell...

In short: I believe this test looks more like (as is best as) a unit test then a integration test

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

- Move mouse over the window decoration
   * mouse cursor shape is an arrow)
- Press left mouse button over the window decoration
- Move mouse (window is dragged along)
   * mouse cursor shape is a closed hand
- Lift left mouse button

expected outcome:
Mouse cursor shape is an arrow once again

actual outcome:
Mouse cursor shape remains a closed hand. Moving it over a window border fixes it.

review: Needs Fixing
2444. By Lukáš Tinkl

consolidate the mouse deco test

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2445. By Lukáš Tinkl

add a test for window (decoration) dragging using different mouse buttons

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

> - Move mouse over the window decoration
> * mouse cursor shape is an arrow)
> - Press left mouse button over the window decoration
> - Move mouse (window is dragged along)
> * mouse cursor shape is a closed hand
> - Lift left mouse button
>
> expected outcome:
> Mouse cursor shape is an arrow once again
>
> actual outcome:
> Mouse cursor shape remains a closed hand. Moving it over a window border fixes
> it.

Fixed, and also added another test for checking for moving/dragging the window with different mouse buttons.

2446. By Lukáš Tinkl

merge lp:~lukas-kde/unity8/preventScrollThruShellElements

2447. By Lukáš Tinkl

merge trunk, resolve conflicts

Unmerged revisions

2441. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Stages/WindowDecoration.qml'
2--- qml/Stages/WindowDecoration.qml 2016-05-02 11:35:53 +0000
3+++ qml/Stages/WindowDecoration.qml 2016-06-15 16:58:24 +0000
4@@ -27,7 +27,7 @@
5 property Item target
6 property alias title: titleLabel.text
7 property bool active: false
8- hoverEnabled: true
9+ acceptedButtons: Qt.AllButtons // prevent leaking unhandled mouse events
10
11 signal closeClicked()
12 signal minimizeClicked()
13@@ -35,7 +35,11 @@
14 signal maximizeHorizontallyClicked()
15 signal maximizeVerticallyClicked()
16
17- onDoubleClicked: root.maximizeClicked()
18+ onDoubleClicked: {
19+ if (mouse.button == Qt.LeftButton) {
20+ root.maximizeClicked();
21+ }
22+ }
23
24 QtObject {
25 id: priv
26@@ -45,7 +49,7 @@
27 }
28
29 onPressedChanged: {
30- if (pressed) {
31+ if (pressed && pressedButtons == Qt.LeftButton) {
32 var pos = mapToItem(root.target, mouseX, mouseY);
33 priv.distanceX = pos.x;
34 priv.distanceY = pos.y;
35@@ -65,6 +69,9 @@
36 }
37 }
38
39+ // do not let unhandled wheel event pass thru the decoration
40+ onWheel: wheel.accepted = true;
41+
42 Rectangle {
43 anchors.fill: parent
44 anchors.bottomMargin: -radius
45
46=== modified file 'tests/qmltests/Stages/tst_DesktopStage.qml'
47--- tests/qmltests/Stages/tst_DesktopStage.qml 2016-05-06 08:16:07 +0000
48+++ tests/qmltests/Stages/tst_DesktopStage.qml 2016-06-15 16:58:24 +0000
49@@ -89,6 +89,13 @@
50 topLevelSurfaceList: topSurfaceList
51 }
52 }
53+
54+ MouseArea {
55+ id: clickThroughTester
56+ anchors.fill: desktopStageLoader.item
57+ acceptedButtons: Qt.AllButtons
58+ hoverEnabled: true
59+ }
60 }
61
62 Rectangle {
63@@ -140,6 +147,11 @@
64 }
65 }
66
67+ SignalSpy {
68+ id: mouseEaterSpy
69+ target: clickThroughTester
70+ }
71+
72 UnityTestCase {
73 id: testCase
74 name: "DesktopStage"
75@@ -179,6 +191,7 @@
76 desktopStageLoader.active = true;
77 tryCompare(desktopStageLoader, "status", Loader.Ready);
78
79+ mouseEaterSpy.clear();
80 }
81
82 function waitUntilAppSurfaceShowsUp(surfaceId) {
83@@ -654,5 +667,56 @@
84 var closeButton = findChild(dashAppDelegate, "closeWindowButton");
85 tryCompare(closeButton, "visible", false);
86 }
87+
88+ function test_eatWindowDecorationMouseEvents_data() {
89+ return [
90+ {tag: "left mouse click", signalName: "clicked", button: Qt.LeftButton },
91+ {tag: "right mouse click", signalName: "clicked", button: Qt.RightButton },
92+ {tag: "middle mouse click", signalName: "clicked", button: Qt.MiddleButton },
93+ {tag: "mouse wheel", signalName: "wheel", button: Qt.MiddleButton },
94+ {tag: "double click (RMB)", signalName: "doubleClicked", button: Qt.RightButton },
95+ ]
96+ }
97+
98+ function test_eatWindowDecorationMouseEvents(data) {
99+ var dialerAppDelegate = startApplication("dialer-app");
100+ verify(dialerAppDelegate);
101+ var decoration = findChild(dialerAppDelegate, "appWindowDecoration");
102+ verify(decoration);
103+
104+ mouseEaterSpy.signalName = data.signalName;
105+ if (data.signalName === "wheel") {
106+ mouseWheel(decoration, decoration.width/2, decoration.height/2, 20, 20);
107+ } else if (data.signalName === "clicked") {
108+ mouseClick(decoration, decoration.width/2, decoration.height/2, data.button);
109+ } else {
110+ mouseDoubleClick(decoration, decoration.width/2, decoration.height/2, data.button);
111+ tryCompare(dialerAppDelegate, "maximized", false);
112+ }
113+
114+ tryCompare(mouseEaterSpy, "count", 0);
115+ }
116+
117+ function test_canMoveWindowWithLeftMouseButtonOnly_data() {
118+ return [
119+ {tag: "left mouse button", button: Qt.LeftButton },
120+ {tag: "right mouse button", button: Qt.RightButton },
121+ {tag: "middle mouse button", button: Qt.MiddleButton }
122+ ]
123+ }
124+
125+ function test_canMoveWindowWithLeftMouseButtonOnly(data) {
126+ var appDelegate = startApplication("dialer-app");
127+ verify(appDelegate);
128+
129+ var posBefore = Qt.point(appDelegate.x, appDelegate.y);
130+
131+ mousePress(appDelegate, appDelegate.width / 2, units.gu(1), data.button);
132+ mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100), undefined /* delay */, data.button);
133+
134+ var posAfter = Qt.point(appDelegate.x, appDelegate.y);
135+
136+ tryCompareFunction(function(){return posBefore == posAfter;}, data.button !== Qt.LeftButton ? true : false);
137+ }
138 }
139 }

Subscribers

People subscribed via source and target branches