on xenial help sign in
fix race when initializing surfaces while in spread
be7527fMichael Zanetti
qml/Stage/DecoratedWindow.qml+29−17
@@ -26,8 +26,6 @@ FocusScope {
26 // (minus the window decoration size in case hasDecoration and showDecoration are true)
26 // (minus the window decoration size in case hasDecoration and showDecoration are true)
27 // The surface might not be able to resize to the requested values. It will return its actual size
27 // The surface might not be able to resize to the requested values. It will return its actual size
28 // in implicitWidth/implicitHeight.
28 // in implicitWidth/implicitHeight.
29− implicitWidth: applicationWindow.implicitWidth
30− implicitHeight: decorationHeight + applicationWindow.implicitHeight
31
29
32 property alias application: applicationWindow.application
30 property alias application: applicationWindow.application
33 property alias surface: applicationWindow.surface
31 property alias surface: applicationWindow.surface
@@ -81,6 +79,35 @@ FocusScope {
81 Behavior on visibleDecorationHeight { enabled: root.animateDecoration; UbuntuNumberAnimation { duration: priv.animationDuration } }
79 Behavior on visibleDecorationHeight { enabled: root.animateDecoration; UbuntuNumberAnimation { duration: priv.animationDuration } }
82 }
80 }
83
81
82+ StateGroup {
83+ states: [
84+ State {
85+ name: "normal"; when: root.scaleToPreviewProgress == 0
86+ PropertyChanges {
87+ target: root
88+ implicitWidth: applicationWindow.implicitWidth
89+ implicitHeight: root.decorationHeight + applicationWindow.implicitHeight
90+ }
91+ },
92+ State {
93+ name: "preview"; when: root.scaleToPreviewProgress > 0
94+ PropertyChanges {
95+ target: root
96+ implicitWidth: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedWidth, root.scaleToPreviewSize, root.scaleToPreviewProgress)
97+ implicitHeight: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedHeight, root.scaleToPreviewSize, root.scaleToPreviewProgress)
98+ }
99+ PropertyChanges {
100+ target: applicationWindow;
101+ requestedWidth: applicationWindow.oldRequestedWidth
102+ requestedHeight: applicationWindow.oldRequestedHeight
103+ width: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedWidth, applicationWindow.minSize, root.scaleToPreviewProgress)
104+ height: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedHeight, applicationWindow.minSize, root.scaleToPreviewProgress)
105+ itemScale: root.implicitWidth / width
106+ }
107+ }
108+ ]
109+ }
110+
84 Rectangle {
111 Rectangle {
85 id: selectionHighlight
112 id: selectionHighlight
86 anchors.fill: parent
113 anchors.fill: parent
@@ -138,21 +165,6 @@ FocusScope {
138
165
139 property real itemScale: 1
166 property real itemScale: 1
140 property real minSize: Math.min(root.scaleToPreviewSize, Math.min(applicationWindow.requestedHeight, applicationWindow.requestedWidth))
167 property real minSize: Math.min(root.scaleToPreviewSize, Math.min(applicationWindow.requestedHeight, applicationWindow.requestedWidth))
141− states: [
142− State {
143− name: "preview"; when: root.scaleToPreviewProgress > 0
144− PropertyChanges {
145− target: applicationWindow;
146− requestedWidth: applicationWindow.oldRequestedWidth
147− requestedHeight: applicationWindow.oldRequestedHeight
148− implicitWidth: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedWidth, root.scaleToPreviewSize, root.scaleToPreviewProgress)
149− implicitHeight: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedHeight, root.scaleToPreviewSize, root.scaleToPreviewProgress)
150− width: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedWidth, applicationWindow.minSize, root.scaleToPreviewProgress)
151− height: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedHeight, applicationWindow.minSize, root.scaleToPreviewProgress)
152− itemScale: implicitWidth / width
153− }
154− }
155− ]
156
168
157 transform: [
169 transform: [
158 Rotation {
170 Rotation {