~mzanetti/unity8/fix-1648251

« back to all changes in this revision

Viewing changes to qml/Stage/SurfaceContainer.qml

  • Committer: Michael Zanetti
  • Date: 2016-12-01 12:20:34 UTC
  • mfrom: (2525.1.179 unity8)
  • Revision ID: michael.zanetti@canonical.com-20161201122034-cpvbf7webbhg2wph
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
FocusScope {
24
24
    id: root
25
25
    objectName: "surfaceContainer"
 
26
    implicitWidth: surfaceItem.implicitWidth
 
27
    implicitHeight: surfaceItem.implicitHeight
26
28
 
27
29
    // Must be set from outside
28
30
    property var surface: null
32
34
    property int requestedHeight: -1
33
35
    property bool interactive
34
36
    property int surfaceOrientationAngle: 0
35
 
    property bool resizeSurface: true
36
37
    property bool isPromptSurface: false
37
38
    // FIME - dont export, use interactive property. Need to fix qtmir to handle consumesInputChanged
38
39
    // to update surface activeFocus. See mock MirSurfaceItem.
58
59
    MirSurfaceItem {
59
60
        id: surfaceItem
60
61
        objectName: "surfaceItem"
 
62
        anchors.fill: parent
61
63
 
62
64
        focus: true
63
65
 
64
66
        fillMode: MirSurfaceItem.PadOrCrop
65
67
        consumesInput: true
66
68
 
67
 
        surfaceWidth: {
68
 
            if (root.resizeSurface) {
69
 
                if (root.requestedWidth >= 0) {
70
 
                    return root.requestedWidth;
71
 
                } else {
72
 
                    return width;
73
 
                }
74
 
            } else {
75
 
                return -1;
76
 
            }
77
 
        }
78
 
 
79
 
        surfaceHeight: {
80
 
            if (root.resizeSurface) {
81
 
                if (root.requestedHeight >= 0) {
82
 
                    return root.requestedHeight;
83
 
                } else {
84
 
                    return height;
85
 
                }
86
 
            } else {
87
 
                return -1;
88
 
            }
89
 
        }
 
69
        surfaceWidth: root.requestedWidth
 
70
        surfaceHeight: root.requestedHeight
90
71
 
91
72
        enabled: root.interactive
92
73
        antialiasing: !root.interactive
99
80
        enabled: surfaceItem.enabled
100
81
    }
101
82
 
102
 
    // MirSurface size drives SurfaceContainer size
103
 
    Binding {
104
 
        target: surfaceItem; property: "width"; value: root.surface ? root.surface.size.width : 0
105
 
        when: root.requestedWidth >= 0 && root.surface
106
 
    }
107
 
    Binding {
108
 
        target: surfaceItem; property: "height"; value: root.surface ? root.surface.size.height : 0
109
 
        when: root.requestedHeight >= 0 && root.surface
110
 
    }
111
 
    Binding {
112
 
        target: root; property: "width"; value: surfaceItem.width
113
 
        when: root.requestedWidth >= 0
114
 
    }
115
 
    Binding {
116
 
        target: root; property: "height"; value: surfaceItem.height
117
 
        when: root.requestedHeight >= 0
118
 
    }
119
 
 
120
 
    // SurfaceContainer size drives MirSurface size
121
 
    Binding {
122
 
        target: surfaceItem; property: "width"; value: root.width
123
 
        when: root.requestedWidth < 0
124
 
    }
125
 
    Binding {
126
 
        target: surfaceItem; property: "height"; value: root.height
127
 
        when: root.requestedHeight < 0
128
 
    }
129
 
 
130
83
    Loader {
131
84
        id: animationsLoader
132
85
        objectName: "animationsLoader"