on xenial help sign in
merge parent
44c9710Lukáš Tinkl
qml/Stage/Stage.qml+12−10
@@ -103,8 +103,8 @@ AbstractStage {
103 GlobalShortcut {
103 GlobalShortcut {
104 id: minimizeAllShortcut
104 id: minimizeAllShortcut
105 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_D
105 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_D
106− onTriggered: priv.minimizeAllWindows()
106+ onTriggered: {print("tigggggered"); priv.minimizeAllWindows()}
107− active: root.state == "windowed"
107+// active: root.state == "windowed"
108 }
108 }
109
109
110 GlobalShortcut {
110 GlobalShortcut {
@@ -177,7 +177,9 @@ AbstractStage {
177 function minimizeAllWindows() {
177 function minimizeAllWindows() {
178 for (var i = 0; i < appRepeater.count; i++) {
178 for (var i = 0; i < appRepeater.count; i++) {
179 var appDelegate = appRepeater.itemAt(i);
179 var appDelegate = appRepeater.itemAt(i);
180+ print("have delegate", appDelegate.appId)
180 if (appDelegate && !appDelegate.minimized) {
181 if (appDelegate && !appDelegate.minimized) {
182+ print("minimizing it", appDelegate.appId)
181 appDelegate.minimize();
183 appDelegate.minimize();
182 }
184 }
183 }
185 }
@@ -695,6 +697,7 @@ AbstractStage {
695 Connections {
697 Connections {
696 target: model.surface
698 target: model.surface
697 onFocusRequested: {
699 onFocusRequested: {
700+ print("*********************************** focus requested", appId)
698 // Reset spread selection in case there is any
701 // Reset spread selection in case there is any
699 spreadItem.highlightedIndex = -1
702 spreadItem.highlightedIndex = -1
700 claimFocus();
703 claimFocus();
@@ -776,13 +779,12 @@ AbstractStage {
776 }
779 }
777 }
780 }
778
781
779−// visible: (
782+ visible: (
780−// !visuallyMinimized
783+ !visuallyMinimized
781−// && !greeter.fullyShown
784+ && !greeter.fullyShown
782−// && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
785+ && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
783−// )
786+ )
784−// || decoratedWindow.fullscreen
787+ || appDelegate.fullscreen
785−// // || (root.state == "altTab" && index === spread.highlightedIndex)
786
788
787 function close() {
789 function close() {
788 model.surface.close();
790 model.surface.close();
@@ -1117,7 +1119,7 @@ AbstractStage {
1117 PropertyChanges { target: touchControls; enabled: true }
1119 PropertyChanges { target: touchControls; enabled: true }
1118 },
1120 },
1119 State {
1121 State {
1120− name: "fullscreen"; when: appDelegate.fullscreen
1122+ name: "fullscreen"; when: appDelegate.fullscreen && !appDelegate.minimized
1121 PropertyChanges {
1123 PropertyChanges {
1122 target: appDelegate;
1124 target: appDelegate;
1123 requestedX: 0
1125 requestedX: 0
tests/qmltests/Stage/tst_DesktopStage.qml+28−41
@@ -30,8 +30,8 @@ import "../../../qml/Components/PanelState"
30
30
31Item {
31Item {
32 id: root
32 id: root
33− width: desktopStageLoader.width + controls.width
33+ width: stageLoader.width + controls.width
34− height: desktopStageLoader.height
34+ height: stageLoader.height
35
35
36 property var greeter: { fullyShown: true }
36 property var greeter: { fullyShown: true }
37
37
@@ -63,7 +63,7 @@ Item {
63 }
63 }
64
64
65 Loader {
65 Loader {
66− id: desktopStageLoader
66+ id: stageLoader
67 x: ((root.width - controls.width) - width) / 2
67 x: ((root.width - controls.width) - width) / 2
68 y: (root.height - height) / 2
68 y: (root.height - height) / 2
69 width: units.gu(160*0.9)
69 width: units.gu(160*0.9)
@@ -82,17 +82,19 @@ Item {
82 edgeBarrierControls.target = testCase.findChild(this, "edgeBarrierController");
82 edgeBarrierControls.target = testCase.findChild(this, "edgeBarrierController");
83 }
83 }
84 Component.onDestruction: {
84 Component.onDestruction: {
85− desktopStageLoader.itemDestroyed = true;
85+ stageLoader.itemDestroyed = true;
86 }
86 }
87 orientations: Orientations {}
87 orientations: Orientations {}
88 applicationManager: ApplicationManager
88 applicationManager: ApplicationManager
89 topLevelSurfaceList: topSurfaceList
89 topLevelSurfaceList: topSurfaceList
90+ interactive: true
91+ mode: "windowed"
90 }
92 }
91 }
93 }
92
94
93 MouseArea {
95 MouseArea {
94 id: clickThroughTester
96 id: clickThroughTester
95− anchors.fill: desktopStageLoader.item
97+ anchors.fill: stageLoader.item
96 acceptedButtons: Qt.AllButtons
98 acceptedButtons: Qt.AllButtons
97 hoverEnabled: true
99 hoverEnabled: true
98 }
100 }
@@ -130,7 +132,7 @@ Item {
130 id: edgeBarrierControls
132 id: edgeBarrierControls
131 text: "Drag here to pull out spread"
133 text: "Drag here to pull out spread"
132 backgroundColor: "blue"
134 backgroundColor: "blue"
133− onDragged: { desktopStageLoader.item.pushRightEdge(amount); }
135+ onDragged: { stageLoader.item.pushRightEdge(amount); }
134 }
136 }
135
137
136 Divider {}
138 Divider {}
@@ -157,7 +159,7 @@ Item {
157 name: "DesktopStage"
159 name: "DesktopStage"
158 when: windowShown
160 when: windowShown
159
161
160− property Item desktopStage: desktopStageLoader.status === Loader.Ready ? desktopStageLoader.item : null
162+ property Item stage: stageLoader.status === Loader.Ready ? stageLoader.item : null
161
163
162 function init() {
164 function init() {
163 // wait until unity8-dash is up and running.
165 // wait until unity8-dash is up and running.
@@ -173,29 +175,29 @@ Item {
173 }
175 }
174
176
175 function cleanup() {
177 function cleanup() {
176− desktopStageLoader.itemDestroyed = false;
178+ stageLoader.itemDestroyed = false;
177− desktopStageLoader.active = false;
179+ stageLoader.active = false;
178
180
179− tryCompare(desktopStageLoader, "status", Loader.Null);
181+ tryCompare(stageLoader, "status", Loader.Null);
180− tryCompare(desktopStageLoader, "item", null);
182+ tryCompare(stageLoader, "item", null);
181 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
183 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
182 // actually took place. Likely because Loader waits until the next event loop
184 // actually took place. Likely because Loader waits until the next event loop
183 // iteration to do its work. So to ensure the reload, we will wait until the
185 // iteration to do its work. So to ensure the reload, we will wait until the
184 // Shell instance gets destroyed.
186 // Shell instance gets destroyed.
185− tryCompare(desktopStageLoader, "itemDestroyed", true);
187+ tryCompare(stageLoader, "itemDestroyed", true);
186
188
187 killApps();
189 killApps();
188
190
189 root.resetGeometry();
191 root.resetGeometry();
190
192
191− desktopStageLoader.active = true;
193+ stageLoader.active = true;
192− tryCompare(desktopStageLoader, "status", Loader.Ready);
194+ tryCompare(stageLoader, "status", Loader.Ready);
193
195
194 mouseEaterSpy.clear();
196 mouseEaterSpy.clear();
195 }
197 }
196
198
197 function waitUntilAppSurfaceShowsUp(surfaceId) {
199 function waitUntilAppSurfaceShowsUp(surfaceId) {
198− var appDelegate = findChild(desktopStage, "appDelegate_" + surfaceId);
200+ var appDelegate = findChild(stage, "appDelegate_" + surfaceId);
199 verify(appDelegate);
201 verify(appDelegate);
200 var appWindow = findChild(appDelegate, "appWindow");
202 var appWindow = findChild(appDelegate, "appWindow");
201 verify(appWindow);
203 verify(appWindow);
@@ -213,7 +215,7 @@ Item {
213 if (app) {
215 if (app) {
214 for (var i = 0; i < topSurfaceList.count; i++) {
216 for (var i = 0; i < topSurfaceList.count; i++) {
215 if (topSurfaceList.applicationAt(i).appId === appId) {
217 if (topSurfaceList.applicationAt(i).appId === appId) {
216− var appRepeater = findChild(desktopStage, "appRepeater");
218+ var appRepeater = findChild(stage, "appRepeater");
217 verify(appRepeater);
219 verify(appRepeater);
218 return appRepeater.itemAt(i);
220 return appRepeater.itemAt(i);
219 }
221 }
@@ -226,7 +228,7 @@ Item {
226 waitUntilAppSurfaceShowsUp(surfaceId);
228 waitUntilAppSurfaceShowsUp(surfaceId);
227 compare(app.surfaceList.count, 1);
229 compare(app.surfaceList.count, 1);
228
230
229− return findChild(desktopStage, "appDelegate_" + surfaceId);
231+ return findChild(stage, "appDelegate_" + surfaceId);
230 } catch(err) {
232 } catch(err) {
231 throw new Error("startApplication("+appId+") called from line " + util.callerLine(1) + " failed!");
233 throw new Error("startApplication("+appId+") called from line " + util.callerLine(1) + " failed!");
232 }
234 }
@@ -324,7 +326,7 @@ Item {
324 }
326 }
325
327
326 function findDecoratedWindow(surfaceId) {
328 function findDecoratedWindow(surfaceId) {
327− var appDelegate = findChild(desktopStage, "appDelegate_" + surfaceId);
329+ var appDelegate = findChild(stage, "appDelegate_" + surfaceId);
328 if (!appDelegate) {
330 if (!appDelegate) {
329 console.warn("Could not find appDelegate for surfaceId="+surfaceId);
331 console.warn("Could not find appDelegate for surfaceId="+surfaceId);
330 return null;
332 return null;
@@ -333,7 +335,7 @@ Item {
333 }
335 }
334
336
335 function findWindowDecoration(surfaceId) {
337 function findWindowDecoration(surfaceId) {
336− var appDelegate = findChild(desktopStage, "appDelegate_" + surfaceId);
338+ var appDelegate = findChild(stage, "appDelegate_" + surfaceId);
337 if (!appDelegate) {
339 if (!appDelegate) {
338 console.warn("Could not find appDelegate for surfaceId="+surfaceId);
340 console.warn("Could not find appDelegate for surfaceId="+surfaceId);
339 return null;
341 return null;
@@ -465,8 +467,8 @@ Item {
465
467
466 mouseClick(dialerDelegate);
468 mouseClick(dialerDelegate);
467
469
468− var desktopStagePriv = findInvisibleChild(desktopStage, "DesktopStagePrivate");
470+ var stagePriv = findInvisibleChild(stage, "DesktopStagePrivate");
469− tryCompare(desktopStagePriv, "focusedAppDelegate", dialerDelegate);
471+ tryCompare(stagePriv, "focusedAppDelegate", dialerDelegate);
470
472
471 keyClick(Qt.Key_F4, Qt.AltModifier); // Alt+F4 shortcut to close
473 keyClick(Qt.Key_F4, Qt.AltModifier); // Alt+F4 shortcut to close
472
474
@@ -527,7 +529,7 @@ Item {
527 }
529 }
528
530
529 function test_oskDisplacesWindow(data) {
531 function test_oskDisplacesWindow(data) {
530− desktopStageLoader.item.oskEnabled = data.oskEnabled
532+ stageLoader.item.oskEnabled = data.oskEnabled
531 var dashAppDelegate = startApplication("unity8-dash");
533 var dashAppDelegate = startApplication("unity8-dash");
532 var oldOSKState = SurfaceManager.inputMethodSurface.state;
534 var oldOSKState = SurfaceManager.inputMethodSurface.state;
533 SurfaceManager.inputMethodSurface.state = Mir.RestoredState;
535 SurfaceManager.inputMethodSurface.state = Mir.RestoredState;
@@ -598,6 +600,8 @@ Item {
598 var gmailDelegate = startApplication("gmail-webapp");
600 var gmailDelegate = startApplication("gmail-webapp");
599 verify(gmailDelegate);
601 verify(gmailDelegate);
600
602
603+ wait(2000)
604+
601 var gmailMaximizeButton = findChild(gmailDelegate, "maximizeWindowButton");
605 var gmailMaximizeButton = findChild(gmailDelegate, "maximizeWindowButton");
602 verify(gmailMaximizeButton);
606 verify(gmailMaximizeButton);
603 mouseClick(gmailMaximizeButton);
607 mouseClick(gmailMaximizeButton);
@@ -610,6 +614,7 @@ Item {
610 tryCompare(mapApp.surfaceList.get(0), "visible", false);
614 tryCompare(mapApp.surfaceList.get(0), "visible", false);
611
615
612 ApplicationManager.stopApplication("gmail-webapp");
616 ApplicationManager.stopApplication("gmail-webapp");
617+ wait(2000)
613
618
614 tryCompare(mapApp.surfaceList.get(0), "visible", true);
619 tryCompare(mapApp.surfaceList.get(0), "visible", true);
615 tryCompare(dialerApp.surfaceList.get(0), "visible", true);
620 tryCompare(dialerApp.surfaceList.get(0), "visible", true);
@@ -709,7 +714,7 @@ Item {
709 tryCompare(overlay, "visible", data.result);
714 tryCompare(overlay, "visible", data.result);
710
715
711 if (data.result) { // if shown, try to hide it by clicking outside
716 if (data.result) { // if shown, try to hide it by clicking outside
712− mouseClick(desktopStage);
717+ mouseClick(stage);
713 tryCompare(overlay, "visible", false);
718 tryCompare(overlay, "visible", false);
714 }
719 }
715 }
720 }
@@ -768,24 +773,6 @@ Item {
768 tryCompareFunction(function(){return posBefore == posAfter;}, data.button !== Qt.LeftButton ? true : false);
773 tryCompareFunction(function(){return posBefore == posAfter;}, data.button !== Qt.LeftButton ? true : false);
769 }
774 }
770
775
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−
789 function test_eatWindowDecorationMouseEvents_data() {
776 function test_eatWindowDecorationMouseEvents_data() {
790 return [
777 return [
791 {tag: "left mouse click", signalName: "clicked", button: Qt.LeftButton },
778 {tag: "left mouse click", signalName: "clicked", button: Qt.LeftButton },