on xenial help sign in
split the windowed geometry from the staged ones to have less collisions
commitea69283e93d326bdcc8f86ed6a7425e2baa7c330 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 12 Jul 2016, 12:04 (10 years ago) parent1bc3aa5
4 files changed+52−41
po/unity8.pot+1−1 qml/Stages/DesktopStage.qml+16−5 qml/Stages/WindowControlsOverlay.qml+2−2 qml/Stages/WindowResizeArea.qml+33−33
po/unity8.pot+1−1
@@ -8,7 +8,7 @@ msgid ""
88msgstr ""
99"Project-Id-Version: unity8\n"
1010"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2016-07-11 16:21+0200\n"
11+"POT-Creation-Date: 2016-07-12 11:45+0200\n"
1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414"Language-Team: LANGUAGE <LL@li.org>\n"
qml/Stages/DesktopStage.qml+16−5
@@ -424,6 +424,12 @@ AbstractStage {
424424 y: requestedY // may be overridden in some states. Do not directly write to this.
425425 property real requestedX: priv.focusedAppDelegate ? priv.focusedAppDelegate.x + units.gu(3) : (normalZ - 1) * units.gu(3)
426426 property real requestedY: priv.focusedAppDelegate ? priv.focusedAppDelegate.y + units.gu(3) : normalZ * units.gu(3)
427+ property int requestedWidth: -1
428+ property int requestedHeight: -1
429+ property int windowedX
430+ property int windowedY
431+ property int windowedWidth
432+ property int windowedHeight
427433
428434 Binding {
429435 target: appDelegate
@@ -470,9 +476,6 @@ AbstractStage {
470476 readonly property alias widthIncrement: decoratedWindow.widthIncrement
471477 readonly property alias heightIncrement: decoratedWindow.heightIncrement
472478
473− property int requestedWidth: -1
474− property int requestedHeight: -1
475−
476479 readonly property bool maximized: windowState & WindowStateStorage.WindowStateMaximized
477480 readonly property bool maximizedLeft: windowState & WindowStateStorage.WindowStateMaximizedLeft
478481 readonly property bool maximizedRight: windowState & WindowStateStorage.WindowStateMaximizedRight
@@ -827,7 +830,15 @@ AbstractStage {
827830 State {
828831 name: "normal";
829832 when: appDelegate.windowState == WindowStateStorage.WindowStateNormal
830− PropertyChanges { target: appDelegate; visuallyMinimized: false; visuallyMaximized: false; }
833+ PropertyChanges {
834+ target: appDelegate
835+ visuallyMinimized: false
836+ visuallyMaximized: false
837+ requestedX: appDelegate.windowedX
838+ requestedY: appDelegate.windowedY
839+ requestedWidth: appDelegate.windowedWidth
840+ requestedHeight: appDelegate.windowedHeight
841+ }
831842 PropertyChanges { target: touchControls; enabled: true }
832843 },
833844 State {
@@ -932,7 +943,7 @@ AbstractStage {
932943 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedWidth,requestedHeight"; duration: priv.animationDuration }
933944 },
934945 Transition {
935− to: "staged"
946+ from: "normal,spread"; to: "staged"
936947 UbuntuNumberAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
937948 UbuntuNumberAnimation { target: appDelegate; properties: "requestedWidth,requestedHeight"; duration: priv.animationDuration }
938949 },
qml/Stages/WindowControlsOverlay.qml+2−2
@@ -94,8 +94,8 @@ Item {
9494 function handlePositionChanged(mouseX, mouseY) {
9595 if (priv.dragging) {
9696 var pos = mapToItem(root.target.parent, mouseX, mouseY);
97− root.target.requestedX = Math.round(pos.x - priv.distanceX);
98− root.target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
97+ root.target.windowedX = Math.round(pos.x - priv.distanceX);
98+ root.target.windowedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
9999 }
100100 }
101101 }
qml/Stages/WindowResizeArea.qml+33−33
@@ -55,8 +55,8 @@ MouseArea {
5555
5656 function updateNormalGeometry() {
5757 if (root.target.state == "normal") {
58− normalX = root.target.requestedX
59− normalY = root.target.requestedY
58+ normalX = root.target.windowedX
59+ normalY = root.target.windowedY
6060 normalWidth = root.target.width
6161 normalHeight = root.target.height
6262 }
@@ -73,16 +73,16 @@ MouseArea {
7373
7474 function loadWindowState() {
7575 var windowGeometry = windowStateStorage.getGeometry(root.windowId,
76− Qt.rect(target.requestedX, target.requestedY, defaultWidth, defaultHeight));
76+ Qt.rect(target.windowedX, target.windowedY, defaultWidth, defaultHeight));
7777
7878
7979 print("loading Window state!", root.windowId, windowGeometry.width, windowGeometry.height)
80− target.requestedWidth = Qt.binding(function() { return Math.min(Math.max(windowGeometry.width, d.minimumWidth), screenWidth - root.leftMargin); });
81− target.requestedHeight = Qt.binding(function() { return Math.min(Math.max(windowGeometry.height, d.minimumHeight),
80+ target.windowedWidth = Qt.binding(function() { return Math.min(Math.max(windowGeometry.width, d.minimumWidth), screenWidth - root.leftMargin); });
81+ target.windowedHeight = Qt.binding(function() { return Math.min(Math.max(windowGeometry.height, d.minimumHeight),
8282 root.screenHeight - (target.fullscreen ? 0 : PanelState.panelHeight)); });
83− target.requestedX = Qt.binding(function() { return Math.max(Math.min(windowGeometry.x, root.screenWidth - root.leftMargin - target.requestedWidth),
83+ target.windowedX = Qt.binding(function() { return Math.max(Math.min(windowGeometry.x, root.screenWidth - root.leftMargin - target.windowedWidth),
8484 (target.fullscreen ? 0 : root.leftMargin)); });
85− target.requestedY = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight); });
85+ target.windowedY = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.windowedHeight), PanelState.panelHeight); });
8686
8787 var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal)
8888 switch (windowState) {
@@ -124,28 +124,28 @@ MouseArea {
124124
125125 readonly property int minimumWidth: root.target ? Math.max(root.minWidth, root.target.minimumWidth) : root.minWidth
126126 onMinimumWidthChanged: {
127− if (target.requestedWidth < minimumWidth) {
128− target.requestedWidth = minimumWidth;
127+ if (target.windowedWidth < minimumWidth) {
128+ target.windowedWidth = minimumWidth;
129129 }
130130 }
131131 readonly property int minimumHeight: root.target ? Math.max(root.minHeight, root.target.minimumHeight) : root.minHeight
132132 onMinimumHeightChanged: {
133− if (target.requestedHeight < minimumHeight) {
134− target.requestedHeight = minimumHeight;
133+ if (target.windowedHeight < minimumHeight) {
134+ target.windowedHeight = minimumHeight;
135135 }
136136 }
137137 readonly property int maximumWidth: root.target && root.target.maximumWidth >= minimumWidth && root.target.maximumWidth > 0
138138 ? root.target.maximumWidth : maxSafeInt
139139 onMaximumWidthChanged: {
140− if (target.requestedWidth > maximumWidth) {
141− target.requestedWidth = maximumWidth;
140+ if (target.windowedWidth > maximumWidth) {
141+ target.windowedWidth = maximumWidth;
142142 }
143143 }
144144 readonly property int maximumHeight: root.target && root.target.maximumHeight >= minimumHeight && root.target.maximumHeight > 0
145145 ? root.target.maximumHeight : maxSafeInt
146146 onMaximumHeightChanged: {
147− if (target.requestedHeight > maximumHeight) {
148− target.requestedHeight = maximumHeight;
147+ if (target.windowedHeight > maximumHeight) {
148+ target.windowedHeight = maximumHeight;
149149 }
150150 }
151151 readonly property int widthIncrement: {
@@ -260,8 +260,8 @@ MouseArea {
260260 var pos = mapToItem(root.target.parent, mouseX, mouseY);
261261 d.startMousePosX = pos.x;
262262 d.startMousePosY = pos.y;
263− d.startX = target.requestedX;
264− d.startY = target.requestedY;
263+ d.startX = target.windowedX;
264+ d.startY = target.windowedY;
265265 d.startWidth = target.width;
266266 d.startHeight = target.height;
267267 d.currentWidth = target.width;
@@ -298,53 +298,53 @@ MouseArea {
298298
299299 if (d.leftBorder) {
300300 var newTargetX = d.startX + deltaX;
301− var rightBorderX = target.requestedX + target.width;
301+ var rightBorderX = target.windowedX + target.width;
302302 if (rightBorderX > newTargetX + d.minimumWidth) {
303303 if (rightBorderX < newTargetX + d.maximumWidth) {
304− target.requestedWidth = rightBorderX - newTargetX;
304+ target.windowedWidth = rightBorderX - newTargetX;
305305 } else {
306− target.requestedWidth = d.maximumWidth;
306+ target.windowedWidth = d.maximumWidth;
307307 }
308308 } else {
309− target.requestedWidth = d.minimumWidth;
309+ target.windowedWidth = d.minimumWidth;
310310 }
311311
312312 } else if (d.rightBorder) {
313313 var newWidth = d.startWidth + deltaX;
314314 if (newWidth > d.minimumWidth) {
315315 if (newWidth < d.maximumWidth) {
316− target.requestedWidth = newWidth;
316+ target.windowedWidth = newWidth;
317317 } else {
318− target.requestedWidth = d.maximumWidth;
318+ target.windowedWidth = d.maximumWidth;
319319 }
320320 } else {
321− target.requestedWidth = d.minimumWidth;
321+ target.windowedWidth = d.minimumWidth;
322322 }
323323 }
324324
325325 if (d.topBorder) {
326326 var newTargetY = Math.max(d.startY + deltaY, PanelState.panelHeight); // disallow resizing up past Panel
327− var bottomBorderY = target.requestedY + target.height;
327+ var bottomBorderY = target.windowedY + target.height;
328328 if (bottomBorderY > newTargetY + d.minimumHeight) {
329329 if (bottomBorderY < newTargetY + d.maximumHeight) {
330− target.requestedHeight = bottomBorderY - newTargetY;
330+ target.windowedHeight = bottomBorderY - newTargetY;
331331 } else {
332− target.requestedHeight = d.maximumHeight;
332+ target.windowedHeight = d.maximumHeight;
333333 }
334334 } else {
335− target.requestedHeight = d.minimumHeight;
335+ target.windowedHeight = d.minimumHeight;
336336 }
337337
338338 } else if (d.bottomBorder) {
339339 var newHeight = d.startHeight + deltaY;
340340 if (newHeight > d.minimumHeight) {
341341 if (newHeight < d.maximumHeight) {
342− target.requestedHeight = newHeight;
342+ target.windowedHeight = newHeight;
343343 } else {
344− target.requestedHeight = d.maximumHeight;
344+ target.windowedHeight = d.maximumHeight;
345345 }
346346 } else {
347− target.requestedHeight = d.minimumHeight;
347+ target.windowedHeight = d.minimumHeight;
348348 }
349349 }
350350 }
@@ -353,13 +353,13 @@ MouseArea {
353353 target: root.target
354354 onWidthChanged: {
355355 if (d.moveLeftBorder) {
356− target.requestedX += d.currentWidth - target.width;
356+ target.windowedX += d.currentWidth - target.width;
357357 }
358358 d.currentWidth = target.width;
359359 }
360360 onHeightChanged: {
361361 if (d.moveTopBorder) {
362− target.requestedY += d.currentHeight - target.height;
362+ target.windowedY += d.currentHeight - target.height;
363363 }
364364 d.currentHeight = target.height;
365365 }