~mzanetti/unity8/fix-1648251

« back to all changes in this revision

Viewing changes to qml/Stages/TabletStage.qml

  • Committer: Michael Zanetti
  • Date: 2016-10-13 11:02:11 UTC
  • mfrom: (2525.1.132 unity8)
  • Revision ID: michael.zanetti@canonical.com-20161013110211-tj2gly2dxaqj5t2e
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
        }
85
85
    }
86
86
 
 
87
    function closeFocusedDelegate() {
 
88
        if (priv.focusedAppDelegate && priv.focusedAppDelegate.closeable) {
 
89
            priv.focusedAppDelegate.closed();
 
90
        }
 
91
    }
 
92
 
87
93
    orientationChangesEnabled: priv.mainAppOrientationChangesEnabled
88
94
 
89
95
    mainApp: {
301
307
    Binding {
302
308
        target: MirFocusController
303
309
        property: "focusedSurface"
304
 
        value: priv.focusedAppDelegate ? priv.focusedAppDelegate.surface : null
 
310
        value: priv.focusedAppDelegate ? priv.focusedAppDelegate.focusedSurface : null
305
311
        when: root.parent && !spreadRepeater.startingUp
306
312
    }
307
313
 
479
485
                return;
480
486
            }
481
487
 
482
 
            switch (phase) {
483
 
            case 0:
 
488
            if (phase === 0) {
484
489
                // the "spreadEnabled" part is because when code does "phase = 0; contentX = -shift" to
485
490
                // dismiss the spread because spreadEnabled went to false, for some reason, during tests,
486
491
                // Flickable might jump in and change contentX value back, causing the code below to do
490
495
                if (root.spreadEnabled && shiftedContentX > width * positionMarker2) {
491
496
                    phase = 1;
492
497
                }
493
 
                break;
494
 
            case 1:
 
498
            }
 
499
 
 
500
            // Do not turn to else if
 
501
            // Sometimes the animation of shiftedContentX is very fast and we need to jump from phase 0 to 1 to 2
 
502
            // in the same onShiftedContentXChanged
 
503
            if (phase === 1) {
495
504
                if (shiftedContentX < width * positionMarker2) {
496
505
                    phase = 0;
497
506
                } else if (shiftedContentX >= width * positionMarker4 && !spreadDragArea.dragging) {
498
507
                    phase = 2;
499
508
                }
500
 
                break;
501
509
            }
502
510
        }
503
511
 
536
544
            if (!app) {
537
545
                return index;
538
546
            }
539
 
            var stage = spreadRepeater.itemAt(index) ? spreadRepeater.itemAt(index).stage : app.stage;
 
547
            var stage = spreadRepeater.itemAt(index) ? spreadRepeater.itemAt(index).stage : ApplicationInfoInterface.MainStage;
540
548
 
541
549
            // don't shuffle indexes greater than "actives or next"
542
550
            if (index > 2) return index;
707
715
 
708
716
                onItemRemoved: {
709
717
                    priv.updateMainAndSideStageIndexes();
710
 
                    // Unless we're closing the app ourselves in the spread,
 
718
                    // Unless we're closing the app ourselves,
711
719
                    // lets make sure the spread doesn't mess up by the changing app list.
712
720
                    if (spreadView.closingIndex == -1) {
713
721
                        spreadView.phase = 0;
714
722
                        spreadView.contentX = -spreadView.shift;
715
 
                        focusTopMostApp();
716
723
                    }
 
724
                    focusTopMostApp();
717
725
                }
718
726
                function focusTopMostApp() {
719
727
                    if (spreadRepeater.count > 0) {