on xenial help sign in
apply nick's patch for fixing tiny window sizes
commitb8150afa5736a86f3d997191d7d97c66143b441b authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 21 Mar 2017, 16:16 (10 years ago) parent7e68062
4 files changed+68−36
qml/Stage/DecoratedWindow.qml+10−10 qml/Stage/Stage.qml+31−20 qml/Stage/WindowResizeArea.qml+27−4 qml/Stage/WindowStateSaver.qml−2
qml/Stage/DecoratedWindow.qml+10−10
@@ -118,15 +118,15 @@ FocusScope {
118118 name: "preview"; when: root.scaleToPreviewProgress > 0
119119 PropertyChanges {
120120 target: root
121− implicitWidth: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedWidth, root.scaleToPreviewSize, root.scaleToPreviewProgress)
122− implicitHeight: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedHeight, root.scaleToPreviewSize, root.scaleToPreviewProgress)
121+ implicitWidth: MathUtils.linearAnimation(0, 1, applicationWindow.requestedWidth, root.scaleToPreviewSize, root.scaleToPreviewProgress)
122+ implicitHeight: MathUtils.linearAnimation(0, 1, applicationWindow.requestedHeight, root.scaleToPreviewSize, root.scaleToPreviewProgress)
123123 }
124124 PropertyChanges {
125125 target: applicationWindow;
126− requestedWidth: applicationWindow.oldRequestedWidth
127− requestedHeight: applicationWindow.oldRequestedHeight
128− width: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedWidth, applicationWindow.minSize, root.scaleToPreviewProgress)
129− height: MathUtils.linearAnimation(0, 1, applicationWindow.oldRequestedHeight, applicationWindow.minSize, root.scaleToPreviewProgress)
126+// requestedWidth: applicationWindow.oldRequestedWidth
127+// requestedHeight: applicationWindow.oldRequestedHeight
128+ width: MathUtils.linearAnimation(0, 1, applicationWindow.requestedWidth, applicationWindow.minSize, root.scaleToPreviewProgress)
129+ height: MathUtils.linearAnimation(0, 1, applicationWindow.requestedHeight, applicationWindow.minSize, root.scaleToPreviewProgress)
130130 itemScale: root.implicitWidth / width
131131 }
132132 }
@@ -165,10 +165,10 @@ FocusScope {
165165 height: implicitHeight
166166 requestedHeight: !counterRotate ? root.requestedHeight - d.requestedDecorationHeight : root.requestedWidth
167167 requestedWidth: !counterRotate ? root.requestedWidth : root.requestedHeight - d.requestedDecorationHeight
168− property int oldRequestedWidth: requestedWidth
169− property int oldRequestedHeight: requestedHeight
170− onRequestedWidthChanged: oldRequestedWidth = requestedWidth
171− onRequestedHeightChanged: oldRequestedHeight = requestedHeight
168+// property int oldRequestedWidth: requestedWidth
169+// property int oldRequestedHeight: requestedHeight
170+// onRequestedWidthChanged: oldRequestedWidth = requestedWidth
171+// onRequestedHeightChanged: oldRequestedHeight = requestedHeight
172172 focus: true
173173
174174 property real itemScale: 1
qml/Stage/Stage.qml+31−20
@@ -1322,8 +1322,6 @@ FocusScope {
13221322 y: spreadMaths.targetY
13231323 z: index
13241324 height: spreadItem.spreadItemHeight
1325− requestedWidth: decoratedWindow.oldRequestedWidth
1326− requestedHeight: decoratedWindow.oldRequestedHeight
13271325 visible: spreadMaths.itemVisible
13281326 }
13291327 PropertyChanges { target: dragArea; enabled: true }
@@ -1343,8 +1341,6 @@ FocusScope {
13431341 y: stagedRightEdgeMaths.animatedY
13441342 z: stagedRightEdgeMaths.animatedZ
13451343 height: stagedRightEdgeMaths.animatedHeight
1346− requestedWidth: decoratedWindow.oldRequestedWidth
1347− requestedHeight: decoratedWindow.oldRequestedHeight
13481344 visible: appDelegate.x < root.width
13491345 }
13501346 PropertyChanges {
@@ -1374,8 +1370,6 @@ FocusScope {
13741370 y: windowedRightEdgeMaths.animatedY
13751371 z: windowedRightEdgeMaths.animatedZ
13761372 height: stagedRightEdgeMaths.animatedHeight
1377− requestedWidth: decoratedWindow.oldRequestedWidth
1378− requestedHeight: decoratedWindow.oldRequestedHeight
13791373 }
13801374 PropertyChanges {
13811375 target: decoratedWindow
@@ -1398,11 +1392,15 @@ FocusScope {
13981392 target: appDelegate
13991393 x: stageMaths.itemX
14001394 y: appDelegate.fullscreen ? 0 : panelState.panelHeight
1401− requestedWidth: appContainer.width
1402− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
14031395 visuallyMaximized: true
14041396 visible: appDelegate.x < root.width
14051397 }
1398+ PropertyChanges {
1399+ target: appDelegate
1400+ requestedWidth: appContainer.width
1401+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1402+ restoreEntryValues: false
1403+ }
14061404 PropertyChanges {
14071405 target: decoratedWindow
14081406 hasDecoration: false
@@ -1427,11 +1425,15 @@ FocusScope {
14271425 x: stageMaths.itemX
14281426 y: appDelegate.fullscreen ? 0 : panelState.panelHeight
14291427 z: stageMaths.itemZ
1430− requestedWidth: stageMaths.itemWidth
1431− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
14321428 visuallyMaximized: true
14331429 visible: appDelegate.x < root.width
14341430 }
1431+ PropertyChanges {
1432+ target: appDelegate
1433+ requestedWidth: stageMaths.itemWidth
1434+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1435+ restoreEntryValues: false
1436+ }
14351437 PropertyChanges {
14361438 target: decoratedWindow
14371439 hasDecoration: false
@@ -1449,8 +1451,12 @@ FocusScope {
14491451 requestedY: 0;
14501452 visuallyMinimized: false;
14511453 visuallyMaximized: true
1452− requestedWidth: appContainer.width - root.leftMargin;
1453− requestedHeight: appContainer.height;
1454+ }
1455+ PropertyChanges {
1456+ target: appDelegate
1457+ requestedWidth: appContainer.width - root.leftMargin
1458+ requestedHeight: appContainer.height
1459+ restoreEntryValues: false
14541460 }
14551461 PropertyChanges { target: touchControls; enabled: true }
14561462 },
@@ -1460,8 +1466,12 @@ FocusScope {
14601466 target: appDelegate;
14611467 requestedX: 0
14621468 requestedY: 0
1463− requestedWidth: appContainer.width;
1464− requestedHeight: appContainer.height;
1469+ }
1470+ PropertyChanges {
1471+ target: appDelegate
1472+ requestedWidth: appContainer.width
1473+ requestedHeight: appContainer.height
1474+ restoreEntryValues: false
14651475 }
14661476 PropertyChanges { target: decoratedWindow; hasDecoration: false }
14671477 },
@@ -1476,6 +1486,12 @@ FocusScope {
14761486 PropertyChanges { target: touchControls; enabled: true }
14771487 PropertyChanges { target: resizeArea; enabled: true }
14781488 PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1489+ PropertyChanges {
1490+ target: appDelegate
1491+ requestedWidth: windowedWidth
1492+ requestedHeight: windowedHeight
1493+ restoreEntryValues: false
1494+ }
14791495 },
14801496 State {
14811497 name: "restored";
@@ -1693,6 +1709,7 @@ FocusScope {
16931709 borderThickness: units.gu(2)
16941710 enabled: false
16951711 visible: enabled
1712+ readyToAssesBounds: !appDelegate._constructing
16961713
16971714 onPressed: {
16981715 appDelegate.activate();
@@ -1720,12 +1737,6 @@ FocusScope {
17201737 requestedWidth: appDelegate.requestedWidth
17211738 requestedHeight: appDelegate.requestedHeight
17221739
1723− property int oldRequestedWidth: -1
1724− property int oldRequestedHeight: -1
1725−
1726− onRequestedWidthChanged: oldRequestedWidth = requestedWidth
1727− onRequestedHeightChanged: oldRequestedHeight = requestedHeight
1728−
17291740 onCloseClicked: { appDelegate.close(); }
17301741 onMaximizeClicked: {
17311742 if (appDelegate.canBeMaximized) {
qml/Stage/WindowResizeArea.qml+27−4
@@ -36,35 +36,58 @@ MouseArea {
3636 property int minWidth: 0
3737 property int minHeight: 0
3838
39+ property bool readyToAssesBounds: false
40+ onReadyToAssesBoundsChanged: d.reassesBounds()
41+
3942 QtObject {
4043 id: d
4144
4245 readonly property int maxSafeInt: 2147483647
4346 readonly property int maxSizeIncrement: units.gu(40)
4447
48+ function reassesBounds() {
49+ if (!readyToAssesBounds) return;
50+
51+ if (target.windowedWidth < minimumWidth) {
52+ target.windowedWidth = minimumWidth;
53+ }
54+ if (target.windowedHeight < minimumHeight) {
55+ target.windowedHeight = minimumHeight;
56+ }
57+ if (target.windowedHeight < minimumHeight) {
58+ target.windowedHeight = minimumHeight;
59+ }
60+ if (target.windowedWidth > maximumWidth) {
61+ target.windowedWidth = maximumWidth;
62+ }
63+ if (target.windowedHeight > maximumHeight) {
64+ target.windowedHeight = maximumHeight;
65+ }
66+ }
67+
4568 readonly property int minimumWidth: root.target ? Math.max(root.minWidth, root.target.minimumWidth) : root.minWidth
4669 onMinimumWidthChanged: {
47− if (target.windowedWidth < minimumWidth) {
70+ if (readyToAssesBounds && target.windowedWidth < minimumWidth) {
4871 target.windowedWidth = minimumWidth;
4972 }
5073 }
5174 readonly property int minimumHeight: root.target ? Math.max(root.minHeight, root.target.minimumHeight) : root.minHeight
5275 onMinimumHeightChanged: {
53− if (target.windowedHeight < minimumHeight) {
76+ if (readyToAssesBounds && target.windowedHeight < minimumHeight) {
5477 target.windowedHeight = minimumHeight;
5578 }
5679 }
5780 readonly property int maximumWidth: root.target && root.target.maximumWidth >= minimumWidth && root.target.maximumWidth > 0
5881 ? root.target.maximumWidth : maxSafeInt
5982 onMaximumWidthChanged: {
60− if (target.windowedWidth > maximumWidth) {
83+ if (readyToAssesBounds && target.windowedWidth > maximumWidth) {
6184 target.windowedWidth = maximumWidth;
6285 }
6386 }
6487 readonly property int maximumHeight: root.target && root.target.maximumHeight >= minimumHeight && root.target.maximumHeight > 0
6588 ? root.target.maximumHeight : maxSafeInt
6689 onMaximumHeightChanged: {
67− if (target.windowedHeight > maximumHeight) {
90+ if (readyToAssesBounds && target.windowedHeight > maximumHeight) {
6891 target.windowedHeight = maximumHeight;
6992 }
7093 }
qml/Stage/WindowStateSaver.qml−2
@@ -48,8 +48,6 @@ QtObject {
4848 target.normalX = target.windowedX;
4949 target.normalY = target.windowedY;
5050
51− target.updateNormalGeometry();
52−
5351 // initialize the x/y to restore to
5452 target.restoredX = target.normalX;
5553 target.restoredY = target.normalY;