on xenial help sign in
basic state machine seems to work now.
26abde6Michael Zanetti
qml/Stages/DesktopStage.qml+59−17
@@ -118,6 +118,7 @@ AbstractStage {
118
118
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;
123 }
124 }
@@ -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;
158 return;
160 return;
159 }
161 }
@@ -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;
172 }
175 }
173 }
176 }
@@ -324,14 +327,17 @@ AbstractStage {
324 property real angle: 0
327 property real angle: 0
325
328
326 function claimFocus() {
329 function claimFocus() {
327− if (spread.state == "altTab") {
330+// if (spread.state == "altTab") {
328− spread.cancel();
331+// spread.cancel();
329− }
332+// }
330− appDelegate.restore();
333+// appDelegate.restore();
331 }
334 }
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)
339+ claimFocus();
340+ }
335 }
341 }
336 Connections {
342 Connections {
337 target: model.application
343 target: model.application
@@ -351,11 +357,14 @@ AbstractStage {
351 return;
357 return;
352
358
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;
355
363
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);
360 }
369 }
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;
374 }
384 }
375 }
385 }
@@ -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;
392 return;
403 return;
393 }
404 }
@@ -397,13 +408,13 @@ AbstractStage {
397
408
398 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
409 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
399
410
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)
404− )
415+// )
405− || decoratedWindow.fullscreen
416+// || decoratedWindow.fullscreen
406− // || (root.state == "altTab" && index === spread.highlightedIndex)
417+// // || (root.state == "altTab" && index === spread.highlightedIndex)
407
418
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();
451
462
463+ print("***** focusing because of window restore", model.application.appId)
452 focus = true;
464 focus = true;
453 }
465 }
454
466
@@ -495,6 +507,7 @@ AbstractStage {
495 }
507 }
496 ]
508 ]
497
509
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: [
500 State {
513 State {
@@ -506,6 +519,7 @@ AbstractStage {
506 angle: spreadMaths.animatedAngle
519 angle: spreadMaths.animatedAngle
507 }
520 }
508 PropertyChanges { target: decoratedWindow; showDecoration: false }
521 PropertyChanges { target: decoratedWindow; showDecoration: false }
522+ PropertyChanges { target: inputBlocker; enabled: true }
509 },
523 },
510 State {
524 State {
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
533 }
547 }
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
553+ }
554+ PropertyChanges {
555+ target: resizeArea
556+ enabled: false
538 }
557 }
539 },
558 },
540 State {
559 State {
@@ -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 }
657 },
676 },
658 Transition {
677 Transition {
678+ from: "spread"; to: "staged"
679+ PropertyAnimation {
680+ target: appDelegate
681+ properties: "x,y,angle"
682+ duration: 4000
683+ }
684+ },
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 }
661 }
688 }
662−
663 ]
689 ]
664
690
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
684
710
711+ onPressed: {
712+ print("***** focusing because of resize area press", model.application.appId)
685− onPressed: { appDelegate.focus = true; }
713+ appDelegate.focus = true;
714+ }
686
715
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;
757+ }
726 }
758 }
727
759
728 WindowedFullscreenPolicy {
760 WindowedFullscreenPolicy {
@@ -730,6 +762,15 @@ AbstractStage {
730 active: true
762 active: true
731 surface: model.surface
763 surface: model.surface
732 }
764 }
765+
766+ MouseArea {
767+ id: inputBlocker
768+ enabled: false
769+ onClicked: {
770+ print("focusing because of inputBlocker click")
771+ appDelegate.focus = true
772+ }
773+ }
733 }
774 }
734 }
775 }
735 }
776 }
@@ -760,6 +801,7 @@ AbstractStage {
760 FloatingFlickable {
801 FloatingFlickable {
761 id: floatingFlickable
802 id: floatingFlickable
762 anchors.fill: parent
803 anchors.fill: parent
804+ enabled: false
763
805
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)
779
821
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
qml/Stages/StagedRightEdgeMaths.qml+28−28
@@ -2,37 +2,37 @@ import QtQuick 2.4
2import Ubuntu.Components 1.3
2import Ubuntu.Components 1.3
3
3
4QtObject {
4QtObject {
5− id: root
5+ id: root
6
6
7− // Input
7+ // Input
8− property int itemIndex: 0
8+ property int itemIndex: 0
9− property real progress: 0
9+ property real progress: 0
10− property int sceneWidth: 0
10+ property int sceneWidth: 0
11− property int sceneHeight: 0
11+ property int sceneHeight: 0
12− property int targetX: 0
12+ property int targetX: 0
13− property int targetAngle: 0
13+ property int targetAngle: 0
14
14
15− // Output
15+ // Output
16− readonly property int animtedWidth: {
16+ readonly property int animtedWidth: {
17− return root.sceneWidth
17+ return root.sceneWidth
18− }
18+ }
19
19
20− readonly property int animatedHeight: {
20+ readonly property int animatedHeight: {
21− return root.sceneHeight
21+ return root.sceneHeight
22− }
22+ }
23
23
24− readonly property int animatedX: {
24+ readonly property int animatedX: {
25− if (index == 0) {
25+ if (itemIndex == 0) {
26− // aX : tX = p : 1
26+ // aX : tX = p : 1
27− return root.targetX * root.progress
27+ return root.targetX * root.progress
28− }
28+ }
29− var startX = sceneWidth + (root.itemIndex - 1) * units.gu(10)
29+ var startX = sceneWidth + (root.itemIndex - 1) * units.gu(10)
30− var distance = startX - root.targetX
30+ var distance = startX - root.targetX
31− return startX - distance * root.progress;
31+ return startX - distance * root.progress;
32− }
32+ }
33
33
34− readonly property real animatedAngle: {
34+ readonly property real animatedAngle: {
35− // a : tA = p : 1
35+ // a : tA = p : 1
36− return root.targetAngle * root.progress
36+ return root.targetAngle * root.progress
37− }
37+ }
38}
38}
tests/mocks/Unity/Application/MirSurfaceListModel.cpp+1−1
@@ -74,7 +74,7 @@ void MirSurfaceListModel::appendSurface(MirSurface *surface)
74
74
75void MirSurfaceListModel::connectSurface(MirSurface *surface)
75void MirSurfaceListModel::connectSurface(MirSurface *surface)
76{
76{
77− connect(surface, &MirSurface::raiseRequested, this, [this, surface](){ this->raise(surface); });
77+// connect(surface, &MirSurface::raiseRequested, this, [this, surface](){ this->raise(surface); });
78 connect(surface, &QObject::destroyed, this, [this, surface](){ this->removeSurface(surface); });
78 connect(surface, &QObject::destroyed, this, [this, surface](){ this->removeSurface(surface); });
79}
79}
80
80