Merge lp:~unity-team/unity8/fixTinyWindows into lp:unity8

Proposed by Michał Sawicz
Status: Superseded
Proposed branch: lp:~unity-team/unity8/fixTinyWindows
Merge into: lp:unity8
Prerequisite: lp:~unity-team/unity8/launcher-sizing
Diff against target: 1335 lines (+485/-196)
13 files modified
data/com.canonical.Unity8.gschema.xml (+11/-0)
qml/Components/PhysicalKeysMapper.qml (+0/-4)
qml/Launcher/Launcher.qml (+32/-10)
qml/Launcher/LauncherDelegate.qml (+8/-12)
qml/Launcher/LauncherPanel.qml (+34/-34)
qml/Shell.qml (+18/-1)
qml/Stages/AbstractStage.qml (+2/-0)
qml/Stages/DesktopStage.qml (+15/-12)
qml/Stages/WindowResizeArea.qml (+5/-4)
tests/mocks/GSettings.1.0/fake_gsettings.cpp (+64/-0)
tests/mocks/GSettings.1.0/fake_gsettings.h (+18/-0)
tests/qmltests/Launcher/tst_Launcher.qml (+110/-26)
tests/qmltests/tst_Shell.qml (+168/-93)
To merge this branch: bzr merge lp:~unity-team/unity8/fixTinyWindows
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity8 CI Bot continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+287154@code.launchpad.net

This proposal has been superseded by a proposal from 2016-02-25.

Commit message

Fix tiny windows when switching stages

Description of the change

Fix tiny windows when switching stages

Requires binding on requested dimensions due to screen size being 0 in some cases.

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~unity-team/unity8/fixTinyWindows updated
2087. By Michael Zanetti

merge prereq

2088. By Michael Zanetti

don't shrink the complete stage

2089. By Michael Zanetti

default to autohide

2090. By Lukáš Tinkl

fix tiny windows when switching stages

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~unity-team/unity8/fixTinyWindows updated
2091. By Lukáš Tinkl

fix for fullscreen apps in desktop mode

2092. By Lukáš Tinkl

