Merge lp:~lukas-kde/unity8/eatDecorationMouseEvents into lp:unity8
- eatDecorationMouseEvents
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Daniel d'Andrada | ||||
Approved revision: | 2447 | ||||
Merged at revision: | 2508 | ||||
Proposed branch: | lp:~lukas-kde/unity8/eatDecorationMouseEvents | ||||
Merge into: | lp:unity8 | ||||
Prerequisite: | lp:~lukas-kde/unity8/preventScrollThruShellElements | ||||
Diff against target: |
114 lines (+61/-4) 2 files modified
qml/Stages/WindowDecoration.qml (+10/-4) tests/qmltests/Stages/tst_DesktopStage.qml (+51/-0) |
||||
To merge this branch: | bzr merge lp:~lukas-kde/unity8/eatDecorationMouseEvents | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity8 CI Bot | continuous-integration | Needs Fixing | |
Michał Sawicz | Needs Fixing | ||
Daniel d'Andrada (community) | Approve | ||
Review via email: mp+297511@code.launchpad.net |
This proposal supersedes a proposal from 2016-06-03.
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.
Yes, see prereq
* 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
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal | # |
> """
> - hoverEnabled: true
> """
>
> So you never needed hover events in that MouseArea?
Correct, they are needed in WindowControlBu
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:2442
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
You're now able to move the window around by dragging with any mouse button pressed.
Please write a regression test for that
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
What about having the test in a tst_WindowDecor
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
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.
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
> It's background goes read when a mouse press reaches it.
s/It's/Its
s/read/red
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal | # |
> 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.
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal | # |
> 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").
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2443
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
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_WindowDecor
In short: I believe this test looks more like (as is best as) a unit test then a integration test
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
- 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.
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2444
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2445
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal | # |
> - 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.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2445
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Daniel d'Andrada (dandrader) wrote : | # |
I'm getting a conflict in tests/qmltests/
Daniel d'Andrada (dandrader) : | # |
Daniel d'Andrada (dandrader) wrote : | # |
$ bzr branch lp:unity8 foo
$ cd foo
$ bzr merge lp:~lukas-kde/unity8/preventScrollThruShellElements && bzr commit -m"Merge lp:~lukas-$ kde/unity8/
$ bzr merge lp:~lukas-kde/unity8/eatDecorationMouseEvents
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2446
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Daniel d'Andrada (dandrader) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes
* Did CI run pass? If not, please explain why.
No, due to missing dependencies. Affected test passes locally though.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2446
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2446
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Michał Sawicz (saviq) wrote : | # |
Text conflict in qml/Stages/
- 2447. By Lukáš Tinkl
-
merge trunk, resolve conflicts
Lukáš Tinkl (lukas-kde) wrote : | # |
Merged trunk, conflict resolved
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2447
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'qml/Stages/WindowDecoration.qml' |
2 | --- qml/Stages/WindowDecoration.qml 2016-06-17 01:14:28 +0000 |
3 | +++ qml/Stages/WindowDecoration.qml 2016-06-20 09:51:09 +0000 |
4 | @@ -27,17 +27,20 @@ |
5 | property Item target |
6 | property alias title: titleLabel.text |
7 | property bool active: false |
8 | + acceptedButtons: Qt.AllButtons // prevent leaking unhandled mouse events |
9 | property alias overlayShown: buttons.overlayShown |
10 | |
11 | - hoverEnabled: true |
12 | - |
13 | signal closeClicked() |
14 | signal minimizeClicked() |
15 | signal maximizeClicked() |
16 | signal maximizeHorizontallyClicked() |
17 | signal maximizeVerticallyClicked() |
18 | |
19 | - onDoubleClicked: root.maximizeClicked() |
20 | + onDoubleClicked: { |
21 | + if (mouse.button == Qt.LeftButton) { |
22 | + root.maximizeClicked(); |
23 | + } |
24 | + } |
25 | |
26 | QtObject { |
27 | id: priv |
28 | @@ -47,7 +50,7 @@ |
29 | } |
30 | |
31 | onPressedChanged: { |
32 | - if (pressed) { |
33 | + if (pressed && pressedButtons == Qt.LeftButton) { |
34 | var pos = mapToItem(root.target, mouseX, mouseY); |
35 | priv.distanceX = pos.x; |
36 | priv.distanceY = pos.y; |
37 | @@ -70,6 +73,9 @@ |
38 | } |
39 | } |
40 | |
41 | + // do not let unhandled wheel event pass thru the decoration |
42 | + onWheel: wheel.accepted = true; |
43 | + |
44 | Rectangle { |
45 | anchors.fill: parent |
46 | anchors.bottomMargin: -radius |
47 | |
48 | === modified file 'tests/qmltests/Stages/tst_DesktopStage.qml' |
49 | --- tests/qmltests/Stages/tst_DesktopStage.qml 2016-06-20 09:51:09 +0000 |
50 | +++ tests/qmltests/Stages/tst_DesktopStage.qml 2016-06-20 09:51:09 +0000 |
51 | @@ -691,6 +691,28 @@ |
52 | tryCompare(closeButton, "visible", false); |
53 | } |
54 | |
55 | + function test_canMoveWindowWithLeftMouseButtonOnly_data() { |
56 | + return [ |
57 | + {tag: "left mouse button", button: Qt.LeftButton }, |
58 | + {tag: "right mouse button", button: Qt.RightButton }, |
59 | + {tag: "middle mouse button", button: Qt.MiddleButton } |
60 | + ] |
61 | + } |
62 | + |
63 | + function test_canMoveWindowWithLeftMouseButtonOnly(data) { |
64 | + var appDelegate = startApplication("dialer-app"); |
65 | + verify(appDelegate); |
66 | + |
67 | + var posBefore = Qt.point(appDelegate.x, appDelegate.y); |
68 | + |
69 | + mousePress(appDelegate, appDelegate.width / 2, units.gu(1), data.button); |
70 | + mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100), undefined /* delay */, data.button); |
71 | + |
72 | + var posAfter = Qt.point(appDelegate.x, appDelegate.y); |
73 | + |
74 | + tryCompareFunction(function(){return posBefore == posAfter;}, data.button !== Qt.LeftButton ? true : false); |
75 | + } |
76 | + |
77 | function test_preventMouseEventsThruDesktopSpread() { |
78 | var spread = findChild(desktopStage, "spread"); |
79 | verify(spread); |
80 | @@ -708,5 +730,34 @@ |
81 | |
82 | spread.cancel(); |
83 | } |
84 | + |
85 | + function test_eatWindowDecorationMouseEvents_data() { |
86 | + return [ |
87 | + {tag: "left mouse click", signalName: "clicked", button: Qt.LeftButton }, |
88 | + {tag: "right mouse click", signalName: "clicked", button: Qt.RightButton }, |
89 | + {tag: "middle mouse click", signalName: "clicked", button: Qt.MiddleButton }, |
90 | + {tag: "mouse wheel", signalName: "wheel", button: Qt.MiddleButton }, |
91 | + {tag: "double click (RMB)", signalName: "doubleClicked", button: Qt.RightButton }, |
92 | + ] |
93 | + } |
94 | + |
95 | + function test_eatWindowDecorationMouseEvents(data) { |
96 | + var dialerAppDelegate = startApplication("dialer-app"); |
97 | + verify(dialerAppDelegate); |
98 | + var decoration = findChild(dialerAppDelegate, "appWindowDecoration"); |
99 | + verify(decoration); |
100 | + |
101 | + mouseEaterSpy.signalName = data.signalName; |
102 | + if (data.signalName === "wheel") { |
103 | + mouseWheel(decoration, decoration.width/2, decoration.height/2, 20, 20); |
104 | + } else if (data.signalName === "clicked") { |
105 | + mouseClick(decoration, decoration.width/2, decoration.height/2, data.button); |
106 | + } else { |
107 | + mouseDoubleClick(decoration, decoration.width/2, decoration.height/2, data.button); |
108 | + tryCompare(dialerAppDelegate, "maximized", false); |
109 | + } |
110 | + |
111 | + tryCompare(mouseEaterSpy, "count", 0); |
112 | + } |
113 | } |
114 | } |
"""
- hoverEnabled: true
"""
So you never needed hover events in that MouseArea?