on xenial help sign in
fix from dednick for disappearing maximized windows
commit11653c25ccd6e202331d2babbb4cdfcf0c9f141a authorLukáš Tinkl <lukas.tinkl@canonical.com> dateFri 6 Nov 2015, 21:58 (11 years ago) parent5e6d762
2 files changed+26−28
qml/Stages/DesktopStage.qml+9−9 tests/qmltests/Stages/tst_DesktopStage.qml+17−19
qml/Stages/DesktopStage.qml+9−9
@@ -58,6 +58,10 @@ AbstractStage {
5858 spread.cancel();
5959 }
6060 }
61+
62+ onRowsInserted: priv.updateForegroundMaximizedApp()
63+ onRowsRemoved: priv.updateForegroundMaximizedApp()
64+ onRowsMoved: priv.updateForegroundMaximizedApp()
6165 }
6266
6367 GlobalShortcut {
@@ -123,9 +127,9 @@ AbstractStage {
123127 var item = appRepeater.itemAt(i);
124128
125129 if (item && item.visuallyMaximized) {
126− var app = ApplicationManager.get(i);
127− if (app) {
128− foregroundMaximizedAppIdIndex = i;
130+ var index = priv.indexOf(item.appId);
131+ if (index !== -1) {
132+ foregroundMaximizedAppIdIndex = index;
129133 return;
130134 }
131135 }
@@ -146,7 +150,7 @@ AbstractStage {
146150 for (var i = 0; i < appRepeater.count; i++) {
147151 var appDelegate = appRepeater.itemAt(i);
148152 if (appDelegate && !appDelegate.minimized) {
149− appDelegate.minimize(false); // minimize but don't switch focus
153+ appDelegate.minimize();
150154 }
151155 }
152156
@@ -170,7 +174,7 @@ AbstractStage {
170174 onClose: {
171175 ApplicationManager.stopApplication(ApplicationManager.focusedApplicationId)
172176 }
173− onMinimize: appRepeater.itemAt(0).minimize(true);
177+ onMinimize: priv.focusedAppDelegate && priv.focusedAppDelegate.minimize();
174178 onMaximize: priv.focusedAppDelegate // don't restore minimized apps when double clicking the panel
175179 && priv.focusedAppDelegate.restore();
176180 }
@@ -223,9 +227,6 @@ AbstractStage {
223227 model: ApplicationManager
224228 objectName: "appRepeater"
225229
226− onItemAdded: priv.updateForegroundMaximizedApp()
227− onItemRemoved: priv.updateForegroundMaximizedApp()
228−
229230 delegate: FocusScope {
230231 id: appDelegate
231232 objectName: "appDelegate_" + appId
@@ -252,7 +253,6 @@ AbstractStage {
252253 }
253254 }
254255
255− onZChanged: priv.updateForegroundMaximizedApp()
256256 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
257257
258258 visible: !visuallyMinimized &&
tests/qmltests/Stages/tst_DesktopStage.qml+17−19
@@ -244,24 +244,6 @@ Item {
244244 tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
245245 }
246246
247− function test_clickingOnDecorationFocusesApplication_data() {
248− return test_tappingOnDecorationFocusesApplication_data(); // reuse test data
249− }
250−
251− function test_clickingOnDecorationFocusesApplication(data) {
252− data.apps.forEach(startApplication);
253−
254− var fromAppDecoration = findChild(desktopStage, "appWindowDecoration_" + data.apps[data.focusfrom]);
255− verify(fromAppDecoration);
256− mouseClick(fromAppDecoration);
257− tryCompare(ApplicationManager.findApplication(data.apps[data.focusfrom]).session.surface, "activeFocus", true);
258−
259− var toAppDecoration = findChild(desktopStage, "appWindowDecoration_" + data.apps[data.focusTo]);
260− verify(toAppDecoration);
261− mouseClick(toAppDecoration);
262− tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
263− }
264−
265247 function test_windowMaximize() {
266248 var apps = ["unity8-dash", "dialer-app", "camera-app"];
267249 apps.forEach(startApplication);
@@ -391,11 +373,11 @@ Item {
391373 var dialerApp = startApplication("dialer-app");
392374 var dialerDelegate = findChild(desktopStage, "appDelegate_dialer-app");
393375 verify(dialerDelegate);
376+ findChild(dialerDelegate, "decoratedWindow").maximize();
394377
395378 var cameraApp = startApplication("camera-app");
396379 var cameraDelegate = findChild(desktopStage, "appDelegate_camera-app");
397380 verify(cameraDelegate);
398− findChild(dialerDelegate, "decoratedWindow").maximize();
399381
400382 var galleryApp = startApplication("gallery-app");
401383 var galleryDelegate = findChild(desktopStage, "appDelegate_gallery-app");
@@ -415,5 +397,21 @@ Item {
415397 tryCompare(dialerApp.session.surface, "visible", true);
416398 tryCompare(dashApp.session.surface, "visible", false); // still occluded by maximised dialer
417399 }
400+
401+ function test_maximisedAppStaysVisibleWhenAppStarts() {
402+ var dashApp = startApplication("unity8-dash");
403+ var dashDelegate = findChild(desktopStage, "appDelegate_unity8-dash");
404+ verify(dashDelegate);
405+ // maximize
406+ findChild(dashDelegate, "decoratedWindow").maximize();
407+ tryCompare(dashDelegate, "visuallyMaximized", true);
408+
409+ var dialerApp = startApplication("dialer-app");
410+ var dialerDelegate = findChild(desktopStage, "appDelegate_dialer-app");
411+ verify(dialerDelegate);
412+
413+ compare(dialerDelegate.visible, true, "Dialer should be visible");
414+ compare(dashDelegate.visible, true, "Dash should still be visible");
415+ }
418416 }
419417}