on xenial help sign in
some more fixes to windowed mode (resizing etc)
948f3aeMichael Zanetti
qml/Stage/MoveHandler.qml+2−2
@@ -112,8 +112,8 @@ QtObject {
112 // Use integer coordinate values to ensure that target is left in a pixel-aligned
112 // Use integer coordinate values to ensure that target is left in a pixel-aligned
113 // position. Mouse movement could have subpixel precision, yielding a fractional
113 // position. Mouse movement could have subpixel precision, yielding a fractional
114 // mouse position.
114 // mouse position.
115− target.requestedX = Math.round(pos.x - priv.distanceX);
115+ target.windowedX = Math.round(pos.x - priv.distanceX);
116− target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
116+ target.windowedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
117
117
118 if (sensingPoints) { // edge/corner detection when dragging via the touch overlay
118 if (sensingPoints) { // edge/corner detection when dragging via the touch overlay
119 if (sensingPoints.topLeft.x < priv.triggerArea && sensingPoints.topLeft.y < PanelState.panelHeight + priv.triggerArea
119 if (sensingPoints.topLeft.x < priv.triggerArea && sensingPoints.topLeft.y < PanelState.panelHeight + priv.triggerArea
qml/Stage/Stage.qml+31−30
@@ -576,15 +576,15 @@ AbstractStage {
576 // Do not write to those, they will be set by states
576 // Do not write to those, they will be set by states
577 property real requestedX: windowedX
577 property real requestedX: windowedX
578 property real requestedY: windowedY
578 property real requestedY: windowedY
579− property int requestedWidth: windowedWidth
579+ property real requestedWidth: windowedWidth
580− property int requestedHeight: windowedHeight
580+ property real requestedHeight: windowedHeight
581
581
582 // In those are for windowed mode. Those values basically store the window's properties
582 // In those are for windowed mode. Those values basically store the window's properties
583 // when having a floating window. If you want to move/resize a window in normal mode, this is what you want to write to.
583 // when having a floating window. If you want to move/resize a window in normal mode, this is what you want to write to.
584− property int windowedX: priv.focusedAppDelegate ? priv.focusedAppDelegate.x + units.gu(3) : (normalZ - 1) * units.gu(3)
584+ property real windowedX: priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedX + units.gu(3) : (normalZ - 1) * units.gu(3)
585− property int windowedY: priv.focusedAppDelegate ? priv.focusedAppDelegate.y + units.gu(3) : normalZ * units.gu(3)
585+ property real windowedY: priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
586− property int windowedWidth
586+ property real windowedWidth
587− property int windowedHeight
587+ property real windowedHeight
588
588
589 Binding {
589 Binding {
590 target: appDelegate
590 target: appDelegate
@@ -1116,6 +1116,7 @@ AbstractStage {
1116 requestedWidth: appContainer.width - root.leftMargin;
1116 requestedWidth: appContainer.width - root.leftMargin;
1117 requestedHeight: appContainer.height;
1117 requestedHeight: appContainer.height;
1118 }
1118 }
1119+ PropertyChanges { target: touchControls; enabled: true }
1119 },
1120 },
1120 State {
1121 State {
1121 name: "fullscreen"; when: appDelegate.fullscreen && !appDelegate.minimized
1122 name: "fullscreen"; when: appDelegate.fullscreen && !appDelegate.minimized
@@ -1135,8 +1136,6 @@ AbstractStage {
1135 target: appDelegate
1136 target: appDelegate
1136 visuallyMinimized: false
1137 visuallyMinimized: false
1137 visuallyMaximized: false
1138 visuallyMaximized: false
1138− requestedWidth: appDelegate.windowedWidth
1139− requestedHeight: appDelegate.windowedHeight
1140 }
1139 }
1141 PropertyChanges { target: touchControls; enabled: true }
1140 PropertyChanges { target: touchControls; enabled: true }
1142 PropertyChanges { target: resizeArea; enabled: true }
1141 PropertyChanges { target: resizeArea; enabled: true }
@@ -1148,8 +1147,8 @@ AbstractStage {
1148 extend: "normal"
1147 extend: "normal"
1149 PropertyChanges {
1148 PropertyChanges {
1150 target: appDelegate;
1149 target: appDelegate;
1151− requestedX: restoredX;
1150+ windowedX: restoredX;
1152− requestedY: restoredY;
1151+ windowedY: restoredY;
1153 }
1152 }
1154 },
1153 },
1155 State {
1154 State {
@@ -1163,10 +1162,10 @@ AbstractStage {
1163 extend: "semiMaximized"
1162 extend: "semiMaximized"
1164 PropertyChanges {
1163 PropertyChanges {
1165 target: appDelegate
1164 target: appDelegate
1166− requestedX: root.leftMargin
1165+ windowedX: root.leftMargin
1167− requestedY: PanelState.panelHeight
1166+ windowedY: PanelState.panelHeight
1168− requestedWidth: (appContainer.width - root.leftMargin)/2
1167+ windowedWidth: (appContainer.width - root.leftMargin)/2
1169− requestedHeight: appContainer.height - PanelState.panelHeight
1168+ windowedHeight: appContainer.height - PanelState.panelHeight
1170 }
1169 }
1171 },
1170 },
1172 State {
1171 State {
@@ -1174,7 +1173,7 @@ AbstractStage {
1174 extend: "maximizedLeft"
1173 extend: "maximizedLeft"
1175 PropertyChanges {
1174 PropertyChanges {
1176 target: appDelegate;
1175 target: appDelegate;
1177− requestedX: (appContainer.width + root.leftMargin)/2
1176+ windowedX: (appContainer.width + root.leftMargin)/2
1178 }
1177 }
1179 },
1178 },
1180 State {
1179 State {
@@ -1182,10 +1181,10 @@ AbstractStage {
1182 extend: "semiMaximized"
1181 extend: "semiMaximized"
1183 PropertyChanges {
1182 PropertyChanges {
1184 target: appDelegate
1183 target: appDelegate
1185− requestedX: root.leftMargin
1184+ windowedX: root.leftMargin
1186− requestedY: PanelState.panelHeight
1185+ windowedY: PanelState.panelHeight
1187− requestedWidth: (appContainer.width - root.leftMargin)/2
1186+ windowedWidth: (appContainer.width - root.leftMargin)/2
1188− requestedHeight: (appContainer.height - PanelState.panelHeight)/2
1187+ windowedHeight: (appContainer.height - PanelState.panelHeight)/2
1189 }
1188 }
1190 },
1189 },
1191 State {
1190 State {
@@ -1193,7 +1192,7 @@ AbstractStage {
1193 extend: "maximizedTopLeft"
1192 extend: "maximizedTopLeft"
1194 PropertyChanges {
1193 PropertyChanges {
1195 target: appDelegate
1194 target: appDelegate
1196− requestedX: (appContainer.width + root.leftMargin)/2
1195+ windowedX: (appContainer.width + root.leftMargin)/2
1197 }
1196 }
1198 },
1197 },
1199 State {
1198 State {
@@ -1201,10 +1200,10 @@ AbstractStage {
1201 extend: "semiMaximized"
1200 extend: "semiMaximized"
1202 PropertyChanges {
1201 PropertyChanges {
1203 target: appDelegate
1202 target: appDelegate
1204− requestedX: root.leftMargin
1203+ windowedX: root.leftMargin
1205− requestedY: (appContainer.height + PanelState.panelHeight)/2
1204+ windowedY: (appContainer.height + PanelState.panelHeight)/2
1206− requestedWidth: (appContainer.width - root.leftMargin)/2
1205+ windowedWidth: (appContainer.width - root.leftMargin)/2
1207− requestedHeight: appContainer.height/2
1206+ windowedHeight: appContainer.height/2
1208 }
1207 }
1209 },
1208 },
1210 State {
1209 State {
@@ -1212,19 +1211,19 @@ AbstractStage {
1212 extend: "maximizedBottomLeft"
1211 extend: "maximizedBottomLeft"
1213 PropertyChanges {
1212 PropertyChanges {
1214 target: appDelegate
1213 target: appDelegate
1215− requestedX: (appContainer.width + root.leftMargin)/2
1214+ windowedX: (appContainer.width + root.leftMargin)/2
1216 }
1215 }
1217 },
1216 },
1218 State {
1217 State {
1219 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
1218 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
1220 extend: "semiMaximized"
1219 extend: "semiMaximized"
1221− PropertyChanges { target: appDelegate; requestedX: root.leftMargin; requestedY: requestedY;
1220+ PropertyChanges { target: appDelegate; requestedX: root.leftMargin; requestedY: windowedY;
1222 requestedWidth: appContainer.width - root.leftMargin; requestedHeight: appDelegate.windowedHeight }
1221 requestedWidth: appContainer.width - root.leftMargin; requestedHeight: appDelegate.windowedHeight }
1223 },
1222 },
1224 State {
1223 State {
1225 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1224 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1226 extend: "semiMaximized"
1225 extend: "semiMaximized"
1227− PropertyChanges { target: appDelegate; requestedX: requestedX; requestedY: PanelState.panelHeight;
1226+ PropertyChanges { target: appDelegate; requestedX: windowedX; requestedY: PanelState.panelHeight;
1228 requestedWidth: appDelegate.windowedWidth; requestedHeight: appContainer.height - PanelState.panelHeight }
1227 requestedWidth: appDelegate.windowedWidth; requestedHeight: appContainer.height - PanelState.panelHeight }
1229 },
1228 },
1230 State {
1229 State {
@@ -1256,7 +1255,8 @@ AbstractStage {
1256 to: "normal,restored"
1255 to: "normal,restored"
1257 enabled: appDelegate.animationsEnabled
1256 enabled: appDelegate.animationsEnabled
1258 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
1257 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
1259− UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,restoredX,restoredY,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
1258+ UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,windowedX,windowedY,requestedWidth,requestedHeight,windowedWidth,windowedHeight,scale";
1259+ duration: priv.animationDuration }
1260 },
1260 },
1261 Transition {
1261 Transition {
1262 to: "minimized"
1262 to: "minimized"
@@ -1322,11 +1322,12 @@ AbstractStage {
1322 }
1322 }
1323 },
1323 },
1324 Transition {
1324 Transition {
1325− to: "maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1325+ to: "normal,maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1326 enabled: appDelegate.animationsEnabled
1326 enabled: appDelegate.animationsEnabled
1327 SequentialAnimation {
1327 SequentialAnimation {
1328 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1328 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1329− UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight"; duration: priv.animationDuration }
1329+ UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,windowedX,windowedY,opacity,scale,requestedWidth,requestedHeight,windowedWidth,windowedHeight";
1330+ duration: priv.animationDuration }
1330 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1331 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1331 ScriptAction { script: { fakeRectangle.stop(); } }
1332 ScriptAction { script: { fakeRectangle.stop(); } }
1332 }
1333 }
tests/qmltests/CMakeLists.txt+1−1
@@ -92,7 +92,7 @@ add_unity8_qmltest(Stages PhoneStage)
92add_unity8_qmltest(Stages SpreadDelegate)
92add_unity8_qmltest(Stages SpreadDelegate)
93add_unity8_qmltest(Stages SurfaceContainer)
93add_unity8_qmltest(Stages SurfaceContainer)
94add_unity8_qmltest(Stages TabletStage)
94add_unity8_qmltest(Stages TabletStage)
95−add_unity8_qmltest(Stages WindowResizeArea)
95+add_unity8_qmltest(Stage WindowResizeArea)
96add_unity8_qmltest(Stage Splash)
96add_unity8_qmltest(Stage Splash)
97add_unity8_qmltest(Stage DecoratedWindow)
97add_unity8_qmltest(Stage DecoratedWindow)
98add_unity8_qmltest(Tutorial Tutorial)
98add_unity8_qmltest(Tutorial Tutorial)
tests/qmltests/Stage/tst_WindowResizeArea.qml+10−6
@@ -20,7 +20,7 @@ import QtTest 1.0
20import Unity.Test 0.1
20import Unity.Test 0.1
21import ".."
21import ".."
22import "../../../qml/Components/PanelState"
22import "../../../qml/Components/PanelState"
23−import "../../../qml/Stages"
23+import "../../../qml/Stage"
24import Ubuntu.Components 1.3
24import Ubuntu.Components 1.3
25import Ubuntu.Components.ListItems 1.3 as ListItem
25import Ubuntu.Components.ListItems 1.3 as ListItem
26import Unity.Application 0.1
26import Unity.Application 0.1
@@ -34,7 +34,7 @@ Item {
34 Binding {
34 Binding {
35 target: PanelState
35 target: PanelState
36 property: "panelHeight"
36 property: "panelHeight"
37− value: units.gu(2)
37+ value: units.gu(3)
38 }
38 }
39
39
40 Component {
40 Component {
@@ -46,12 +46,16 @@ Item {
46 property alias resizeAreaMinHeight: windowResizeArea.minHeight
46 property alias resizeAreaMinHeight: windowResizeArea.minHeight
47 x: requestedX
47 x: requestedX
48 y: requestedY
48 y: requestedY
49− property real requestedX: units.gu(20)
49+ property real requestedX: windowedX
50− property real requestedY: units.gu(20)
50+ property real requestedY: windowedY
51 width: requestedWidth
51 width: requestedWidth
52 height: requestedHeight
52 height: requestedHeight
53− property real requestedWidth
53+ property real requestedWidth: windowedWidth
54− property real requestedHeight
54+ property real requestedHeight: windowedHeight
55+ property real windowedX: units.gu(20)
56+ property real windowedY: units.gu(20)
57+ property real windowedWidth
58+ property real windowedHeight
55 property real minimumWidth: 0
59 property real minimumWidth: 0
56 property real minimumHeight: 0
60 property real minimumHeight: 0
57 property real maximumWidth: 0
61 property real maximumWidth: 0