Merge lp:~mzanetti/unity8/delay-alt+tab into lp:unity8

Proposed by Michael Zanetti on 2016-10-26
Status: Superseded
Proposed branch: lp:~mzanetti/unity8/delay-alt+tab
Merge into: lp:unity8
Prerequisite: lp:~mzanetti/unity8/spread-blur
Diff against target: 227 lines (+61/-18)
4 files modified
qml/Shell.qml (+2/-1)
qml/Stage/Spread/Spread.qml (+1/-1)
qml/Stage/Spread/SpreadDelegateInputArea.qml (+7/-1)
qml/Stage/Stage.qml (+51/-15)
To merge this branch: bzr merge lp:~mzanetti/unity8/delay-alt+tab
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve on 2016-10-26
Lukáš Tinkl (community) 2016-10-26 Needs Fixing on 2016-10-26
Review via email: mp+309339@code.launchpad.net

This proposal has been superseded by a proposal from 2016-11-08.

Commit Message

Delay alt tab for tiny bit in order to avoid flickering on quick alt-tabs

Description of the Change

Prereq-archive: ppa:ci-train-ppa-service/2022

 * Are there any related MPs required for this MP to build/function as expected? Please list.
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?
nope
 * If you changed the UI, has there been a design review?
design changes requested by Vesa

To post a comment you must log in.
Lukáš Tinkl (lukas-kde) wrote :

Yup, works exactly like I had expected, very nice!

review: Approve
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2672
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2441/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3203
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1830
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1830
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1830
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3231
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3086
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3086/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3086
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3086/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3086
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3086/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3086
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3086/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3086
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3086/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3086
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3086/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3086
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3086/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3086
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3086/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3086
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3086/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Lukáš Tinkl (lukas-kde) wrote :

The tutorial tests probably need fixing

review: Needs Fixing
lp:~mzanetti/unity8/delay-alt+tab updated on 2016-10-26
2673. By Michael Zanetti on 2016-10-26

merge prereq

Michael Zanetti (mzanetti) wrote :

> The tutorial tests probably need fixing

fixed in the prereq

Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2673
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2443/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3206
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1835
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1835
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1835
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3234
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3089
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3089/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3089
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3089/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3089
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3089/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3089
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3089/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3089
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3089/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3089
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3089/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3089
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3089/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3089
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3089/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3089
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3089/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
lp:~mzanetti/unity8/delay-alt+tab updated on 2016-11-09
2674. By Michael Zanetti on 2016-11-08

set a new prereq

2675. By Michael Zanetti on 2016-11-09

