@@ -118,6 +118,7 @@ AbstractStage {
119 property var focusedAppDelegate: null
119 property var focusedAppDelegate: null
120 onFocusedAppDelegateChanged: {
120 onFocusedAppDelegateChanged: {
121+ print("focusedAppDelegate changed", focusedAppDelegate.objectName)
121 if (root.state == "spread") {
122 if (root.state == "spread") {
122 goneToSpread = false;
123 goneToSpread = false;
@@ -154,6 +155,7 @@ AbstractStage {
154 for (var i = 0; i < appRepeater.count; i++) {
155 for (var i = 0; i < appRepeater.count; i++) {
155 var appDelegate = appRepeater.itemAt(i);
156 var appDelegate = appRepeater.itemAt(i);
156 if (appDelegate && !appDelegate.minimized) {
157 if (appDelegate && !appDelegate.minimized) {
158+ print("***** focusing because of focusNext() call", appDelegate.application.appId)
157 appDelegate.focus = true;
159 appDelegate.focus = true;
@@ -168,6 +170,7 @@ AbstractStage {
168 onMaximize: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.restoreFromMaximized(); } }
170 onMaximize: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.restoreFromMaximized(); } }
169 onFocusMaximizedApp: {
171 onFocusMaximizedApp: {
170 if (priv.foregroundMaximizedAppDelegate) {
172 if (priv.foregroundMaximizedAppDelegate) {
173+ print("***** focusing because of Panel request", model.application.appId)
171 priv.foregroundMaximizedAppDelegate.focus = true;
174 priv.foregroundMaximizedAppDelegate.focus = true;
@@ -324,14 +327,17 @@ AbstractStage {
324 property real angle: 0
327 property real angle: 0
326 function claimFocus() {
329 function claimFocus() {
327− if (spread.state == "altTab") {
330+// if (spread.state == "altTab") {
328− spread.cancel();
331+// spread.cancel();
330− appDelegate.restore();
333+// appDelegate.restore();
332 Connections {
335 Connections {
333 target: model.surface
336 target: model.surface
334− onFocusRequested: claimFocus();
337+ onFocusRequested: {
338+ print("model surface requesting focus", model.application.appId)
336 Connections {
342 Connections {
337 target: model.application
343 target: model.application
@@ -351,11 +357,14 @@ AbstractStage {
353 if (focus) {
359 if (focus) {
360+ print("app surface gained focus:", model.application.appId)
361+ print("setting focusedAppDelegate to", appDelegate.application.appId)
354 priv.focusedAppDelegate = appDelegate;
362 priv.focusedAppDelegate = appDelegate;
356 // If we're orphan (!parent) it means this stage is no longer the current one
364 // If we're orphan (!parent) it means this stage is no longer the current one
357 // and will be deleted shortly. So we should no longer have a say over the model
365 // and will be deleted shortly. So we should no longer have a say over the model
358 if (root.parent) {
366 if (root.parent) {
367+ print("raising surface in model", model.id)
359 topLevelSurfaceList.raiseId(model.id);
368 topLevelSurfaceList.raiseId(model.id);
361 } else if (!focus && priv.focusedAppDelegate === appDelegate) {
370 } else if (!focus && priv.focusedAppDelegate === appDelegate) {
@@ -370,6 +379,7 @@ AbstractStage {
370 if (!appRepeater.startingUp) {
379 if (!appRepeater.startingUp) {
371 // a top level window is always the focused one when it first appears, unfocusing
380 // a top level window is always the focused one when it first appears, unfocusing
372 // any preexisting one
381 // any preexisting one
382+ print("***** focusing after starting up", model.application.appId)
373 focus = true;
383 focus = true;
@@ -388,6 +398,7 @@ AbstractStage {
388 for (var i = 0; i < appRepeater.count; i++) {
398 for (var i = 0; i < appRepeater.count; i++) {
389 var appDelegate = appRepeater.itemAt(i);
399 var appDelegate = appRepeater.itemAt(i);
390 if (appDelegate && !appDelegate.minimized && i != index) {
400 if (appDelegate && !appDelegate.minimized && i != index) {
401+ print("***** focusing because of previously focused window disappeared", appDelegate.application.appId)
391 appDelegate.focus = true;
402 appDelegate.focus = true;
@@ -397,13 +408,13 @@ AbstractStage {
398 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
409 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
400− visible: (
411+// visible: (
401− !visuallyMinimized
412+// !visuallyMinimized
402− && !greeter.fullyShown
413+// && !greeter.fullyShown
403− && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
414+// && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
405− || decoratedWindow.fullscreen
416+// || decoratedWindow.fullscreen
406− // || (root.state == "altTab" && index === spread.highlightedIndex)
417+// // || (root.state == "altTab" && index === spread.highlightedIndex)
408 function close() {
419 function close() {
409 model.surface.close();
420 model.surface.close();
@@ -449,6 +460,7 @@ AbstractStage {
449 else if (maximizedRight)
460 else if (maximizedRight)
450 maximizeRight();
461 maximizeRight();
463+ print("***** focusing because of window restore", model.application.appId)
452 focus = true;
464 focus = true;
@@ -495,6 +507,7 @@ AbstractStage {
510+ onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
498 onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
511 onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
499 states: [
512 states: [
@@ -506,6 +519,7 @@ AbstractStage {
506 angle: spreadMaths.animatedAngle
519 angle: spreadMaths.animatedAngle
508 PropertyChanges { target: decoratedWindow; showDecoration: false }
521 PropertyChanges { target: decoratedWindow; showDecoration: false }
522+ PropertyChanges { target: inputBlocker; enabled: true }
511 name: "stagedrightedge"; when: root.state == "stagedrightedge"
525 name: "stagedrightedge"; when: root.state == "stagedrightedge"
@@ -528,13 +542,18 @@ AbstractStage {
528 name: "staged"; when: root.state == "staged"
542 name: "staged"; when: root.state == "staged"
529 PropertyChanges {
543 PropertyChanges {
530 target: appDelegate
544 target: appDelegate
531− x: 0; y: 0
545+ x: appDelegate.focus ? 0 : root.width; y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
532 visuallyMaximized: true
546 visuallyMaximized: true
534 PropertyChanges {
548 PropertyChanges {
535 target: decoratedWindow
549 target: decoratedWindow
536 requestedWidth: appContainer.width - root.leftMargin;
550 requestedWidth: appContainer.width - root.leftMargin;
537 requestedHeight: appContainer.height;
551 requestedHeight: appContainer.height;
552+ showDecoration: false
@@ -656,10 +675,17 @@ AbstractStage {
656 PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: UbuntuAnimation.FastDuration }
675 PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: UbuntuAnimation.FastDuration }
658 Transition {
677 Transition {
678+ from: "spread"; to: "staged"
681+ properties: "x,y,angle"
685+ Transition { // Ordering is important. This generic case needs to be after spread -> staged
659 to: "staged";
686 to: "staged";
660 PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: UbuntuAnimation.FastDuration }
687 PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: UbuntuAnimation.FastDuration }
665// Binding {
691// Binding {
@@ -682,7 +708,10 @@ AbstractStage {
682 screenHeight: appContainer.height
708 screenHeight: appContainer.height
683 leftMargin: root.leftMargin
709 leftMargin: root.leftMargin
712+ print("***** focusing because of resize area press", model.application.appId)
685− onPressed: { appDelegate.focus = true; }
713+ appDelegate.focus = true;
687 Component.onCompleted: {
716 Component.onCompleted: {
688 loadWindowState();
717 loadWindowState();
@@ -722,7 +751,10 @@ AbstractStage {
722 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
751 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
723 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
752 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
724 onMinimize: appDelegate.minimize()
753 onMinimize: appDelegate.minimize()
754+ onDecorationPressed: {
755+ print("***** focusing because of decoration press", model.application.appId)
725− onDecorationPressed: { appDelegate.focus = true; }
756+ appDelegate.focus = true;
728 WindowedFullscreenPolicy {
760 WindowedFullscreenPolicy {
@@ -730,6 +762,15 @@ AbstractStage {
730 active: true
762 active: true
731 surface: model.surface
763 surface: model.surface
770+ print("focusing because of inputBlocker click")
771+ appDelegate.focus = true
@@ -760,6 +801,7 @@ AbstractStage {
760 FloatingFlickable {
801 FloatingFlickable {
761 id: floatingFlickable
802 id: floatingFlickable
762 anchors.fill: parent
803 anchors.fill: parent
764 property int minContentWidth: 6 * Math.min(height / 4, width / 5)
806 property int minContentWidth: 6 * Math.min(height / 4, width / 5)
765 contentWidth: Math.max(6, appRepeater.count) * Math.min(height / 4, width / 5)
807 contentWidth: Math.max(6, appRepeater.count) * Math.min(height / 4, width / 5)
@@ -777,7 +819,7 @@ AbstractStage {
777 property real progress: -touchX / root.width
819 property real progress: -touchX / root.width
778 onProgressChanged: print("dda progress", progress, root.width, touchX, root.width + touchX)
820 onProgressChanged: print("dda progress", progress, root.width, touchX, root.width + touchX)
780− Rectangle { color: "blue"; anchors.fill: parent }
822+// Rectangle { color: "blue"; anchors.fill: parent }
781 onTouchXChanged: {
823 onTouchXChanged: {
782 if (dragging) {
824 if (dragging) {
783 // Gesture recognized. Let's move the spreadView with the finger
825 // Gesture recognized. Let's move the spreadView with the finger