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
=== modified file 'qml/Stages/WindowDecoration.qml'
--- qml/Stages/WindowDecoration.qml 2016-05-02 11:35:53 +0000
+++ qml/Stages/WindowDecoration.qml 2016-06-15 16:58:24 +0000
@@ -27,7 +27,7 @@
27 property Item target27 property Item target
28 property alias title: titleLabel.text28 property alias title: titleLabel.text
29 property bool active: false29 property bool active: false
30 hoverEnabled: true30 acceptedButtons: Qt.AllButtons // prevent leaking unhandled mouse events
3131
32 signal closeClicked()32 signal closeClicked()
33 signal minimizeClicked()33 signal minimizeClicked()
@@ -35,7 +35,11 @@
35 signal maximizeHorizontallyClicked()35 signal maximizeHorizontallyClicked()
36 signal maximizeVerticallyClicked()36 signal maximizeVerticallyClicked()
3737
38 onDoubleClicked: root.maximizeClicked()38 onDoubleClicked: {
39 if (mouse.button == Qt.LeftButton) {
40 root.maximizeClicked();
41 }
42 }
3943
40 QtObject {44 QtObject {
41 id: priv45 id: priv
@@ -45,7 +49,7 @@
45 }49 }
4650
47 onPressedChanged: {51 onPressedChanged: {
48 if (pressed) {52 if (pressed && pressedButtons == Qt.LeftButton) {
49 var pos = mapToItem(root.target, mouseX, mouseY);53 var pos = mapToItem(root.target, mouseX, mouseY);
50 priv.distanceX = pos.x;54 priv.distanceX = pos.x;
51 priv.distanceY = pos.y;55 priv.distanceY = pos.y;
@@ -65,6 +69,9 @@
65 }69 }
66 }70 }
6771
72 // do not let unhandled wheel event pass thru the decoration
73 onWheel: wheel.accepted = true;
74
68 Rectangle {75 Rectangle {
69 anchors.fill: parent76 anchors.fill: parent
70 anchors.bottomMargin: -radius77 anchors.bottomMargin: -radius
7178
=== modified file 'tests/qmltests/Stages/tst_DesktopStage.qml'
--- tests/qmltests/Stages/tst_DesktopStage.qml 2016-05-06 08:16:07 +0000
+++ tests/qmltests/Stages/tst_DesktopStage.qml 2016-06-15 16:58:24 +0000
@@ -89,6 +89,13 @@
89 topLevelSurfaceList: topSurfaceList89 topLevelSurfaceList: topSurfaceList
90 }90 }
91 }91 }
92
93 MouseArea {
94 id: clickThroughTester
95 anchors.fill: desktopStageLoader.item
96 acceptedButtons: Qt.AllButtons
97 hoverEnabled: true
98 }
92 }99 }
93100
94 Rectangle {101 Rectangle {
@@ -140,6 +147,11 @@
140 }147 }
141 }148 }
142149
150 SignalSpy {
151 id: mouseEaterSpy
152 target: clickThroughTester
153 }
154
143 UnityTestCase {155 UnityTestCase {
144 id: testCase156 id: testCase
145 name: "DesktopStage"157 name: "DesktopStage"
@@ -179,6 +191,7 @@
179 desktopStageLoader.active = true;191 desktopStageLoader.active = true;
180 tryCompare(desktopStageLoader, "status", Loader.Ready);192 tryCompare(desktopStageLoader, "status", Loader.Ready);
181193
194 mouseEaterSpy.clear();
182 }195 }
183196
184 function waitUntilAppSurfaceShowsUp(surfaceId) {197 function waitUntilAppSurfaceShowsUp(surfaceId) {
@@ -654,5 +667,56 @@
654 var closeButton = findChild(dashAppDelegate, "closeWindowButton");667 var closeButton = findChild(dashAppDelegate, "closeWindowButton");
655 tryCompare(closeButton, "visible", false);668 tryCompare(closeButton, "visible", false);
656 }669 }
670
671 function test_eatWindowDecorationMouseEvents_data() {
672 return [
673 {tag: "left mouse click", signalName: "clicked", button: Qt.LeftButton },
674 {tag: "right mouse click", signalName: "clicked", button: Qt.RightButton },
675 {tag: "middle mouse click", signalName: "clicked", button: Qt.MiddleButton },
676 {tag: "mouse wheel", signalName: "wheel", button: Qt.MiddleButton },
677 {tag: "double click (RMB)", signalName: "doubleClicked", button: Qt.RightButton },
678 ]
679 }
680
681 function test_eatWindowDecorationMouseEvents(data) {
682 var dialerAppDelegate = startApplication("dialer-app");
683 verify(dialerAppDelegate);
684 var decoration = findChild(dialerAppDelegate, "appWindowDecoration");
685 verify(decoration);
686
687 mouseEaterSpy.signalName = data.signalName;
688 if (data.signalName === "wheel") {
689 mouseWheel(decoration, decoration.width/2, decoration.height/2, 20, 20);
690 } else if (data.signalName === "clicked") {
691 mouseClick(decoration, decoration.width/2, decoration.height/2, data.button);
692 } else {
693 mouseDoubleClick(decoration, decoration.width/2, decoration.height/2, data.button);
694 tryCompare(dialerAppDelegate, "maximized", false);
695 }
696
697 tryCompare(mouseEaterSpy, "count", 0);
698 }
699
700 function test_canMoveWindowWithLeftMouseButtonOnly_data() {
701 return [
702 {tag: "left mouse button", button: Qt.LeftButton },
703 {tag: "right mouse button", button: Qt.RightButton },
704 {tag: "middle mouse button", button: Qt.MiddleButton }
705 ]
706 }
707
708 function test_canMoveWindowWithLeftMouseButtonOnly(data) {
709 var appDelegate = startApplication("dialer-app");
710 verify(appDelegate);
711
712 var posBefore = Qt.point(appDelegate.x, appDelegate.y);
713
714 mousePress(appDelegate, appDelegate.width / 2, units.gu(1), data.button);
715 mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100), undefined /* delay */, data.button);
716
717 var posAfter = Qt.point(appDelegate.x, appDelegate.y);
718
719 tryCompareFunction(function(){return posBefore == posAfter;}, data.button !== Qt.LeftButton ? true : false);
720 }
657 }721 }
658}722}

Subscribers

People subscribed via source and target branches