merge prereq

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Shell.qml'
2--- qml/Shell.qml 2016-10-03 11:15:27 +0000
3+++ qml/Shell.qml 2016-11-08 13:17:08 +0000
4@@ -442,9 +442,10 @@
5 }
6
7 if (!greeter.locked && tutorial.launcherLongSwipeEnabled
8- && ApplicationManager.focusedApplicationId != "unity8-dash") {
9+ && (ApplicationManager.focusedApplicationId != "unity8-dash" || stage.spreadShown)) {
10 ApplicationManager.requestFocusApplication("unity8-dash")
11 launcher.fadeOut();
12+ stage.closeSpread();
13 }
14 }
15
16
17=== modified file 'qml/Stage/Spread/Spread.qml'
18--- qml/Stage/Spread/Spread.qml 2016-09-20 12:03:51 +0000
19+++ qml/Stage/Spread/Spread.qml 2016-11-08 13:17:08 +0000
20@@ -91,7 +91,7 @@
21
22 readonly property real visibleItemCount: (spreadWidth / spreadItemWidth) / (1 - itemOverlap)
23
24- readonly property real spreadTotalWidth: totalItemCount * spreadWidth / visibleItemCount
25+ readonly property real spreadTotalWidth: Math.max(2,totalItemCount) * spreadWidth / visibleItemCount
26
27 readonly property real centeringOffset: Math.max(spreadWidth - spreadTotalWidth ,0) / (2 * spreadWidth)
28
29
30=== modified file 'qml/Stage/Spread/SpreadDelegateInputArea.qml'
31--- qml/Stage/Spread/SpreadDelegateInputArea.qml 2016-10-11 21:48:40 +0000
32+++ qml/Stage/Spread/SpreadDelegateInputArea.qml 2016-11-08 13:17:08 +0000
33@@ -119,7 +119,13 @@
34 }
35 }
36
37- d.distance = tp.y - tp.startY - offset
38+ if (root.closeable) {
39+ d.distance = tp.y - tp.startY - offset
40+ } else {
41+ var value = tp.y - tp.startY - offset;
42+ d.distance = Math.sqrt(Math.abs(value)) * (value < 0 ? -1 : 1) * 3
43+ }
44+
45 d.pushDragEvent(tp);
46 }
47
48
49=== modified file 'qml/Stage/Stage.qml'
50--- qml/Stage/Stage.qml 2016-11-08 13:17:08 +0000
51+++ qml/Stage/Stage.qml 2016-11-08 13:17:08 +0000
52@@ -53,18 +53,18 @@
53 property real leftEdgeDragProgress: 0
54
55 // Used by the tutorial code
56- readonly property bool spreadShown: state == "spread"
57 readonly property real rightEdgeDragProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0 // How far left the stage has been dragged
58
59 // used by the snap windows (edge maximize) feature
60 readonly property alias previewRectangle: fakeRectangle
61
62+ readonly property bool spreadShown: state == "spread"
63 readonly property var mainApp: priv.focusedAppDelegate ? priv.focusedAppDelegate.application : null
64
65 // application windows never rotate independently
66 property int mainAppWindowOrientationAngle: shellOrientationAngle
67
68- property bool orientationChangesEnabled: priv.focusedAppDelegate && priv.focusedAppDelegate.orientationChangesEnabled
69+ property bool orientationChangesEnabled: !priv.focusedAppDelegate || priv.focusedAppDelegate.orientationChangesEnabled
70
71 property int supportedOrientations: {
72 if (mainApp) {
73@@ -90,7 +90,32 @@
74 }
75
76
77- onAltTabPressedChanged: priv.goneToSpread = altTabPressed
78+ onAltTabPressedChanged: {
79+ if (altTabPressed) {
80+ altTabDelayTimer.start();
81+ } else {
82+ // Alt Tab has been released, did we already go to spread?
83+ if (priv.goneToSpread) {
84+ priv.goneToSpread = false;
85+ } else {
86+ // No we didn't, do a quick alt-tab
87+ if (appRepeater.count > 1) {
88+ appRepeater.itemAt(1).claimFocus();
89+ }
90+ }
91+ }
92+ }
93+
94+ Timer {
95+ id: altTabDelayTimer
96+ interval: 140
97+ repeat: false
98+ onTriggered: {
99+ if (root.altTabPressed) {
100+ priv.goneToSpread = true;
101+ }
102+ }
103+ }
104
105 property Item itemConfiningMouseCursor: !spreadShown && priv.focusedAppDelegate && priv.focusedAppDelegate.surface &&
106 priv.focusedAppDelegate.surface.confinesMousePointer ?
107@@ -105,9 +130,13 @@
108 edgeBarrier.push(amount);
109 }
110
111+ function closeSpread() {
112+ priv.goneToSpread = false;
113+ }
114+
115 onSpreadEnabledChanged: {
116- if (!spreadEnabled && root.state == "spread") {
117- priv.goneToSpread = false;
118+ if (!spreadEnabled && spreadShown) {
119+ closeSpread();
120 }
121 }
122
123@@ -231,6 +260,12 @@
124 readonly property bool sideStageEnabled: root.mode === "stagedWithSideStage" &&
125 (root.shellOrientation == Qt.LandscapeOrientation ||
126 root.shellOrientation == Qt.InvertedLandscapeOrientation)
127+ onSideStageEnabledChanged: {
128+ for (var i = 0; i < appRepeater.count; i++) {
129+ appRepeater.itemAt(i).refreshStage();
130+ }
131+ priv.updateMainAndSideStageIndexes();
132+ }
133
134 property var mainStageDelegate: null
135 property var sideStageDelegate: null
136@@ -251,7 +286,7 @@
137 priv.sideStageItemId = 0;
138 priv.sideStageAppId = "";
139 priv.mainStageDelegate = appRepeater.itemAt(0);
140- priv.mainStageAppId = topLevelSurfaceList.idAt(0);
141+ priv.mainStageItemId = topLevelSurfaceList.idAt(0);
142 priv.mainStageAppId = topLevelSurfaceList.applicationAt(0) ? topLevelSurfaceList.applicationAt(0).appId : ""
143 return;
144 }
145@@ -444,7 +479,7 @@
146 },
147 State {
148 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
149- PropertyChanges { target: triGestureArea; enabled: true }
150+ PropertyChanges { target: triGestureArea; enabled: priv.sideStageEnabled }
151 PropertyChanges { target: sideStage; visible: true }
152 },
153 State {
154@@ -478,7 +513,7 @@
155 }
156 },
157 Transition {
158- to: "stagedRightEdge"
159+ to: "stagedRightEdge,sideStagedRightEdge"
160 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
161 },
162 Transition {
163@@ -545,7 +580,7 @@
164 bottom: parent.bottom
165 }
166 width: appContainer.width - sideStage.width
167- enabled: sideStage.enabled
168+ enabled: priv.sideStageEnabled
169
170 onDropped: {
171 drop.source.appDelegate.saveStage(ApplicationInfoInterface.MainStage);
172@@ -589,7 +624,7 @@
173 }
174
175 onShownChanged: {
176- if (!shown && priv.mainStageDelegate) {
177+ if (!shown && priv.mainStageDelegate && !root.spreadShown) {
178 priv.mainStageDelegate.claimFocus();
179 }
180 }
181@@ -702,10 +737,6 @@
182 }
183 }
184 }
185- Connections {
186- target: priv
187- onSideStageEnabledChanged: refreshStage()
188- }
189
190 readonly property alias application: decoratedWindow.application
191 readonly property alias minimumWidth: decoratedWindow.minimumWidth
192@@ -1075,6 +1106,7 @@
193 showHighlight: spreadItem.highlightedIndex === index
194 darkening: spreadItem.highlightedIndex >= 0
195 anchors.topMargin: dragArea.distance
196+ interactive: false
197 }
198 PropertyChanges {
199 target: appDelegate
200@@ -1114,7 +1146,10 @@
201 scaleToPreviewSize: spreadItem.stackHeight
202 scaleToPreviewProgress: stagedRightEdgeMaths.scaleToPreviewProgress
203 shadowOpacity: .3
204+ interactive: false
205 }
206+ // make sure it's visible but transparent so it fades in when we transition to spread
207+ PropertyChanges { target: windowInfoItem; opacity: 0; visible: true }
208 },
209 State {
210 name: "windowedRightEdge"
211@@ -1373,6 +1408,7 @@
212 PropertyAction { target: decoratedWindow; property: "scaleToPreviewSize" }
213 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
214 UbuntuNumberAnimation { target: decoratedWindow; properties: "width,height,itemScale,angle,scaleToPreviewProgress"; duration: priv.animationDuration }
215+ UbuntuNumberAnimation { target: windowInfoItem; properties: "opacity"; duration: priv.animationDuration }
216 },
217 Transition {
218 from: "normal,staged"; to: "stagedWithSideStage"
219@@ -1585,7 +1621,7 @@
220 maxWidth: {
221 var nextApp = appRepeater.itemAt(index + 1);
222 if (nextApp) {
223- return nextApp.x - appDelegate.x - units.gu(1)
224+ return Math.max(iconHeight, nextApp.x - appDelegate.x - units.gu(1))
225 }
226 return appDelegate.width;
227 }

Subscribers

People subscribed via source and target branches