on xenial help sign in
fix from dednick for disappearing maximized windows
11653c2Lukáš Tinkl
qml/Stages/DesktopStage.qml+9−9
@@ -58,6 +58,10 @@ AbstractStage {
58 spread.cancel();
58 spread.cancel();
59 }
59 }
60 }
60 }
61+
62+ onRowsInserted: priv.updateForegroundMaximizedApp()
63+ onRowsRemoved: priv.updateForegroundMaximizedApp()
64+ onRowsMoved: priv.updateForegroundMaximizedApp()
61 }
65 }
62
66
63 GlobalShortcut {
67 GlobalShortcut {
@@ -123,9 +127,9 @@ AbstractStage {
123 var item = appRepeater.itemAt(i);
127 var item = appRepeater.itemAt(i);
124
128
125 if (item && item.visuallyMaximized) {
129 if (item && item.visuallyMaximized) {
126− var app = ApplicationManager.get(i);
130+ var index = priv.indexOf(item.appId);
127− if (app) {
131+ if (index !== -1) {
128− foregroundMaximizedAppIdIndex = i;
132+ foregroundMaximizedAppIdIndex = index;
129 return;
133 return;
130 }
134 }
131 }
135 }
@@ -146,7 +150,7 @@ AbstractStage {
146 for (var i = 0; i < appRepeater.count; i++) {
150 for (var i = 0; i < appRepeater.count; i++) {
147 var appDelegate = appRepeater.itemAt(i);
151 var appDelegate = appRepeater.itemAt(i);
148 if (appDelegate && !appDelegate.minimized) {
152 if (appDelegate && !appDelegate.minimized) {
149− appDelegate.minimize(false); // minimize but don't switch focus
153+ appDelegate.minimize();
150 }
154 }
151 }
155 }
152
156
@@ -170,7 +174,7 @@ AbstractStage {
170 onClose: {
174 onClose: {
171 ApplicationManager.stopApplication(ApplicationManager.focusedApplicationId)
175 ApplicationManager.stopApplication(ApplicationManager.focusedApplicationId)
172 }
176 }
173− onMinimize: appRepeater.itemAt(0).minimize(true);
177+ onMinimize: priv.focusedAppDelegate && priv.focusedAppDelegate.minimize();
174 onMaximize: priv.focusedAppDelegate // don't restore minimized apps when double clicking the panel
178 onMaximize: priv.focusedAppDelegate // don't restore minimized apps when double clicking the panel
175 && priv.focusedAppDelegate.restore();
179 && priv.focusedAppDelegate.restore();
176 }
180 }
@@ -223,9 +227,6 @@ AbstractStage {
223 model: ApplicationManager
227 model: ApplicationManager
224 objectName: "appRepeater"
228 objectName: "appRepeater"
225
229
226− onItemAdded: priv.updateForegroundMaximizedApp()
227− onItemRemoved: priv.updateForegroundMaximizedApp()
228−
229 delegate: FocusScope {
230 delegate: FocusScope {
230 id: appDelegate
231 id: appDelegate
231 objectName: "appDelegate_" + appId
232 objectName: "appDelegate_" + appId
@@ -252,7 +253,6 @@ AbstractStage {
252 }
253 }
253 }
254 }
254
255
255− onZChanged: priv.updateForegroundMaximizedApp()
256 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
256 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
257
257
258 visible: !visuallyMinimized &&
258 visible: !visuallyMinimized &&
tests/qmltests/Stages/tst_DesktopStage.qml+17−19
@@ -244,24 +244,6 @@ Item {
244 tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
244 tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
245 }
245 }
246
246
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−
265 function test_windowMaximize() {
247 function test_windowMaximize() {
266 var apps = ["unity8-dash", "dialer-app", "camera-app"];
248 var apps = ["unity8-dash", "dialer-app", "camera-app"];
267 apps.forEach(startApplication);
249 apps.forEach(startApplication);
@@ -391,11 +373,11 @@ Item {
391 var dialerApp = startApplication("dialer-app");
373 var dialerApp = startApplication("dialer-app");
392 var dialerDelegate = findChild(desktopStage, "appDelegate_dialer-app");
374 var dialerDelegate = findChild(desktopStage, "appDelegate_dialer-app");
393 verify(dialerDelegate);
375 verify(dialerDelegate);
376+ findChild(dialerDelegate, "decoratedWindow").maximize();
394
377
395 var cameraApp = startApplication("camera-app");
378 var cameraApp = startApplication("camera-app");
396 var cameraDelegate = findChild(desktopStage, "appDelegate_camera-app");
379 var cameraDelegate = findChild(desktopStage, "appDelegate_camera-app");
397 verify(cameraDelegate);
380 verify(cameraDelegate);
398− findChild(dialerDelegate, "decoratedWindow").maximize();
399
381
400 var galleryApp = startApplication("gallery-app");
382 var galleryApp = startApplication("gallery-app");
401 var galleryDelegate = findChild(desktopStage, "appDelegate_gallery-app");
383 var galleryDelegate = findChild(desktopStage, "appDelegate_gallery-app");
@@ -415,5 +397,21 @@ Item {
415 tryCompare(dialerApp.session.surface, "visible", true);
397 tryCompare(dialerApp.session.surface, "visible", true);
416 tryCompare(dashApp.session.surface, "visible", false); // still occluded by maximised dialer
398 tryCompare(dashApp.session.surface, "visible", false); // still occluded by maximised dialer
417 }
399 }
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+ }
418 }
416 }
419}
417}