Merge lp:~azzar1/unity8/dragging-cursor-on-first-press into lp:unity8
- dragging-cursor-on-first-press
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Lukáš Tinkl |
Approved revision: | 2610 |
Merged at revision: | 2711 |
Proposed branch: | lp:~azzar1/unity8/dragging-cursor-on-first-press |
Merge into: | lp:unity8 |
Prerequisite: | lp:~mzanetti/unity8/unified-stages |
Diff against target: |
215 lines (+124/-2) 6 files modified
qml/Stage/MoveHandler.qml (+8/-0) tests/mocks/Unity/Application/CMakeLists.txt (+1/-0) tests/mocks/Unity/Application/MirMock.cpp (+49/-0) tests/mocks/Unity/Application/MirMock.h (+39/-0) tests/mocks/Unity/Application/plugin.cpp (+11/-2) tests/qmltests/Stage/tst_DesktopStage.qml (+16/-0) |
To merge this branch: | bzr merge lp:~azzar1/unity8/dragging-cursor-on-first-press |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Albert Astals Cid (community) | Abstain | ||
Unity8 CI Bot | continuous-integration | Approve | |
Lukáš Tinkl (community) | Approve | ||
Review via email: mp+307830@code.launchpad.net |
This proposal supersedes a proposal from 2016-08-29.
Commit message
Set Mir.cursorName to "grabbing" on first mouse press on a window decoration. Don't wait for press+motion.
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
Yes, lp:~mzanetti/unity8/unified-stages but it's merged and listed as prerequisite.
* 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?
Not a visual change. The behavior is now similar to unity7 and all major DEs.
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal | # |
It doesn't work correctly when you double-click the decoration (to maximize the window)
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2603
https:/
Executed test runs:
Click here to trigger a rebuild:
https:/
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal | # |
Fixed!
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
Text conflict in qml/Stages/
1 conflicts encountered.
Also, should we have a test?
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal | # |
> Text conflict in qml/Stages/
> 1 conflicts encountered.
>
> Also, should we have a test?
Yeah I tried to add a test but asserting for Mir.Cursor does not work.
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
> > Text conflict in qml/Stages/
> > 1 conflicts encountered.
> >
> > Also, should we have a test?
>
> Yeah I tried to add a test but asserting for Mir.Cursor does not work.
What do you mean it does not work?
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal | # |
> > > Text conflict in qml/Stages/
> > > 1 conflicts encountered.
> > >
> > > Also, should we have a test?
> >
> > Yeah I tried to add a test but asserting for Mir.Cursor does not work.
>
> What do you mean it does not work?
Mir.cursorName is always "undefined" when running tests. Likely it requires a Mir session.
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
Conflicts with https:/
Given how unified-stages is our focus on landing ASAP i'd suggest you rebase on top of it.
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
> Mir.cursorName is always "undefined" when running tests. Likely it requires a
> Mir session.
No, it does not, Mir.cursorName in "real life" is provided by qtmir's Unity.Application plugin (./src/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2605
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
UNSTABLE: 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:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2607
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: 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:/
Albert Astals Cid (aacid) wrote : | # |
Should we remove the
qmlRegisterUncr
line from the mock plugin.cpp?
Declaring Mir both a singleton an uncreatable is a bit weird, no?
Andrea Azzarone (azzar1) wrote : | # |
> Should we remove the
>
> qmlRegisterUncr
> it can't be instantiated");
>
> line from the mock plugin.cpp?
>
> Declaring Mir both a singleton an uncreatable is a bit weird, no?
Fixed thanks.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2609
https:/
Executed test runs:
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:/
Albert Astals Cid (aacid) wrote : | # |
Code looks good.
BUT
When i use it on my computer i don't get a dragging icon at all and terminal says
[2016-10-
This is a realtively clean user and a relatively new install.
Any idea what may be wrong?
Lukáš Tinkl (lukas-kde) wrote : | # |
Worked fine here, just tested it
Only wondering where does this magic constant "175" for the timer coming from? :)
Andrea Azzarone (azzar1) wrote : | # |
> Worked fine here, just tested it
>
> Only wondering where does this magic constant "175" for the timer coming from?
> :)
It's the same we have in unity7.
Lukáš Tinkl (lukas-kde) wrote : | # |
OK, no objections from me then :)
Albert Astals Cid (aacid) wrote : | # |
Text conflict in tests/qmltests/
1 conflicts encountered.
Note: Was already top approved
- 2610. By Andrea Azzarone
-
Merge with trunk and resolve conflicts.
Andrea Azzarone (azzar1) wrote : | # |
> Text conflict in tests/qmltests/
> 1 conflicts encountered.
>
> Note: Was already top approved
Fixed.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2610
https:/
Executed test runs:
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:/
Albert Astals Cid (aacid) : | # |
Preview Diff
1 | === modified file 'qml/Stage/MoveHandler.qml' |
2 | --- qml/Stage/MoveHandler.qml 2016-09-27 15:03:00 +0000 |
3 | +++ qml/Stage/MoveHandler.qml 2016-10-28 12:29:16 +0000 |
4 | @@ -54,6 +54,11 @@ |
5 | property bool nearBottomLeftCorner: target.maximizedBottomLeft |
6 | property bool nearBottomRightCorner: target.maximizedBottomRight |
7 | |
8 | + property Timer mouseDownTimer: Timer { |
9 | + interval: 175 |
10 | + onTriggered: Mir.cursorName = "grabbing" |
11 | + } |
12 | + |
13 | function resetEdges() { |
14 | nearLeftEdge = false; |
15 | nearRightEdge = false; |
16 | @@ -93,14 +98,17 @@ |
17 | } |
18 | |
19 | priv.dragging = true; |
20 | + priv.mouseDownTimer.start(); |
21 | } else { |
22 | priv.dragging = false; |
23 | + priv.mouseDownTimer.stop(); |
24 | Mir.cursorName = ""; |
25 | } |
26 | } |
27 | |
28 | function handlePositionChanged(mouse, sensingPoints) { |
29 | if (priv.dragging) { |
30 | + priv.mouseDownTimer.stop(); |
31 | Mir.cursorName = "grabbing"; |
32 | |
33 | // restore from maximized when dragging away from edges/corners; guard against inadvertent changes when going into maximized state |
34 | |
35 | === modified file 'tests/mocks/Unity/Application/CMakeLists.txt' |
36 | --- tests/mocks/Unity/Application/CMakeLists.txt 2016-06-30 13:51:32 +0000 |
37 | +++ tests/mocks/Unity/Application/CMakeLists.txt 2016-10-28 12:29:16 +0000 |
38 | @@ -5,6 +5,7 @@ |
39 | MirSurface.cpp |
40 | MirSurfaceItem.cpp |
41 | MirSurfaceListModel.cpp |
42 | + MirMock.cpp |
43 | ObjectListModel.h |
44 | SurfaceManager.cpp |
45 | VirtualKeyboard.cpp |
46 | |
47 | === added file 'tests/mocks/Unity/Application/MirMock.cpp' |
48 | --- tests/mocks/Unity/Application/MirMock.cpp 1970-01-01 00:00:00 +0000 |
49 | +++ tests/mocks/Unity/Application/MirMock.cpp 2016-10-28 12:29:16 +0000 |
50 | @@ -0,0 +1,49 @@ |
51 | +/* |
52 | + * Copyright (C) 2016 Canonical, Ltd. |
53 | + * |
54 | + * This program is free software; you can redistribute it and/or modify |
55 | + * it under the terms of the GNU General Public License as published by |
56 | + * the Free Software Foundation; version 3. |
57 | + * |
58 | + * This program is distributed in the hope that it will be useful, |
59 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
60 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
61 | + * GNU General Public License for more details. |
62 | + * |
63 | + * You should have received a copy of the GNU General Public License |
64 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
65 | + */ |
66 | + |
67 | +#include "MirMock.h" |
68 | + |
69 | +MirMock *MirMock::the_mir = nullptr; |
70 | + |
71 | +MirMock *MirMock::instance() |
72 | +{ |
73 | + return the_mir; |
74 | +} |
75 | + |
76 | +MirMock::MirMock() |
77 | +{ |
78 | + Q_ASSERT(the_mir == nullptr); |
79 | + the_mir = this; |
80 | +} |
81 | + |
82 | +MirMock::~MirMock() |
83 | +{ |
84 | + Q_ASSERT(the_mir == this); |
85 | + the_mir = nullptr; |
86 | +} |
87 | + |
88 | +void MirMock::setCursorName(const QString &cursorName) |
89 | +{ |
90 | + if (cursorName != m_cursorName) { |
91 | + m_cursorName = cursorName; |
92 | + Q_EMIT cursorNameChanged(m_cursorName); |
93 | + } |
94 | +} |
95 | + |
96 | +QString MirMock::cursorName() const |
97 | +{ |
98 | + return m_cursorName; |
99 | +} |
100 | |
101 | === added file 'tests/mocks/Unity/Application/MirMock.h' |
102 | --- tests/mocks/Unity/Application/MirMock.h 1970-01-01 00:00:00 +0000 |
103 | +++ tests/mocks/Unity/Application/MirMock.h 2016-10-28 12:29:16 +0000 |
104 | @@ -0,0 +1,39 @@ |
105 | +/* |
106 | + * Copyright (C) 2016 Canonical, Ltd. |
107 | + * |
108 | + * This program is free software; you can redistribute it and/or modify |
109 | + * it under the terms of the GNU General Public License as published by |
110 | + * the Free Software Foundation; version 3. |
111 | + * |
112 | + * This program is distributed in the hope that it will be useful, |
113 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
114 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
115 | + * GNU General Public License for more details. |
116 | + * |
117 | + * You should have received a copy of the GNU General Public License |
118 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
119 | + */ |
120 | + |
121 | +#ifndef MIR_MOCK_H |
122 | +#define MIR_MOCK_H |
123 | + |
124 | +#include <unity/shell/application/Mir.h> |
125 | + |
126 | +class MirMock : public ::Mir |
127 | +{ |
128 | + Q_OBJECT |
129 | +public: |
130 | + explicit MirMock(); |
131 | + virtual ~MirMock(); |
132 | + |
133 | + static MirMock *instance(); |
134 | + |
135 | + void setCursorName(const QString &cursorName) override; |
136 | + QString cursorName() const override; |
137 | + |
138 | +private: |
139 | + static MirMock *the_mir; |
140 | + QString m_cursorName; |
141 | +}; |
142 | + |
143 | +#endif |
144 | |
145 | === modified file 'tests/mocks/Unity/Application/plugin.cpp' |
146 | --- tests/mocks/Unity/Application/plugin.cpp 2016-06-30 13:51:32 +0000 |
147 | +++ tests/mocks/Unity/Application/plugin.cpp 2016-10-28 12:29:16 +0000 |
148 | @@ -17,6 +17,7 @@ |
149 | #include "plugin.h" |
150 | #include "ApplicationInfo.h" |
151 | #include "ApplicationManager.h" |
152 | +#include "MirMock.h" |
153 | #include "MirSurfaceItem.h" |
154 | #include "SurfaceManager.h" |
155 | |
156 | @@ -38,6 +39,9 @@ |
157 | if (!SurfaceManager::instance()) { |
158 | new SurfaceManager; |
159 | } |
160 | + if (!MirMock::instance()) { |
161 | + new MirMock; |
162 | + } |
163 | } |
164 | |
165 | QObject* applicationManagerSingleton(QQmlEngine*, QJSEngine*) |
166 | @@ -46,6 +50,12 @@ |
167 | return new ApplicationManager; |
168 | } |
169 | |
170 | +QObject* mirSingleton(QQmlEngine*, QJSEngine*) |
171 | +{ |
172 | + createUnityApplicationSharedSingletons(); |
173 | + return MirMock::instance(); |
174 | +} |
175 | + |
176 | QObject* surfaceManagerSingleton(QQmlEngine*, QJSEngine*) |
177 | { |
178 | createUnityApplicationSharedSingletons(); |
179 | @@ -78,9 +88,8 @@ |
180 | qmlRegisterType<ApplicationInfo>(uri, 0, 1, "ApplicationInfo"); |
181 | |
182 | qmlRegisterSingletonType<ApplicationManager>(uri, 0, 1, "ApplicationManager", applicationManagerSingleton); |
183 | + qmlRegisterSingletonType<MirMock>(uri, 0, 1, "Mir", mirSingleton); |
184 | qmlRegisterSingletonType<SurfaceManager>(uri, 0, 1, "SurfaceManager", surfaceManagerSingleton); |
185 | - |
186 | - qmlRegisterUncreatableType<Mir>(uri, 0, 1, "Mir", "Mir provides enum values, it can't be instantiated"); |
187 | } |
188 | |
189 | void FakeUnityApplicationQmlPlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
190 | |
191 | === modified file 'tests/qmltests/Stage/tst_DesktopStage.qml' |
192 | --- tests/qmltests/Stage/tst_DesktopStage.qml 2016-09-27 15:03:00 +0000 |
193 | +++ tests/qmltests/Stage/tst_DesktopStage.qml 2016-10-28 12:29:16 +0000 |
194 | @@ -788,5 +788,21 @@ |
195 | |
196 | tryCompare(dialerAppDelegate, "state", "maximized"); |
197 | } |
198 | + |
199 | + function test_grabbingCursorOnDecorationPress() { |
200 | + var appDelegate = startApplication("dialer-app"); |
201 | + verify(appDelegate); |
202 | + var decoration = findChild(appDelegate, "appWindowDecoration"); |
203 | + verify(decoration); |
204 | + |
205 | + mousePress(decoration, decoration.width/2, decoration.height/2, Qt.LeftButton); |
206 | + tryCompare(Mir, "cursorName", "grabbing"); |
207 | + |
208 | + mouseMove(decoration, decoration.width/2 + 1, decoration.height/2 + 1); |
209 | + tryCompare(Mir, "cursorName", "grabbing"); |
210 | + |
211 | + mouseRelease(decoration); |
212 | + tryCompare(Mir, "cursorName", ""); |
213 | + } |
214 | } |
215 | } |
FAILED: Continuous integration, rev:2602 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2053/ /unity8- jenkins. ubuntu. com/job/ build/2697 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= vivid+overlay, testname= qmluitests. sh/1484 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= xenial+ overlay, testname= qmluitests. sh/1484 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= yakkety, testname= qmluitests. sh/1484 /unity8- jenkins. ubuntu. com/job/ build-0- fetch/2725 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 2598 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 2598 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 2598 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 2591 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 2591/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 2591 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 2591/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 2591 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 2591/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 2591 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 2591/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 2591 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 2591/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 2591 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 2591/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 2591 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 2591/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 2591 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 2591/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 2591 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 2591/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: 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: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2053/ rebuild
https:/