on xenial help sign in
also save the distanceY for restoring the window dragged back from a maximized state
commitf803c90cceb7a67510f5e469d36488d46e96fce1 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 31 Aug 2016, 15:00 (10 years ago) parentba4131f
2 files changed+4−2
qml/Stages/MoveHandler.qml+3−2 qml/Stages/WindowResizeArea.qml+1
qml/Stages/MoveHandler.qml+3−2
@@ -83,17 +83,18 @@ Item {
8383 }
8484
8585 function handlePressedChanged(pressed, pressedButtons, mouseX, mouseY) {
86− if (pressed && pressedButtons == Qt.LeftButton) {
86+ if (pressed && pressedButtons === Qt.LeftButton) {
8787 var pos = mapToItem(target, mouseX, mouseY);
8888 if (target.anyMaximized) {
8989 // keep distanceX relative to the normal window width minus the window control buttons (+spacing)
9090 // so that dragging it back doesn't make the window jump around to weird positions, away from the mouse pointer
9191 priv.distanceX = MathUtils.clampAndProject(pos.x, 0, target.width, buttonsWidth, target.resizeArea.normalWidth);
92+ priv.distanceY = MathUtils.clampAndProject(pos.y, 0, target.height, 0, target.resizeArea.normalHeight);
9293 } else {
9394 priv.distanceX = pos.x;
95+ priv.distanceY = pos.y;
9496 }
9597
96− priv.distanceY = pos.y;
9798 priv.dragging = true;
9899 } else {
99100 priv.dragging = false;
qml/Stages/WindowResizeArea.qml+1
@@ -31,6 +31,7 @@ MouseArea {
3131 property var windowStateStorage: WindowStateStorage
3232 readonly property alias dragging: d.dragging
3333 readonly property alias normalWidth: priv.normalWidth
34+ readonly property alias normalHeight: priv.normalHeight
3435
3536 // The target item managed by this. Must be a parent or a sibling
3637 // The area will anchor to it and manage resize events