on xenial help sign in
merge parent
commit44c971032fcf82ec1b31b81b515d8fe56bc7fbed authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 14 Sep 2016, 15:15 (10 years ago) parent93bf0364da610e
2 files changed+40−51
qml/Stage/Stage.qml+12−10 tests/qmltests/Stage/tst_DesktopStage.qml+28−41
qml/Stage/Stage.qml+12−10
@@ -103,8 +103,8 @@ AbstractStage {
103103 GlobalShortcut {
104104 id: minimizeAllShortcut
105105 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_D
106− onTriggered: priv.minimizeAllWindows()
107− active: root.state == "windowed"
106+ onTriggered: {print("tigggggered"); priv.minimizeAllWindows()}
107+// active: root.state == "windowed"
108108 }
109109
110110 GlobalShortcut {
@@ -177,7 +177,9 @@ AbstractStage {
177177 function minimizeAllWindows() {
178178 for (var i = 0; i < appRepeater.count; i++) {
179179 var appDelegate = appRepeater.itemAt(i);
180+ print("have delegate", appDelegate.appId)
180181 if (appDelegate && !appDelegate.minimized) {
182+ print("minimizing it", appDelegate.appId)
181183 appDelegate.minimize();
182184 }
183185 }
@@ -695,6 +697,7 @@ AbstractStage {
695697 Connections {
696698 target: model.surface
697699 onFocusRequested: {
700+ print("*********************************** focus requested", appId)
698701 // Reset spread selection in case there is any
699702 spreadItem.highlightedIndex = -1
700703 claimFocus();
@@ -776,13 +779,12 @@ AbstractStage {
776779 }
777780 }
778781
779−// visible: (
780−// !visuallyMinimized
781−// && !greeter.fullyShown
782−// && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
783−// )
784−// || decoratedWindow.fullscreen
785−// // || (root.state == "altTab" && index === spread.highlightedIndex)
782+ visible: (
783+ !visuallyMinimized
784+ && !greeter.fullyShown
785+ && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
786+ )
787+ || appDelegate.fullscreen
786788
787789 function close() {
788790 model.surface.close();
@@ -1117,7 +1119,7 @@ AbstractStage {
11171119 PropertyChanges { target: touchControls; enabled: true }
11181120 },
11191121 State {
1120− name: "fullscreen"; when: appDelegate.fullscreen
1122+ name: "fullscreen"; when: appDelegate.fullscreen && !appDelegate.minimized
11211123 PropertyChanges {
11221124 target: appDelegate;
11231125 requestedX: 0
tests/qmltests/Stage/tst_DesktopStage.qml+28−41
@@ -30,8 +30,8 @@ import "../../../qml/Components/PanelState"
3030
3131Item {
3232 id: root
33− width: desktopStageLoader.width + controls.width
34− height: desktopStageLoader.height
33+ width: stageLoader.width + controls.width
34+ height: stageLoader.height
3535
3636 property var greeter: { fullyShown: true }
3737
@@ -63,7 +63,7 @@ Item {
6363 }
6464
6565 Loader {
66− id: desktopStageLoader
66+ id: stageLoader
6767 x: ((root.width - controls.width) - width) / 2
6868 y: (root.height - height) / 2
6969 width: units.gu(160*0.9)
@@ -82,17 +82,19 @@ Item {
8282 edgeBarrierControls.target = testCase.findChild(this, "edgeBarrierController");
8383 }
8484 Component.onDestruction: {
85− desktopStageLoader.itemDestroyed = true;
85+ stageLoader.itemDestroyed = true;
8686 }
8787 orientations: Orientations {}
8888 applicationManager: ApplicationManager
8989 topLevelSurfaceList: topSurfaceList
90+ interactive: true
91+ mode: "windowed"
9092 }
9193 }
9294
9395 MouseArea {
9496 id: clickThroughTester
95− anchors.fill: desktopStageLoader.item
97+ anchors.fill: stageLoader.item
9698 acceptedButtons: Qt.AllButtons
9799 hoverEnabled: true
98100 }
@@ -130,7 +132,7 @@ Item {
130132 id: edgeBarrierControls
131133 text: "Drag here to pull out spread"
132134 backgroundColor: "blue"
133− onDragged: { desktopStageLoader.item.pushRightEdge(amount); }
135+ onDragged: { stageLoader.item.pushRightEdge(amount); }
134136 }
135137
136138 Divider {}
@@ -157,7 +159,7 @@ Item {
157159 name: "DesktopStage"
158160 when: windowShown
159161
160− property Item desktopStage: desktopStageLoader.status === Loader.Ready ? desktopStageLoader.item : null
162+ property Item stage: stageLoader.status === Loader.Ready ? stageLoader.item : null
161163
162164 function init() {
163165 // wait until unity8-dash is up and running.
@@ -173,29 +175,29 @@ Item {
173175 }
174176
175177 function cleanup() {
176− desktopStageLoader.itemDestroyed = false;
177− desktopStageLoader.active = false;
178+ stageLoader.itemDestroyed = false;
179+ stageLoader.active = false;
178180
179− tryCompare(desktopStageLoader, "status", Loader.Null);
180− tryCompare(desktopStageLoader, "item", null);
181+ tryCompare(stageLoader, "status", Loader.Null);
182+ tryCompare(stageLoader, "item", null);
181183 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
182184 // actually took place. Likely because Loader waits until the next event loop
183185 // iteration to do its work. So to ensure the reload, we will wait until the
184186 // Shell instance gets destroyed.
185− tryCompare(desktopStageLoader, "itemDestroyed", true);
187+ tryCompare(stageLoader, "itemDestroyed", true);
186188
187189 killApps();
188190
189191 root.resetGeometry();
190192
191− desktopStageLoader.active = true;
192− tryCompare(desktopStageLoader, "status", Loader.Ready);
193+ stageLoader.active = true;
194+ tryCompare(stageLoader, "status", Loader.Ready);
193195
194196 mouseEaterSpy.clear();
195197 }
196198
197199 function waitUntilAppSurfaceShowsUp(surfaceId) {
198− var appDelegate = findChild(desktopStage, "appDelegate_" + surfaceId);
200+ var appDelegate = findChild(stage, "appDelegate_" + surfaceId);
199201 verify(appDelegate);
200202 var appWindow = findChild(appDelegate, "appWindow");
201203 verify(appWindow);
@@ -213,7 +215,7 @@ Item {
213215 if (app) {
214216 for (var i = 0; i < topSurfaceList.count; i++) {
215217 if (topSurfaceList.applicationAt(i).appId === appId) {
216− var appRepeater = findChild(desktopStage, "appRepeater");
218+ var appRepeater = findChild(stage, "appRepeater");
217219 verify(appRepeater);
218220 return appRepeater.itemAt(i);
219221 }
@@ -226,7 +228,7 @@ Item {
226228 waitUntilAppSurfaceShowsUp(surfaceId);
227229 compare(app.surfaceList.count, 1);
228230
229− return findChild(desktopStage, "appDelegate_" + surfaceId);
231+ return findChild(stage, "appDelegate_" + surfaceId);
230232 } catch(err) {
231233 throw new Error("startApplication("+appId+") called from line " + util.callerLine(1) + " failed!");
232234 }
@@ -324,7 +326,7 @@ Item {
324326 }
325327
326328 function findDecoratedWindow(surfaceId) {
327− var appDelegate = findChild(desktopStage, "appDelegate_" + surfaceId);
329+ var appDelegate = findChild(stage, "appDelegate_" + surfaceId);
328330 if (!appDelegate) {
329331 console.warn("Could not find appDelegate for surfaceId="+surfaceId);
330332 return null;
@@ -333,7 +335,7 @@ Item {
333335 }
334336
335337 function findWindowDecoration(surfaceId) {
336− var appDelegate = findChild(desktopStage, "appDelegate_" + surfaceId);
338+ var appDelegate = findChild(stage, "appDelegate_" + surfaceId);
337339 if (!appDelegate) {
338340 console.warn("Could not find appDelegate for surfaceId="+surfaceId);
339341 return null;
@@ -465,8 +467,8 @@ Item {
465467
466468 mouseClick(dialerDelegate);
467469
468− var desktopStagePriv = findInvisibleChild(desktopStage, "DesktopStagePrivate");
469− tryCompare(desktopStagePriv, "focusedAppDelegate", dialerDelegate);
470+ var stagePriv = findInvisibleChild(stage, "DesktopStagePrivate");
471+ tryCompare(stagePriv, "focusedAppDelegate", dialerDelegate);
470472
471473 keyClick(Qt.Key_F4, Qt.AltModifier); // Alt+F4 shortcut to close
472474
@@ -527,7 +529,7 @@ Item {
527529 }
528530
529531 function test_oskDisplacesWindow(data) {
530− desktopStageLoader.item.oskEnabled = data.oskEnabled
532+ stageLoader.item.oskEnabled = data.oskEnabled
531533 var dashAppDelegate = startApplication("unity8-dash");
532534 var oldOSKState = SurfaceManager.inputMethodSurface.state;
533535 SurfaceManager.inputMethodSurface.state = Mir.RestoredState;
@@ -598,6 +600,8 @@ Item {
598600 var gmailDelegate = startApplication("gmail-webapp");
599601 verify(gmailDelegate);
600602
603+ wait(2000)
604+
601605 var gmailMaximizeButton = findChild(gmailDelegate, "maximizeWindowButton");
602606 verify(gmailMaximizeButton);
603607 mouseClick(gmailMaximizeButton);
@@ -610,6 +614,7 @@ Item {
610614 tryCompare(mapApp.surfaceList.get(0), "visible", false);
611615
612616 ApplicationManager.stopApplication("gmail-webapp");
617+ wait(2000)
613618
614619 tryCompare(mapApp.surfaceList.get(0), "visible", true);
615620 tryCompare(dialerApp.surfaceList.get(0), "visible", true);
@@ -709,7 +714,7 @@ Item {
709714 tryCompare(overlay, "visible", data.result);
710715
711716 if (data.result) { // if shown, try to hide it by clicking outside
712− mouseClick(desktopStage);
717+ mouseClick(stage);
713718 tryCompare(overlay, "visible", false);
714719 }
715720 }
@@ -768,24 +773,6 @@ Item {
768773 tryCompareFunction(function(){return posBefore == posAfter;}, data.button !== Qt.LeftButton ? true : false);
769774 }
770775
771− function test_preventMouseEventsThruDesktopSpread() {
772− var spread = findChild(desktopStage, "spread");
773− verify(spread);
774− spread.show();
775− tryCompareFunction( function(){ return spread.ready }, true );
776−
777− mouseEaterSpy.signalName = "wheel";
778− mouseWheel(spread, spread.width/2, spread.height/2, 10, 10);
779− tryCompare(mouseEaterSpy, "count", 0);
780−
781− mouseEaterSpy.clear();
782− mouseEaterSpy.signalName = "clicked";
783− mouseClick(spread, spread.width/2, spread.height/2, Qt.RightButton);
784− tryCompare(mouseEaterSpy, "count", 0);
785−
786− spread.cancel();
787− }
788−
789776 function test_eatWindowDecorationMouseEvents_data() {
790777 return [
791778 {tag: "left mouse click", signalName: "clicked", button: Qt.LeftButton },