similar fix to height...

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.Unity8.gschema.xml'
2--- data/com.canonical.Unity8.gschema.xml 2015-11-24 17:44:18 +0000
3+++ data/com.canonical.Unity8.gschema.xml 2016-02-25 13:19:27 +0000
4@@ -27,6 +27,17 @@
5 <summary>Maximum push needed to overcome edge barrier</summary>
6 <description>How much you have to push (in grid units) the mouse against an edge barrier when sensibility is 1.</description>
7 </key>
8+ <key type="b" name="autohide-launcher">
9+ <default>true</default>
10+ <summary>Autohide the launcher</summary>
11+ <description>This will only be applied in windowed mode. In staged mode, the launcher will always hide.</description>
12+ </key>
13+ <key type="u" name="launcher-width">
14+ <default>8</default>
15+ <range min="6" max="12"/>
16+ <summary>Width of the launcher in grid units.</summary>
17+ <description>Changes the width of the launcher in all usage modes.</description>
18+ </key>
19 </schema>
20
21 <schema path="/com/canonical/unity8/greeter/" id="com.canonical.Unity8.Greeter" gettext-domain="unity8">
22
23=== modified file 'qml/Components/PhysicalKeysMapper.qml'
24--- qml/Components/PhysicalKeysMapper.qml 2016-02-25 13:19:27 +0000
25+++ qml/Components/PhysicalKeysMapper.qml 2016-02-25 13:19:27 +0000
26@@ -119,15 +119,12 @@
27 d.volumeUpKeyPressed = true;
28 }
29 } else if (event.key == Qt.Key_Alt || (root.controlInsteadOfAlt && event.key == Qt.Key_Control)) {
30-<<<<<<< TREE
31 if (!d.altPressed || event.isAutoRepeat) {
32 // Only eat it if it's the first time we receive alt pressed (or if it's the autorepeat of the first press)
33 d.altPressed = true;
34 event.accepted = true;
35 d.altPressInjected = false;
36 }
37-=======
38- d.altPressed = true;
39
40 // Adding MetaModifier here because that's what keyboards do. Pressing Super_L actually gives
41 // Super_L + MetaModifier. This helps to make sure we only invoke superPressed if no other
42@@ -136,7 +133,6 @@
43 || (root.controlInsteadOfSuper && event.key == Qt.Key_Control)
44 ) {
45 d.superPressed = true;
46->>>>>>> MERGE-SOURCE
47 } else if (event.key == Qt.Key_Tab) {
48 if (d.altPressed && !d.altTabPressed) {
49 d.altTabPressed = true;
50
51=== modified file 'qml/Launcher/Launcher.qml'
52--- qml/Launcher/Launcher.qml 2016-02-25 13:19:27 +0000
53+++ qml/Launcher/Launcher.qml 2016-02-25 13:19:27 +0000
54@@ -25,11 +25,12 @@
55 id: root
56
57 property bool autohideEnabled: false
58+ property bool lockedVisible: false
59 property bool available: true // can be used to disable all interactions
60 property alias inverted: panel.inverted
61 property bool shadeBackground: true // can be used to disable background shade when launcher is visible
62
63- property int panelWidth: units.gu(8)
64+ property int panelWidth: units.gu(10)
65 property int dragAreaWidth: units.gu(1)
66 property int minimizeDistance: units.gu(26)
67 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
68@@ -92,12 +93,24 @@
69 }
70 }
71
72+ onLockedVisibleChanged: {
73+ if (lockedVisible && state == "") {
74+ panel.dismissTimer.stop();
75+ fadeOutAnimation.stop();
76+ switchToNextState("visible")
77+ } else if (!lockedVisible && state == "visible") {
78+ hide();
79+ }
80+ }
81+
82 function hide() {
83 switchToNextState("")
84 }
85
86 function fadeOut() {
87- fadeOutAnimation.start();
88+ if (!root.lockedVisible) {
89+ fadeOutAnimation.start();
90+ }
91 }
92
93 function switchToNextState(state) {
94@@ -172,7 +185,7 @@
95 } else if (panel.highlightIndex >= 0) {
96 launcherApplicationSelected(LauncherModel.get(panel.highlightIndex).appId);
97 }
98- root.state = ""
99+ root.hide();
100 event.accepted = true;
101 root.focus = false;
102 }
103@@ -211,6 +224,13 @@
104 interval: 1
105 property string nextState: ""
106 onTriggered: {
107+ if (root.lockedVisible && nextState == "") {
108+ // Due to binding updates when switching between modes
109+ // it could happen that our request to show will be overwritten
110+ // with a hide request. Rewrite it when we know hiding is not allowed.
111+ nextState = "visible"
112+ }
113+
114 // switching to an intermediate state here to make sure all the
115 // values are restored, even if we were already in the target state
116 root.state = "tmp"
117@@ -256,7 +276,7 @@
118
119 MouseArea {
120 id: launcherDragArea
121- enabled: root.available && (root.state == "visible" || root.state == "visibleTemporary")
122+ enabled: root.available && (root.state == "visible" || root.state == "visibleTemporary") && !root.lockedVisible
123 anchors.fill: panel
124 anchors.rightMargin: -units.gu(2)
125 drag {
126@@ -277,9 +297,10 @@
127 InverseMouseArea {
128 id: closeMouseArea
129 anchors.fill: panel
130- enabled: root.shadeBackground && root.state == "visible"
131+ enabled: root.shadeBackground && root.state == "visible" && (!root.lockedVisible || panel.highlightIndex >= -1)
132 visible: enabled
133 onPressed: {
134+ panel.highlightIndex = -2
135 root.hide();
136 }
137 }
138@@ -288,7 +309,7 @@
139 id: backgroundShade
140 anchors.fill: parent
141 color: "black"
142- opacity: root.shadeBackground && root.state == "visible" ? 0.6 : 0
143+ opacity: root.shadeBackground && root.state == "visible" && !root.lockedVisible ? 0.6 : 0
144
145 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.BriskDuration } }
146 }
147@@ -332,7 +353,7 @@
148 Connections {
149 target: panel.dismissTimer
150 onTriggered: {
151- if (root.autohideEnabled) {
152+ if (root.autohideEnabled && !root.lockedVisible) {
153 if (!panel.preventHiding) {
154 root.state = ""
155 } else {
156@@ -345,11 +366,11 @@
157 property bool animate: true
158
159 onApplicationSelected: {
160- root.state = ""
161+ root.hide();
162 launcherApplicationSelected(appId)
163 }
164 onShowDashHome: {
165- root.state = ""
166+ root.hide();
167 root.showDashHome();
168 }
169
170@@ -360,7 +381,8 @@
171 }
172
173 onKbdNavigationCancelled: {
174- root.state = "";
175+ panel.highlightIndex = -2;
176+ root.hide();
177 root.focus = false;
178 }
179
180
181=== modified file 'qml/Launcher/LauncherDelegate.qml'
182--- qml/Launcher/LauncherDelegate.qml 2016-02-25 13:19:27 +0000
183+++ qml/Launcher/LauncherDelegate.qml 2016-02-25 13:19:27 +0000
184@@ -124,7 +124,7 @@
185
186 Item {
187 id: iconItem
188- width: parent.itemWidth + units.gu(1)
189+ width: root.width
190 height: parent.itemHeight + units.gu(1)
191 anchors.centerIn: parent
192
193@@ -142,7 +142,7 @@
194 ProportionalShape {
195 id: iconShape
196 anchors.centerIn: parent
197- width: parent.width - units.gu(2)
198+ width: root.itemWidth
199 aspect: UbuntuShape.DropShadow
200 source: Image {
201 id: iconImage
202@@ -158,7 +158,8 @@
203 anchors {
204 right: parent.right
205 bottom: parent.bottom
206- margins: units.dp(3)
207+ rightMargin: (iconItem.width - root.itemWidth) / 2 - units.dp(2)
208+ margins: units.dp(5)
209 }
210 width: Math.min(root.itemWidth, Math.max(units.gu(2), countLabel.implicitWidth + units.gu(1)))
211 height: units.gu(2)
212@@ -186,16 +187,11 @@
213 id: progressOverlay
214 objectName: "progressOverlay"
215
216- anchors {
217- left: iconItem.left
218- right: iconItem.right
219- verticalCenter: parent.verticalCenter
220- leftMargin: units.gu(1.5)
221- rightMargin: units.gu(1.5)
222- }
223+ anchors.centerIn: parent
224+ width: root.itemWidth * .8
225 height: units.gu(1)
226 visible: root.progress > -1
227- color: UbuntuColors.darkGrey
228+ backgroundColor: UbuntuColors.darkGrey
229 borderSource: "none"
230
231 Item {
232@@ -213,7 +209,7 @@
233 top: parent.top
234 bottom: parent.bottom
235 }
236- color: "white"
237+ backgroundColor: "white"
238 borderSource: "none"
239 width: progressOverlay.width
240 }
241
242=== modified file 'qml/Launcher/LauncherPanel.qml'
243--- qml/Launcher/LauncherPanel.qml 2016-02-25 13:19:27 +0000
244+++ qml/Launcher/LauncherPanel.qml 2016-02-25 13:19:27 +0000
245@@ -53,14 +53,14 @@
246 if (highlightIndex >= launcherListView.count) {
247 highlightIndex = -1;
248 }
249- moveAnimation.moveToIndex(Math.max(highlightIndex, 0));
250+ launcherListView.moveToIndex(Math.max(highlightIndex, 0));
251 }
252 function highlightPrevious() {
253 highlightIndex--;
254 if (highlightIndex <= -2) {
255 highlightIndex = launcherListView.count - 1;
256 }
257- moveAnimation.moveToIndex(Math.max(highlightIndex, 0));
258+ launcherListView.moveToIndex(Math.max(highlightIndex, 0));
259 }
260 function openQuicklist(index) {
261 quickList.open(index);
262@@ -83,13 +83,13 @@
263 Rectangle {
264 objectName: "buttonShowDashHome"
265 width: parent.width
266- height: units.gu(7)
267+ height: width * .9
268 color: UbuntuColors.orange
269 readonly property bool highlighted: root.highlightIndex == -1;
270
271 Image {
272 objectName: "dashItem"
273- width: units.gu(5)
274+ width: parent.width * .6
275 height: width
276 anchors.centerIn: parent
277 source: "graphics/home.png"
278@@ -125,10 +125,8 @@
279 objectName: "launcherListView"
280 anchors {
281 fill: parent
282- topMargin: -extensionSize + units.gu(0.5)
283- bottomMargin: -extensionSize + units.gu(1)
284- leftMargin: units.gu(0.5)
285- rightMargin: units.gu(0.5)
286+ topMargin: -extensionSize + width * .15
287+ bottomMargin: -extensionSize + width * .15
288 }
289 topMargin: extensionSize
290 bottomMargin: extensionSize
291@@ -163,11 +161,11 @@
292 }
293
294 // The height of the area where icons start getting folded
295- property int foldingStartHeight: units.gu(6.5)
296+ property int foldingStartHeight: itemHeight
297 // The height of the area where the items reach the final folding angle
298 property int foldingStopHeight: foldingStartHeight - itemHeight - spacing
299- property int itemWidth: units.gu(7)
300- property int itemHeight: units.gu(6.5)
301+ property int itemWidth: width * .75
302+ property int itemHeight: itemWidth * 15 / 16 + units.gu(1)
303 property int clickFlickSpeed: units.gu(60)
304 property int draggedIndex: dndArea.draggedIndex
305 property real realContentY: contentY - originY + topMargin
306@@ -195,22 +193,24 @@
307
308 UbuntuNumberAnimation {
309 id: moveAnimation
310+ objectName: "moveAnimation"
311 target: launcherListView
312 property: "contentY"
313 function moveTo(contentY) {
314 from = launcherListView.contentY;
315 to = contentY;
316- start();
317+ restart();
318 }
319- function moveToIndex(index) {
320- var itemPosition = index * launcherListView.itemHeight;
321- var height = launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin
322- var distanceToEnd = index == 0 || index == launcherListView.count - 1 ? 0 : launcherListView.itemHeight
323- if (itemPosition + launcherListView.itemHeight + distanceToEnd > launcherListView.contentY + launcherListView.topMargin + height) {
324- moveAnimation.moveTo(itemPosition + launcherListView.itemHeight - launcherListView.topMargin - height + distanceToEnd);
325- } else if (itemPosition - distanceToEnd < launcherListView.contentY + launcherListView.topMargin) {
326- moveAnimation.moveTo(itemPosition - distanceToEnd - launcherListView.topMargin);
327- }
328+ }
329+ function moveToIndex(index) {
330+ var totalItemHeight = launcherListView.itemHeight + launcherListView.spacing
331+ var itemPosition = index * totalItemHeight;
332+ var height = launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin
333+ var distanceToEnd = index == 0 || index == launcherListView.count - 1 ? 0 : totalItemHeight
334+ if (itemPosition + totalItemHeight + distanceToEnd > launcherListView.contentY + launcherListView.originY + launcherListView.topMargin + height) {
335+ moveAnimation.moveTo(itemPosition + launcherListView.itemHeight - launcherListView.topMargin - height + distanceToEnd - launcherListView.originY);
336+ } else if (itemPosition - distanceToEnd < launcherListView.contentY - launcherListView.originY + launcherListView.topMargin) {
337+ moveAnimation.moveTo(itemPosition - distanceToEnd - launcherListView.topMargin + launcherListView.originY);
338 }
339 }
340
341@@ -228,7 +228,7 @@
342 itemIndex: index
343 itemHeight: launcherListView.itemHeight
344 itemWidth: launcherListView.itemWidth
345- width: itemWidth
346+ width: parent.width
347 height: itemHeight
348 iconName: model.icon
349 count: model.count
350@@ -277,7 +277,7 @@
351 onAlertingChanged: {
352 if(alerting) {
353 if (!dragging && (launcherListView.peekingIndex === -1 || launcher.visibleWidth > 0)) {
354- moveAnimation.moveToIndex(index)
355+ launcherListView.moveToIndex(index)
356 if (!dragging && launcher.state !== "visible") {
357 peekingAnimation.start()
358 }
359@@ -439,10 +439,8 @@
360
361 // First/last item do the scrolling at more than 12 degrees
362 if (index == 0 || index == launcherListView.count - 1) {
363- if (clickedItem.angle > 12) {
364- launcherListView.flick(0, -launcherListView.clickFlickSpeed);
365- } else if (clickedItem.angle < -12) {
366- launcherListView.flick(0, launcherListView.clickFlickSpeed);
367+ if (clickedItem.angle > 12 || clickedItem.angle < -12) {
368+ launcherListView.moveToIndex(index);
369 } else {
370 root.applicationSelected(LauncherModel.get(index).appId);
371 }
372@@ -450,10 +448,8 @@
373 }
374
375 // the rest launches apps up to an angle of 30 degrees
376- if (clickedItem.angle > 30) {
377- launcherListView.flick(0, -launcherListView.clickFlickSpeed);
378- } else if (clickedItem.angle < -30) {
379- launcherListView.flick(0, launcherListView.clickFlickSpeed);
380+ if (clickedItem.angle > 30 || clickedItem.angle < -30) {
381+ launcherListView.moveToIndex(index);
382 } else {
383 root.applicationSelected(LauncherModel.get(index).appId);
384 }
385@@ -668,7 +664,6 @@
386 onClicked: {
387 quickList.state = "";
388 quickList.focus = false;
389- root.highlightIndex = -2;
390 root.kbdNavigationCancelled();
391 }
392
393@@ -739,16 +734,21 @@
394 case Qt.Key_Left:
395 case Qt.Key_Escape:
396 quickList.selectedIndex = -1;
397- // Falling through intentionally
398+ quickList.focus = false;
399+ quickList.state = ""
400+ event.accepted = true;
401+ break;
402 case Qt.Key_Enter:
403 case Qt.Key_Return:
404 case Qt.Key_Space:
405 if (quickList.selectedIndex >= 0) {
406 LauncherModel.quickListActionInvoked(quickList.appId, quickList.selectedIndex)
407 }
408+ quickList.selectedIndex = -1;
409 quickList.focus = false;
410 quickList.state = ""
411- // Don't consume the event. We want to close the Launcher too, not just the quicklist.
412+ root.kbdNavigationCancelled();
413+ event.accepted = true;
414 break;
415 }
416 }
417
418=== modified file 'qml/Shell.qml'
419--- qml/Shell.qml 2016-02-25 13:19:27 +0000
420+++ qml/Shell.qml 2016-02-25 13:19:27 +0000
421@@ -25,6 +25,7 @@
422 import Unity.Connectivity 0.1
423 import Unity.Launcher 0.1
424 import GlobalShortcut 1.0 // has to be before Utils, because of WindowKeysFilter
425+import GSettings 1.0
426 import Utils 0.1
427 import Powerd 0.1
428 import SessionBroadcast 0.1
429@@ -187,6 +188,11 @@
430 }
431 }
432
433+ GSettings {
434+ id: settings
435+ schema.id: "com.canonical.Unity8"
436+ }
437+
438 Item {
439 id: stages
440 objectName: "stages"
441@@ -343,6 +349,11 @@
442 property: "altTabPressed"
443 value: physicalKeysMapper.altTabPressed
444 }
445+ Binding {
446+ target: applicationsDisplayLoader.item
447+ property: "leftMargin"
448+ value: shell.usageScenario == "desktop" && !settings.autohideLauncher ? launcher.panelWidth: 0
449+ }
450 }
451
452 Tutorial {
453@@ -373,7 +384,11 @@
454 InputMethod {
455 id: inputMethod
456 objectName: "inputMethod"
457- anchors { fill: parent; topMargin: panel.panelHeight }
458+ anchors {
459+ fill: parent
460+ topMargin: panel.panelHeight
461+ leftMargin: launcher.lockedVisible ? launcher.panelWidth : 0
462+ }
463 z: notifications.useModal || panel.indicators.shown || wizard.active ? overlay.z + 1 : overlay.z - 1
464 }
465
466@@ -559,6 +574,8 @@
467 shadeBackground: !tutorial.running
468 superPressed: physicalKeysMapper.superPressed
469 superTabPressed: physicalKeysMapper.superTabPressed
470+ panelWidth: units.gu(settings.launcherWidth)
471+ lockedVisible: shell.usageScenario == "desktop" && !settings.autohideLauncher && !panel.fullscreenMode
472
473 onShowDashHome: showHome()
474 onDash: showDash()
475
476=== modified file 'qml/Stages/AbstractStage.qml'
477--- qml/Stages/AbstractStage.qml 2016-01-14 13:03:20 +0000
478+++ qml/Stages/AbstractStage.qml 2016-02-25 13:19:27 +0000
479@@ -39,6 +39,8 @@
480 property int shellOrientationAngle
481 property bool spreadEnabled: true // If false, animations and right edge will be disabled
482 property bool suspended
483+ // A Stage should paint a wallpaper etc over its full size but not use the margins for window placement
484+ property int leftMargin: 0
485
486 // To be read from outside
487 property var mainApp: null
488
489=== modified file 'qml/Stages/DesktopStage.qml'
490--- qml/Stages/DesktopStage.qml 2016-02-03 14:00:47 +0000
491+++ qml/Stages/DesktopStage.qml 2016-02-25 13:19:27 +0000
492@@ -224,6 +224,7 @@
493 PanelState.dropShadow = false;
494 }
495
496+
497 FocusScope {
498 id: appContainer
499 objectName: "appContainer"
500@@ -293,6 +294,7 @@
501 visible: !visuallyMinimized &&
502 !greeter.fullyShown &&
503 (priv.foregroundMaximizedAppZ === -1 || priv.foregroundMaximizedAppZ <= z) ||
504+ decoratedWindow.fullscreen ||
505 (spread.state == "altTab" && index === spread.highlightedIndex)
506
507 Binding {
508@@ -351,10 +353,10 @@
509 states: [
510 State {
511 name: "fullscreen"; when: decoratedWindow.fullscreen
512- extend: "maximized"
513 PropertyChanges {
514 target: appDelegate;
515- y: -PanelState.panelHeight
516+ x: 0; y: -PanelState.panelHeight
517+ requestedWidth: appContainer.width; requestedHeight: appContainer.height;
518 }
519 },
520 State {
521@@ -371,21 +373,21 @@
522 name: "maximized"; when: appDelegate.maximized && !appDelegate.minimized
523 PropertyChanges {
524 target: appDelegate;
525- x: 0; y: 0;
526- requestedWidth: root.width; requestedHeight: root.height;
527+ x: root.leftMargin; y: 0;
528+ requestedWidth: appContainer.width - root.leftMargin; requestedHeight: appContainer.height;
529 visuallyMinimized: false;
530 visuallyMaximized: true
531 }
532 },
533 State {
534 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
535- PropertyChanges { target: appDelegate; x: 0; y: PanelState.panelHeight;
536- requestedWidth: root.width/2; requestedHeight: root.height - PanelState.panelHeight }
537+ PropertyChanges { target: appDelegate; x: root.leftMargin; y: PanelState.panelHeight;
538+ requestedWidth: (appContainer.width - root.leftMargin)/2; requestedHeight: appContainer.height - PanelState.panelHeight }
539 },
540 State {
541 name: "maximizedRight"; when: appDelegate.maximizedRight && !appDelegate.minimized
542- PropertyChanges { target: appDelegate; x: root.width/2; y: PanelState.panelHeight;
543- requestedWidth: root.width/2; requestedHeight: root.height - PanelState.panelHeight }
544+ PropertyChanges { target: appDelegate; x: (appContainer.width + root.leftMargin)/2; y: PanelState.panelHeight;
545+ requestedWidth: (appContainer.width - root.leftMargin)/2; requestedHeight: appContainer.height - PanelState.panelHeight }
546 },
547 State {
548 name: "minimized"; when: appDelegate.minimized
549@@ -448,8 +450,9 @@
550 minHeight: units.gu(10)
551 borderThickness: units.gu(2)
552 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
553- screenWidth: root.width
554- screenHeight: root.height
555+ screenWidth: appContainer.width
556+ screenHeight: appContainer.height
557+ leftMargin: root.leftMargin
558
559 onPressed: { ApplicationManager.focusApplication(model.appId) }
560 }
561@@ -475,7 +478,7 @@
562
563 BlurLayer {
564 id: blurLayer
565- anchors.fill: parent
566+ anchors.fill: appContainer
567 source: appContainer
568 visible: false
569 }
570@@ -527,7 +530,7 @@
571 DesktopSpread {
572 id: spread
573 objectName: "spread"
574- anchors.fill: parent
575+ anchors.fill: appContainer
576 workspace: appContainer
577 focus: state == "altTab"
578 altTabPressed: root.altTabPressed
579
580=== modified file 'qml/Stages/WindowResizeArea.qml'
581--- qml/Stages/WindowResizeArea.qml 2016-02-03 14:00:47 +0000
582+++ qml/Stages/WindowResizeArea.qml 2016-02-25 13:19:27 +0000
583@@ -40,6 +40,7 @@
584 property int defaultHeight: units.gu(50)
585 property int screenWidth: 0
586 property int screenHeight: 0
587+ property int leftMargin: 0
588
589 QtObject {
590 id: priv
591@@ -72,10 +73,10 @@
592 var windowGeometry = windowStateStorage.getGeometry(root.windowId,
593 Qt.rect(target.x, target.y, defaultWidth, defaultHeight));
594
595- target.requestedWidth = Math.min(Math.max(windowGeometry.width, d.minimumWidth), screenWidth);
596- target.requestedHeight = Math.min(Math.max(windowGeometry.height, d.minimumHeight), root.screenHeight - PanelState.panelHeight);
597- target.x = Math.max(Math.min(windowGeometry.x, root.screenWidth - target.requestedWidth), 0)
598- target.y = Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight)
599+ target.requestedWidth = Qt.binding(function() { return Math.min(Math.max(windowGeometry.width, d.minimumWidth), screenWidth - root.leftMargin); });
600+ target.requestedHeight = Qt.binding(function() { return Math.min(Math.max(windowGeometry.height, d.minimumHeight), root.screenHeight - PanelState.panelHeight); });
601+ target.x = Qt.binding(function() { return Math.max(Math.min(windowGeometry.x, root.screenWidth - root.leftMargin - target.requestedWidth), root.leftMargin); });
602+ target.y = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight); });
603
604 var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal)
605 if (windowState === WindowStateStorage.WindowStateMaximized) {
606
607=== modified file 'tests/mocks/GSettings.1.0/fake_gsettings.cpp'
608--- tests/mocks/GSettings.1.0/fake_gsettings.cpp 2015-09-29 20:19:56 +0000
609+++ tests/mocks/GSettings.1.0/fake_gsettings.cpp 2016-02-25 13:19:27 +0000
610@@ -22,6 +22,8 @@
611
612 GSettingsControllerQml::GSettingsControllerQml()
613 : m_usageMode("Staged")
614+ , m_autohideLauncher(false)
615+ , m_launcherWidth(8)
616 {
617 }
618
619@@ -88,6 +90,32 @@
620 }
621 }
622
623+bool GSettingsControllerQml::autohideLauncher() const
624+{
625+ return m_autohideLauncher;
626+}
627+
628+void GSettingsControllerQml::setAutohideLauncher(bool autohideLauncher)
629+{
630+ if (m_autohideLauncher != autohideLauncher) {
631+ m_autohideLauncher = autohideLauncher;
632+ Q_EMIT autohideLauncherChanged(autohideLauncher);
633+ }
634+}
635+
636+int GSettingsControllerQml::launcherWidth() const
637+{
638+ return m_launcherWidth;
639+}
640+
641+void GSettingsControllerQml::setLauncherWidth(int launcherWidth)
642+{
643+ if (m_launcherWidth != launcherWidth) {
644+ m_launcherWidth = launcherWidth;
645+ Q_EMIT launcherWidthChanged(launcherWidth);
646+ }
647+}
648+
649 GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
650 }
651
652@@ -129,6 +157,10 @@
653 this, &GSettingsQml::lockedOutTimeChanged);
654 connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::lifecycleExemptAppidsChanged,
655 this, &GSettingsQml::lifecycleExemptAppidsChanged);
656+ connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::autohideLauncherChanged,
657+ this, &GSettingsQml::autohideLauncherChanged);
658+ connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::launcherWidthChanged,
659+ this, &GSettingsQml::launcherWidthChanged);
660 }
661
662 GSettingsSchemaQml * GSettingsQml::schema() const {
663@@ -192,9 +224,41 @@
664 }
665 }
666
667+bool GSettingsQml::autohideLauncher() const
668+{
669+ if (m_schema->id() == "com.canonical.Unity8") {
670+ return GSettingsControllerQml::instance()->autohideLauncher();
671+ } else {
672+ return false;
673+ }
674+}
675+
676+int GSettingsQml::launcherWidth() const
677+{
678+ if (m_schema->id() == "com.canonical.Unity8") {
679+ return GSettingsControllerQml::instance()->launcherWidth();
680+ } else {
681+ return false;
682+ }
683+}
684+
685 void GSettingsQml::setLifecycleExemptAppids(const QStringList &appIds)
686 {
687 if (m_schema->id() == "com.canonical.qtmir") {
688 GSettingsControllerQml::instance()->setLifecycleExemptAppids(appIds);
689 }
690 }
691+
692+void GSettingsQml::setAutohideLauncher(bool autohideLauncher)
693+{
694+ if (m_schema->id() == "com.canonical.Unity8") {
695+ GSettingsControllerQml::instance()->setAutohideLauncher(autohideLauncher);
696+ }
697+}
698+
699+void GSettingsQml::setLauncherWidth(int launcherWidth)
700+{
701+ if (m_schema->id() == "com.canonical.Unity8") {
702+ GSettingsControllerQml::instance()->setLauncherWidth(launcherWidth);
703+ }
704+}
705
706=== modified file 'tests/mocks/GSettings.1.0/fake_gsettings.h'
707--- tests/mocks/GSettings.1.0/fake_gsettings.h 2015-09-29 20:19:56 +0000
708+++ tests/mocks/GSettings.1.0/fake_gsettings.h 2016-02-25 13:19:27 +0000
709@@ -50,6 +50,8 @@
710 Q_PROPERTY(QString usageMode READ usageMode WRITE setUsageMode NOTIFY usageModeChanged)
711 Q_PROPERTY(qint64 lockedOutTime READ lockedOutTime WRITE setLockedOutTime NOTIFY lockedOutTimeChanged)
712 Q_PROPERTY(QStringList lifecycleExemptAppids READ lifecycleExemptAppids WRITE setLifecycleExemptAppids NOTIFY lifecycleExemptAppidsChanged)
713+ Q_PROPERTY(bool autohideLauncher READ autohideLauncher WRITE setAutohideLauncher NOTIFY autohideLauncherChanged)
714+ Q_PROPERTY(int launcherWidth READ launcherWidth WRITE setLauncherWidth NOTIFY launcherWidthChanged)
715
716 public:
717 GSettingsQml(QObject *parent = nullptr);
718@@ -59,11 +61,15 @@
719 QString usageMode() const;
720 qint64 lockedOutTime() const;
721 QStringList lifecycleExemptAppids() const;
722+ bool autohideLauncher() const;
723+ int launcherWidth() const;
724
725 void setPictureUri(const QString &str);
726 void setUsageMode(const QString &usageMode);
727 void setLockedOutTime(qint64 timestamp);
728 void setLifecycleExemptAppids(const QStringList &appIds);
729+ void setAutohideLauncher(bool autohideLauncher);
730+ void setLauncherWidth(int launcherWidth);
731
732 Q_SIGNALS:
733 void schemaChanged();
734@@ -71,6 +77,8 @@
735 void usageModeChanged(const QString&);
736 void lockedOutTimeChanged(qint64);
737 void lifecycleExemptAppidsChanged(const QStringList &);
738+ void autohideLauncherChanged(bool);
739+ void launcherWidthChanged(int launcherWidth);
740
741 private:
742 GSettingsSchemaQml* m_schema;
743@@ -98,11 +106,19 @@
744 QStringList lifecycleExemptAppids() const;
745 Q_INVOKABLE void setLifecycleExemptAppids(const QStringList &appIds);
746
747+ bool autohideLauncher() const;
748+ Q_INVOKABLE void setAutohideLauncher(bool autohideLauncher);
749+
750+ int launcherWidth() const;
751+ Q_INVOKABLE void setLauncherWidth(int launcherWidth);
752+
753 Q_SIGNALS:
754 void pictureUriChanged(const QString&);
755 void usageModeChanged(const QString&);
756 void lockedOutTimeChanged(qint64 timestamp);
757 void lifecycleExemptAppidsChanged(const QStringList&);
758+ void autohideLauncherChanged(bool autohideLauncher);
759+ void launcherWidthChanged(int launcherWidth);
760
761 private:
762 GSettingsControllerQml();
763@@ -111,6 +127,8 @@
764 QString m_usageMode;
765 qint64 m_lockedOutTime;
766 QStringList m_lifecycleExemptAppids;
767+ bool m_autohideLauncher;
768+ int m_launcherWidth;
769
770 static GSettingsControllerQml* s_controllerInstance;
771 QList<GSettingsQml *> m_registeredGSettings;
772
773=== modified file 'tests/qmltests/Launcher/tst_Launcher.qml'
774--- tests/qmltests/Launcher/tst_Launcher.qml 2016-02-25 13:19:27 +0000
775+++ tests/qmltests/Launcher/tst_Launcher.qml 2016-02-25 13:19:27 +0000
776@@ -28,8 +28,8 @@
777 launcher. */
778 Item {
779 id: root
780- width: units.gu(50)
781- height: units.gu(55)
782+ width: units.gu(140)
783+ height: units.gu(70)
784
785 Loader {
786 id: launcherLoader
787@@ -79,11 +79,40 @@
788 }
789 }
790
791+ Binding {
792+ target: launcherLoader.item
793+ property: "lockedVisible"
794+ value: lockedVisibleCheckBox.checked
795+ }
796+ Binding {
797+ target: launcherLoader.item
798+ property: "panelWidth"
799+ value: units.gu(Math.round(widthSlider.value))
800+ }
801+
802 ColumnLayout {
803 anchors { bottom: parent.bottom; right: parent.right; margins: units.gu(1) }
804 spacing: units.gu(1)
805 width: childrenRect.width
806
807+ RowLayout {
808+ CheckBox {
809+ id: lockedVisibleCheckBox
810+ checked: false
811+ }
812+ Label {
813+ text: "Launcher always visible"
814+ }
815+ }
816+
817+ Slider {
818+ id: widthSlider
819+ Layout.fillWidth: true
820+ minimumValue: 6
821+ maximumValue: 12
822+ value: 10
823+ }
824+
825 MouseTouchEmulationCheckbox {}
826
827 EdgeBarrierControls {
828@@ -217,10 +246,6 @@
829 // growing while populating it with icons etc.
830 tryCompare(listView, "flicking", false);
831
832- // Make sure noone changed the height of the window. The issue this test case
833- // is verifying only happens on certain heights of the Launcher
834- compare(root.height, units.gu(55));
835-
836 compare(listView.contentY, -listView.topMargin, "Launcher did not start up with first item unfolded");
837
838 // Now do check that snapping is in fact enabled
839@@ -277,14 +302,21 @@
840
841 function positionLauncherListAtBeginning() {
842 var listView = testCase.findChild(launcherLoader.item, "launcherListView");
843- listView.contentY = -listView.topMargin;
844+ var moveAnimation = findInvisibleChild(listView, "moveAnimation")
845+
846+ listView.moveToIndex(0);
847+
848+ waitForRendering(listView);
849+ tryCompare(moveAnimation, "running", false);
850 }
851 function positionLauncherListAtEnd() {
852 var listView = testCase.findChild(launcherLoader.item, "launcherListView");
853- if ((listView.contentHeight + listView.topMargin + listView.bottomMargin) > listView.height) {
854- listView.contentY = listView.topMargin + listView.contentHeight
855- - listView.height;
856- }
857+ var moveAnimation = findInvisibleChild(listView, "moveAnimation")
858+
859+ listView.moveToIndex(listView.count -1);
860+
861+ waitForRendering(listView);
862+ tryCompare(moveAnimation, "running", false);
863 }
864
865 function assertFocusOnIndex(index) {
866@@ -292,10 +324,10 @@
867 var bfbFocusHighlight = findChild(launcher, "bfbFocusHighlight");
868
869 waitForRendering(launcher);
870- tryCompare(bfbFocusHighlight, "visible", index === -1);
871+ compare(bfbFocusHighlight.visible, index === -1);
872 for (var i = 0; i < launcherListView.count; i++) {
873 var focusRing = findChild(findChild(launcher, "launcherDelegate" + i), "focusRing")
874- tryCompare(focusRing, "visible", index === i);
875+ compare(focusRing.visible, index === i);
876 }
877 }
878
879@@ -400,6 +432,7 @@
880 wait(100)
881 compare(launcher.maxPanelX, -launcher.panelWidth, "Launcher moved even if it shouldn't")
882 }
883+
884 waitUntilLauncherDisappears();
885 launcher.available = true;
886 }
887@@ -423,6 +456,8 @@
888 dragLauncherIntoView();
889 var launcherListView = findChild(launcher, "launcherListView");
890 for (var i = 0; i < launcherListView.count; ++i) {
891+ launcherListView.moveToIndex(i);
892+ waitForRendering(launcherListView);
893 var delegate = findChild(launcherListView, "launcherDelegate" + i)
894 compare(findChild(delegate, "countEmblem").visible, LauncherModel.get(i).countVisible)
895 // Intentionally allow type coercion (string/number)
896@@ -483,6 +518,7 @@
897 launcher.lastSelectedApplication = "";
898 dragLauncherIntoView();
899 var listView = findChild(launcher, "launcherListView");
900+ var moveAnimation = findInvisibleChild(listView, "moveAnimation")
901
902 // flicking is unreliable. sometimes it works, sometimes the
903 // list view moves just a tiny bit or not at all, making tests fail.
904@@ -493,12 +529,14 @@
905 } else {
906 positionLauncherListAtEnd();
907 }
908- tryCompare(listView, "flicking", false);
909-
910 var oldY = listView.contentY;
911
912 mouseClick(listView, listView.width / 2, data.clickY);
913- tryCompare(listView, "flicking", false);
914+
915+ if (data.expectFlick) {
916+ tryCompare(moveAnimation, "running", true);
917+ }
918+ tryCompare(moveAnimation, "running", false);
919
920 if (data.expectFlick) {
921 verify(listView.contentY != oldY);
922@@ -1086,12 +1124,15 @@
923 function test_keyboardNavigation() {
924 var bfbFocusHighlight = findChild(launcher, "bfbFocusHighlight");
925 var quickList = findChild(launcher, "quickList");
926+ var launcherPanel = findChild(launcher, "launcherPanel");
927 var launcherListView = findChild(launcher, "launcherListView");
928 var last = launcherListView.count - 1;
929
930 compare(bfbFocusHighlight.visible, false);
931
932 launcher.openForKeyboardNavigation();
933+ tryCompare(launcherPanel, "x", 0);
934+ waitForRendering(launcher);
935
936 assertFocusOnIndex(-1);
937
938@@ -1164,11 +1205,47 @@
939 compare(signalSpy.count, 1, "Quicklist signal wasn't triggered")
940 compare(signalSpy.signalArguments[0][0], LauncherModel.get(1).appId)
941 compare(signalSpy.signalArguments[0][1], 2)
942- }
943-
944- function test_cancelKbdNavigationWitMouse() {
945+ assertFocusOnIndex(-2);
946+ }
947+
948+ function test_hideNotWorkingWhenLockedOut_data() {
949+ return [
950+ {tag: "locked visible", locked: true},
951+ {tag: "no locked visible", locked: false},
952+ ]
953+ }
954+
955+ function test_hideNotWorkingWhenLockedOut(data) {
956+ launcher.lockedVisible = data.locked;
957+ if (data.locked) {
958+ tryCompare(launcher, "state", "visible");
959+ } else {
960+ tryCompare(launcher, "state", "");
961+ }
962+
963+ launcher.hide();
964+ waitForRendering(launcher);
965+ if (data.locked) {
966+ verify(launcher.state == "visible");
967+ } else {
968+ verify(launcher.state == "");
969+ }
970+ }
971+
972+ function test_cancelKbdNavigationWitMouse_data() {
973+ return [
974+ {tag: "locked out - no quicklist", autohide: false, withQuickList: false },
975+ {tag: "locked out - with quicklist", autohide: false, withQuickList: true },
976+ {tag: "autohide - no quicklist", autohide: true, withQuickList: false },
977+ {tag: "autohide - with quicklist", autohide: true, withQuickList: true },
978+ ]
979+ }
980+
981+ function test_cancelKbdNavigationWitMouse(data) {
982+ launcher.autohideEnabled = data.autohide;
983 launcher.openForKeyboardNavigation();
984 waitForRendering(launcher);
985+
986 var launcherPanel = findChild(launcher, "launcherPanel");
987 tryCompare(launcherPanel, "x", 0);
988
989@@ -1176,15 +1253,22 @@
990
991 keyClick(Qt.Key_Down); // Down to launcher item 0
992 keyClick(Qt.Key_Down); // Down to launcher item 1
993- keyClick(Qt.Key_Right); // Into quicklist
994
995+ if (data.withQuickList) {
996+ keyClick(Qt.Key_Right); // Into quicklist
997+ tryCompare(quickList, "visible", true)
998+ }
999 waitForRendering(launcher)
1000- tryCompare(quickList, "visible", true)
1001-
1002- mouseClick(root, root.width / 2, units.gu(2));
1003-
1004- tryCompare(launcher, "state", "");
1005- tryCompare(launcherPanel, "highlightIndex", -2);
1006+
1007+ mouseClick(root);
1008+
1009+ if (data.autohide) {
1010+ tryCompare(launcher, "state", "");
1011+ } else {
1012+ tryCompare(launcher, "state", "visible");
1013+ }
1014+
1015+ assertFocusOnIndex(-2);
1016 }
1017 }
1018 }
1019
1020=== modified file 'tests/qmltests/tst_Shell.qml'
1021--- tests/qmltests/tst_Shell.qml 2016-02-25 13:19:27 +0000
1022+++ tests/qmltests/tst_Shell.qml 2016-02-25 13:19:27 +0000
1023@@ -223,6 +223,19 @@
1024 }
1025 }
1026
1027+ Row {
1028+ anchors { left: parent.left; right: parent.right }
1029+ CheckBox {
1030+ id: autohideLauncherCheckbox
1031+ onCheckedChanged: {
1032+ GSettingsController.setAutohideLauncher(checked)
1033+ }
1034+ }
1035+ Label {
1036+ text: "Autohide launcher"
1037+ }
1038+ }
1039+
1040 Label { text: "Applications"; font.bold: true }
1041
1042 Button {
1043@@ -921,6 +934,7 @@
1044 function dragLauncherIntoView() {
1045 var launcher = findChild(shell, "launcher");
1046 var launcherPanel = findChild(launcher, "launcherPanel");
1047+ waitForRendering(launcher);
1048 verify(launcherPanel.x = - launcherPanel.width);
1049
1050 var touchStartX = 2;
1051@@ -1678,7 +1692,7 @@
1052 var x = 0;
1053 var y = shell.height * .5
1054 mouseMove(shell, x, y)
1055- while (x <= spreadFlickable.width) {
1056+ while (x <= shell.width) {
1057 x+=10;
1058 mouseMove(shell, x, y)
1059 wait(0); // spin the loop so bindings get evaluated
1060@@ -1752,25 +1766,38 @@
1061 keyRelease(Qt.Key_Alt);
1062 }
1063
1064- function test_focusAppFromLauncherExitsSpread() {
1065+ function test_focusAppFromLauncherExitsSpread_data() {
1066+ return [
1067+ {tag: "autohide launcher", launcherLocked: false },
1068+ {tag: "locked launcher", launcherLocked: true }
1069+ ]
1070+ }
1071+
1072+ function test_focusAppFromLauncherExitsSpread(data) {
1073 loadDesktopShellWithApps()
1074-
1075+ var launcher = findChild(shell, "launcher");
1076 var desktopSpread = findChild(shell, "spread");
1077- var launcher = findChild(shell, "launcher");
1078 var bfb = findChild(launcher, "buttonShowDashHome");
1079
1080+ GSettingsController.setAutohideLauncher(!data.launcherLocked);
1081+ waitForRendering(shell);
1082+
1083 keyPress(Qt.Key_Alt)
1084 keyClick(Qt.Key_Tab);
1085
1086 tryCompare(desktopSpread, "state", "altTab")
1087
1088- revealLauncherByEdgePushWithMouse();
1089- tryCompare(launcher, "x", 0);
1090- mouseMove(bfb, bfb.width / 2, bfb.height / 2)
1091- waitForRendering(shell)
1092+ if (!data.launcherLocked) {
1093+ revealLauncherByEdgePushWithMouse();
1094+ tryCompare(launcher, "x", 0);
1095+ mouseMove(bfb, bfb.width / 2, bfb.height / 2)
1096+ waitForRendering(shell)
1097+ }
1098
1099 mouseClick(bfb, bfb.width / 2, bfb.height / 2)
1100- tryCompare(launcher, "state", "")
1101+ if (!data.launcherLocked) {
1102+ tryCompare(launcher, "state", "")
1103+ }
1104 tryCompare(desktopSpread, "state", "")
1105
1106 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash")
1107@@ -1997,7 +2024,138 @@
1108 compare(ApplicationManager.findApplication("libreoffice") === null, true);
1109 }
1110 }
1111-<<<<<<< TREE
1112+
1113+ function test_superTabToCycleLauncher_data() {
1114+ return [
1115+ {tag: "autohide launcher", launcherLocked: false},
1116+ {tag: "locked launcher", launcherLocked: true}
1117+ ]
1118+ }
1119+
1120+ function test_superTabToCycleLauncher(data) {
1121+ loadShell("desktop");
1122+ shell.usageScenario = "desktop";
1123+ GSettingsController.setAutohideLauncher(!data.launcherLocked);
1124+ waitForRendering(shell);
1125+
1126+ var launcher = findChild(shell, "launcher");
1127+ var launcherPanel = findChild(launcher, "launcherPanel");
1128+ var firstAppInLauncher = LauncherModel.get(0).appId;
1129+
1130+ compare(launcher.state, data.launcherLocked ? "visible": "");
1131+ compare(launcherPanel.highlightIndex, -2);
1132+ compare(ApplicationManager.focusedApplicationId, "unity8-dash");
1133+
1134+ // Use Super + Tab Tab to cycle to the first entry in the launcher
1135+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
1136+ keyClick(Qt.Key_Tab);
1137+ tryCompare(launcher, "state", "visible");
1138+ tryCompare(launcherPanel, "highlightIndex", -1);
1139+ keyClick(Qt.Key_Tab);
1140+ tryCompare(launcherPanel, "highlightIndex", 0);
1141+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
1142+ tryCompare(launcher, "state", data.launcherLocked ? "visible" : "");
1143+ tryCompare(launcherPanel, "highlightIndex", -2);
1144+ tryCompare(ApplicationManager, "focusedApplicationId", firstAppInLauncher);
1145+
1146+ // Now go back to the dash
1147+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
1148+ keyClick(Qt.Key_Tab);
1149+ tryCompare(launcher, "state", "visible");
1150+ tryCompare(launcherPanel, "highlightIndex", -1);
1151+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
1152+ tryCompare(launcher, "state", data.launcherLocked ? "visible" : "");
1153+ tryCompare(launcherPanel, "highlightIndex", -2);
1154+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
1155+ }
1156+
1157+ function test_longpressSuperOpensLauncher() {
1158+ loadShell("desktop");
1159+ var launcher = findChild(shell, "launcher");
1160+ var shortcutHint = findChild(findChild(launcher, "launcherDelegate0"), "shortcutHint")
1161+
1162+ compare(launcher.state, "");
1163+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
1164+ tryCompare(launcher, "state", "visible");
1165+ tryCompare(shortcutHint, "visible", true);
1166+
1167+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
1168+ tryCompare(launcher, "state", "");
1169+ tryCompare(shortcutHint, "visible", false);
1170+ }
1171+
1172+ function test_metaNumberLaunchesFromLauncher_data() {
1173+ return [
1174+ {tag: "Meta+1", key: Qt.Key_1, index: 0},
1175+ {tag: "Meta+2", key: Qt.Key_2, index: 1},
1176+ {tag: "Meta+4", key: Qt.Key_5, index: 4},
1177+ {tag: "Meta+0", key: Qt.Key_0, index: 9},
1178+ ]
1179+ }
1180+
1181+ function test_metaNumberLaunchesFromLauncher(data) {
1182+ loadShell("desktop");
1183+ var launcher = findChild(shell, "launcher");
1184+ var appId = LauncherModel.get(data.index).appId;
1185+ waitForRendering(shell);
1186+
1187+ keyClick(data.key, Qt.MetaModifier);
1188+ tryCompare(ApplicationManager, "focusedApplicationId", appId);
1189+ }
1190+
1191+ function test_altF1OpensLauncherForKeyboardNavigation() {
1192+ loadShell("desktop");
1193+ waitForRendering(shell);
1194+ var launcher = findChild(shell, "launcher");
1195+
1196+ keyClick(Qt.Key_F1, Qt.AltModifier);
1197+ tryCompare(launcher, "state", "visible");
1198+ tryCompare(launcher, "focus", true)
1199+ }
1200+
1201+ function test_lockedOutLauncherAddsMarginsToMaximized() {
1202+ loadShell("desktop");
1203+ shell.usageScenario = "desktop";
1204+ waitForRendering(shell);
1205+ var appContainer = findChild(shell, "appContainer");
1206+ var launcher = findChild(shell, "launcher");
1207+
1208+ var app = ApplicationManager.startApplication("music-app");
1209+ waitUntilAppWindowIsFullyLoaded(app);
1210+ var appDelegate = findChild(appContainer, "appDelegate_music-app");
1211+ appDelegate.maximize();
1212+ tryCompare(appDelegate, "visuallyMaximized", true);
1213+ waitForRendering(shell);
1214+
1215+ GSettingsController.setAutohideLauncher(true);
1216+ waitForRendering(shell)
1217+ var hiddenSize = appDelegate.width;
1218+
1219+ GSettingsController.setAutohideLauncher(false);
1220+ waitForRendering(shell)
1221+ var shownSize = appDelegate.width;
1222+
1223+ compare(shownSize + launcher.panelWidth, hiddenSize);
1224+ }
1225+
1226+ function test_fullscreenAppHidesLockedOutLauncher() {
1227+ loadShell("desktop");
1228+ shell.usageScenario = "desktop";
1229+
1230+ var launcher = findChild(shell, "launcher");
1231+ var launcherPanel = findChild(launcher, "launcherPanel");
1232+
1233+ GSettingsController.setAutohideLauncher(false);
1234+ waitForRendering(shell)
1235+
1236+ tryCompare(launcher, "lockedVisible", true);
1237+
1238+ var cameraApp = ApplicationManager.startApplication("camera-app");
1239+ waitUntilAppWindowIsFullyLoaded(cameraApp);
1240+
1241+ tryCompare(launcher, "lockedVisible", false);
1242+ }
1243+
1244
1245 function test_inputEventsOnEdgesEndUpInAppSurface_data() {
1246 return [
1247@@ -2040,88 +2198,5 @@
1248 compare(topmostSurfaceItem.touchPressCount, 2);
1249 compare(topmostSurfaceItem.touchReleaseCount, 2);
1250 }
1251-=======
1252-
1253- function test_superTabToCycleLauncher() {
1254- loadShell("desktop");
1255- shell.usageScenario = "desktop";
1256- waitForRendering(shell);
1257-
1258- var launcher = findChild(shell, "launcher");
1259- var launcherPanel = findChild(launcher, "launcherPanel");
1260- var firstAppInLauncher = LauncherModel.get(0).appId;
1261-
1262- compare(launcher.state, "");
1263- compare(launcherPanel.highlightIndex, -2);
1264- compare(ApplicationManager.focusedApplicationId, "unity8-dash");
1265-
1266- wait(2000)
1267- // Use Super + Tab Tab to cycle to the first entry in the launcher
1268- keyPress(Qt.Key_Super_L, Qt.MetaModifier);
1269- keyClick(Qt.Key_Tab);
1270- tryCompare(launcher, "state", "visible");
1271- tryCompare(launcherPanel, "highlightIndex", -1);
1272- keyClick(Qt.Key_Tab);
1273- tryCompare(launcherPanel, "highlightIndex", 0);
1274- keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
1275- tryCompare(launcher, "state", "");
1276- tryCompare(launcherPanel, "highlightIndex", -2);
1277- tryCompare(ApplicationManager, "focusedApplicationId", firstAppInLauncher);
1278-
1279- // Now go back to the dash
1280- keyPress(Qt.Key_Super_L, Qt.MetaModifier);
1281- keyClick(Qt.Key_Tab);
1282- tryCompare(launcher, "state", "visible");
1283- tryCompare(launcherPanel, "highlightIndex", -1);
1284- keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
1285- tryCompare(launcher, "state", "");
1286- tryCompare(launcherPanel, "highlightIndex", -2);
1287- tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
1288- }
1289-
1290- function test_longpressSuperOpensLauncher() {
1291- loadShell("desktop");
1292- var launcher = findChild(shell, "launcher");
1293- var shortcutHint = findChild(findChild(launcher, "launcherDelegate0"), "shortcutHint")
1294-
1295- compare(launcher.state, "");
1296- keyPress(Qt.Key_Super_L, Qt.MetaModifier);
1297- tryCompare(launcher, "state", "visible");
1298- tryCompare(shortcutHint, "visible", true);
1299-
1300- keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
1301- tryCompare(launcher, "state", "");
1302- tryCompare(shortcutHint, "visible", false);
1303- }
1304-
1305- function test_metaNumberLaunchesFromLauncher_data() {
1306- return [
1307- {tag: "Meta+1", key: Qt.Key_1, index: 0},
1308- {tag: "Meta+2", key: Qt.Key_2, index: 1},
1309- {tag: "Meta+4", key: Qt.Key_5, index: 4},
1310- {tag: "Meta+0", key: Qt.Key_0, index: 9},
1311- ]
1312- }
1313-
1314- function test_metaNumberLaunchesFromLauncher(data) {
1315- loadShell("desktop");
1316- var launcher = findChild(shell, "launcher");
1317- var appId = LauncherModel.get(data.index).appId;
1318- waitForRendering(shell);
1319-
1320- keyClick(data.key, Qt.MetaModifier);
1321- tryCompare(ApplicationManager, "focusedApplicationId", appId);
1322- }
1323-
1324- function test_altF1OpensLauncherForKeyboardNavigation() {
1325- loadShell("desktop");
1326- waitForRendering(shell);
1327- var launcher = findChild(shell, "launcher");
1328-
1329- keyClick(Qt.Key_F1, Qt.AltModifier);
1330- tryCompare(launcher, "state", "visible");
1331- tryCompare(launcher, "focus", true)
1332- }
1333->>>>>>> MERGE-SOURCE
1334 }
1335 }

Subscribers

People subscribed via source and target branches