on xenial help sign in
progress -> absolute amount for the touch overlay push
6eab3edLukáš Tinkl
qml/Stages/DecoratedWindow.qml−9
@@ -63,15 +63,6 @@ FocusScope {
63 signal minimizeClicked()
63 signal minimizeClicked()
64 signal decorationPressed()
64 signal decorationPressed()
65
65
66− signal fakeMaximizeAnimationRequested(real progress)
67− signal fakeMaximizeLeftAnimationRequested(real progress)
68− signal fakeMaximizeRightAnimationRequested(real progress)
69− signal fakeMaximizeTopLeftAnimationRequested(real progress)
70− signal fakeMaximizeTopRightAnimationRequested(real progress)
71− signal fakeMaximizeBottomLeftAnimationRequested(real progress)
72− signal fakeMaximizeBottomRightAnimationRequested(real progress)
73− signal stopFakeAnimation()
74−
75 signal shouldCommitSnapWindow()
66 signal shouldCommitSnapWindow()
76
67
77 Rectangle {
68 Rectangle {
qml/Stages/DesktopStage.qml+8−17
@@ -748,15 +748,6 @@ AbstractStage {
748 onMinimizeClicked: appDelegate.minimize()
748 onMinimizeClicked: appDelegate.minimize()
749 onDecorationPressed: { appDelegate.focus = true; }
749 onDecorationPressed: { appDelegate.focus = true; }
750 onShouldCommitSnapWindow: fakeRectangle.commit();
750 onShouldCommitSnapWindow: fakeRectangle.commit();
751−
752− onFakeMaximizeAnimationRequested: if (!appDelegate.maximized) fakeRectangle.maximize(progress)
753− onFakeMaximizeLeftAnimationRequested: if (!appDelegate.maximizedLeft) fakeRectangle.maximizeLeft(progress)
754− onFakeMaximizeRightAnimationRequested: if (!appDelegate.maximizedRight) fakeRectangle.maximizeRight(progress)
755− onFakeMaximizeTopLeftAnimationRequested: if (!appDelegate.maximizedTopLeft) fakeRectangle.maximizeTopLeft(progress);
756− onFakeMaximizeTopRightAnimationRequested: if (!appDelegate.maximizedTopRight) fakeRectangle.maximizeTopRight(progress);
757− onFakeMaximizeBottomLeftAnimationRequested: if (!appDelegate.maximizedBottomLeft) fakeRectangle.maximizeBottomLeft(progress);
758− onFakeMaximizeBottomRightAnimationRequested: if (!appDelegate.maximizedBottomRight) fakeRectangle.maximizeBottomRight(progress);
759− onStopFakeAnimation: fakeRectangle.stop();
760 }
751 }
761
752
762 WindowControlsOverlay {
753 WindowControlsOverlay {
@@ -765,14 +756,14 @@ AbstractStage {
765 stageWidth: appContainer.width
756 stageWidth: appContainer.width
766 stageHeight: appContainer.height
757 stageHeight: appContainer.height
767
758
768− onFakeMaximizeAnimationRequested: decoratedWindow.fakeMaximizeAnimationRequested(progress)
759+ onFakeMaximizeAnimationRequested: if (!appDelegate.maximized) fakeRectangle.maximize(amount)
769− onFakeMaximizeLeftAnimationRequested: decoratedWindow.fakeMaximizeLeftAnimationRequested(progress)
760+ onFakeMaximizeLeftAnimationRequested: if (!appDelegate.maximizedLeft) fakeRectangle.maximizeLeft(amount)
770− onFakeMaximizeRightAnimationRequested: decoratedWindow.fakeMaximizeRightAnimationRequested(progress)
761+ onFakeMaximizeRightAnimationRequested: if (!appDelegate.maximizedRight) fakeRectangle.maximizeRight(amount)
771− onFakeMaximizeTopLeftAnimationRequested: decoratedWindow.fakeMaximizeTopLeftAnimationRequested(progress)
762+ onFakeMaximizeTopLeftAnimationRequested: if (!appDelegate.maximizedTopLeft) fakeRectangle.maximizeTopLeft(amount);
772− onFakeMaximizeTopRightAnimationRequested: decoratedWindow.fakeMaximizeTopRightAnimationRequested(progress)
763+ onFakeMaximizeTopRightAnimationRequested: if (!appDelegate.maximizedTopRight) fakeRectangle.maximizeTopRight(amount);
773− onFakeMaximizeBottomLeftAnimationRequested: decoratedWindow.fakeMaximizeBottomLeftAnimationRequested(progress)
764+ onFakeMaximizeBottomLeftAnimationRequested: if (!appDelegate.maximizedBottomLeft) fakeRectangle.maximizeBottomLeft(amount);
774− onFakeMaximizeBottomRightAnimationRequested: decoratedWindow.fakeMaximizeBottomRightAnimationRequested(progress)
765+ onFakeMaximizeBottomRightAnimationRequested: if (!appDelegate.maximizedBottomRight) fakeRectangle.maximizeBottomRight(amount);
775− onStopFakeAnimation: decoratedWindow.stopFakeAnimation()
766+ onStopFakeAnimation: fakeRectangle.stop();
776 onShouldCommitSnapWindow: fakeRectangle.commit();
767 onShouldCommitSnapWindow: fakeRectangle.commit();
777 }
768 }
778
769
qml/Stages/MoveHandler.qml+28−50
@@ -31,13 +31,13 @@ Item {
31
31
32 readonly property alias dragging: priv.dragging
32 readonly property alias dragging: priv.dragging
33
33
34− signal fakeMaximizeAnimationRequested(real progress)
34+ signal fakeMaximizeAnimationRequested(real amount)
35− signal fakeMaximizeLeftAnimationRequested(real progress)
35+ signal fakeMaximizeLeftAnimationRequested(real amount)
36− signal fakeMaximizeRightAnimationRequested(real progress)
36+ signal fakeMaximizeRightAnimationRequested(real amount)
37− signal fakeMaximizeTopLeftAnimationRequested(real progress)
37+ signal fakeMaximizeTopLeftAnimationRequested(real amount)
38− signal fakeMaximizeTopRightAnimationRequested(real progress)
38+ signal fakeMaximizeTopRightAnimationRequested(real amount)
39− signal fakeMaximizeBottomLeftAnimationRequested(real progress)
39+ signal fakeMaximizeBottomLeftAnimationRequested(real amount)
40− signal fakeMaximizeBottomRightAnimationRequested(real progress)
40+ signal fakeMaximizeBottomRightAnimationRequested(real amount)
41 signal stopFakeAnimation()
41 signal stopFakeAnimation()
42
42
43 signal shouldCommitSnapWindow()
43 signal shouldCommitSnapWindow()
@@ -118,47 +118,47 @@ Item {
118 target.requestedX = Math.round(pos.x - priv.distanceX);
118 target.requestedX = Math.round(pos.x - priv.distanceX);
119 target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
119 target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
120
120
121− if (sensingPoints) {
121+ if (sensingPoints) { // edge/corner detection when dragging via the touch overlay
122− print("!!! Detecting edges/corners in touch mode")
123 if (sensingPoints.topLeft.x < priv.triggerArea && sensingPoints.topLeft.y < PanelState.panelHeight
122 if (sensingPoints.topLeft.x < priv.triggerArea && sensingPoints.topLeft.y < PanelState.panelHeight
124 && target.canBeCornerMaximized) { // top left
123 && target.canBeCornerMaximized) { // top left
125− priv.progress = priv.progressInCorner(0, PanelState.panelHeight, sensingPoints.topLeft.x, sensingPoints.topLeft.y);
124+ priv.progress = priv.progressInCorner(0, PanelState.panelHeight, sensingPoints.topLeft.x, sensingPoints.topLeft.y) - priv.progress;
126 priv.resetEdges();
125 priv.resetEdges();
127 priv.nearTopLeftCorner = true;
126 priv.nearTopLeftCorner = true;
128− root.fakeMaximizeTopLeftAnimationRequested(priv.progress);
127+ root.fakeMaximizeTopLeftAnimationRequested(priv.progress * priv.triggerArea);
129 } else if (sensingPoints.topRight.x > stageWidth - priv.triggerArea && sensingPoints.topRight.y < PanelState.panelHeight
128 } else if (sensingPoints.topRight.x > stageWidth - priv.triggerArea && sensingPoints.topRight.y < PanelState.panelHeight
130 && target.canBeCornerMaximized) { // top right
129 && target.canBeCornerMaximized) { // top right
131− priv.progress = priv.progressInCorner(stageWidth, PanelState.panelHeight, sensingPoints.topRight.x, sensingPoints.topRight.y);
130+ priv.progress = priv.progressInCorner(stageWidth, PanelState.panelHeight, sensingPoints.topRight.x, sensingPoints.topRight.y) - priv.progress;
132 priv.resetEdges();
131 priv.resetEdges();
133 priv.nearTopRightCorner = true;
132 priv.nearTopRightCorner = true;
134− root.fakeMaximizeTopRightAnimationRequested(priv.progress);
133+ root.fakeMaximizeTopRightAnimationRequested(priv.progress * priv.triggerArea);
135 } else if (sensingPoints.bottomLeft.x < priv.triggerArea && sensingPoints.bottomLeft.y > stageHeight - priv.triggerArea
134 } else if (sensingPoints.bottomLeft.x < priv.triggerArea && sensingPoints.bottomLeft.y > stageHeight - priv.triggerArea
136 && target.canBeCornerMaximized) { // bottom left
135 && target.canBeCornerMaximized) { // bottom left
137− priv.progress = priv.progressInCorner(0, stageHeight, sensingPoints.bottomLeft.x, sensingPoints.bottomLeft.y);
136+ priv.progress = priv.progressInCorner(0, stageHeight, sensingPoints.bottomLeft.x, sensingPoints.bottomLeft.y) - priv.progress;
138 priv.resetEdges();
137 priv.resetEdges();
139 priv.nearBottomLeftCorner = true;
138 priv.nearBottomLeftCorner = true;
140− root.fakeMaximizeBottomLeftAnimationRequested(priv.progress);
139+ root.fakeMaximizeBottomLeftAnimationRequested(priv.progress * priv.triggerArea);
141 } else if (sensingPoints.bottomRight.x > stageWidth - priv.triggerArea && sensingPoints.bottomRight.y > stageHeight - priv.triggerArea
140 } else if (sensingPoints.bottomRight.x > stageWidth - priv.triggerArea && sensingPoints.bottomRight.y > stageHeight - priv.triggerArea
142 && target.canBeCornerMaximized) { // bottom right
141 && target.canBeCornerMaximized) { // bottom right
143− priv.progress = priv.progressInCorner(stageWidth, stageHeight, sensingPoints.bottomRight.x, sensingPoints.bottomRight.y);
142+ priv.progress = priv.progressInCorner(stageWidth, stageHeight, sensingPoints.bottomRight.x, sensingPoints.bottomRight.y) - priv.progress;
144 priv.resetEdges();
143 priv.resetEdges();
145 priv.nearBottomRightCorner = true;
144 priv.nearBottomRightCorner = true;
146− root.fakeMaximizeBottomRightAnimationRequested(priv.progress);
145+ root.fakeMaximizeBottomRightAnimationRequested(priv.progress * priv.triggerArea);
147 } else if (sensingPoints.left.x < priv.triggerArea && target.canBeMaximizedLeftRight) { // left
146 } else if (sensingPoints.left.x < priv.triggerArea && target.canBeMaximizedLeftRight) { // left
148− priv.progress = MathUtils.clampAndProject(sensingPoints.left.x, priv.triggerArea, 0, 0, 1);
147+ priv.progress = MathUtils.clampAndProject(sensingPoints.left.x, priv.triggerArea, 0, 0, 1) - priv.progress;
149 priv.resetEdges();
148 priv.resetEdges();
150 priv.nearLeftEdge = true;
149 priv.nearLeftEdge = true;
151− root.fakeMaximizeLeftAnimationRequested(priv.progress);
150+ root.fakeMaximizeLeftAnimationRequested(priv.progress * priv.triggerArea);
152 } else if (sensingPoints.right.x > stageWidth - priv.triggerArea && target.canBeMaximizedLeftRight) { // right
151 } else if (sensingPoints.right.x > stageWidth - priv.triggerArea && target.canBeMaximizedLeftRight) { // right
153− priv.progress = MathUtils.clampAndProject(sensingPoints.right.x, stageWidth - priv.triggerArea, stageWidth, 0, 1);
152+ priv.progress = MathUtils.clampAndProject(sensingPoints.right.x, stageWidth - priv.triggerArea, stageWidth, 0, 1) - priv.progress;
154 priv.resetEdges();
153 priv.resetEdges();
155 priv.nearRightEdge = true;
154 priv.nearRightEdge = true;
156− root.fakeMaximizeRightAnimationRequested(priv.progress);
155+ root.fakeMaximizeRightAnimationRequested(priv.progress * priv.triggerArea);
157 } else if (sensingPoints.top.y < PanelState.panelHeight && target.canBeMaximized) { // top
156 } else if (sensingPoints.top.y < PanelState.panelHeight && target.canBeMaximized) { // top
158− priv.progress = MathUtils.clampAndProject(sensingPoints.top.y, Math.max(PanelState.panelHeight, priv.triggerArea), 0, 0, 1);
157+ priv.progress = MathUtils.clampAndProject(sensingPoints.top.y, Math.max(PanelState.panelHeight, priv.triggerArea), 0, 0, 1) - priv.progress;
159 priv.resetEdges();
158 priv.resetEdges();
160 priv.nearTopEdge = true;
159 priv.nearTopEdge = true;
161− root.fakeMaximizeAnimationRequested(priv.progress);
160+ root.fakeMaximizeAnimationRequested(priv.progress * priv.triggerArea);
161+ priv.progress = tmpProgress;
162 } else if (priv.nearLeftEdge || priv.nearRightEdge || priv.nearTopEdge || priv.nearTopLeftCorner || priv.nearTopRightCorner ||
162 } else if (priv.nearLeftEdge || priv.nearRightEdge || priv.nearTopEdge || priv.nearTopLeftCorner || priv.nearTopRightCorner ||
163 priv.nearBottomLeftCorner || priv.nearBottomRightCorner) {
163 priv.nearBottomLeftCorner || priv.nearBottomRightCorner) {
164 print("!!! Exited")
164 print("!!! Exited")
@@ -172,33 +172,11 @@ Item {
172
172
173 function handleReleased(touchMode) {
173 function handleReleased(touchMode) {
174 if (touchMode) {
174 if (touchMode) {
175− if (priv.progress < 0.3) { // cancel the preview shape if under 30%
175+ root.shouldCommitSnapWindow();
176− priv.progress = 0;
176+ priv.progress = 0;
177− priv.resetEdges();
178− root.stopFakeAnimation();
179− } else if (priv.nearLeftEdge) {
180− target.maximizeLeft();
181− priv.resetEdges();
182− } else if (priv.nearTopEdge) {
183− target.maximize();
184− priv.resetEdges();
185− } else if (priv.nearRightEdge) {
186− target.maximizeRight();
187− priv.resetEdges();
188− } else if (priv.nearTopLeftCorner) {
189− target.maximizeTopLeft();
190− priv.resetEdges();
191− } else if (priv.nearTopRightCorner) {
192− target.maximizeTopRight();
193− priv.resetEdges();
194− } else if (priv.nearBottomLeftCorner) {
195− target.maximizeBottomLeft();
196− priv.resetEdges();
197− } else if (priv.nearBottomRightCorner) {
198− target.maximizeBottomRight();
199− priv.resetEdges();
177+ priv.resetEdges();
200− }
178+ }
201− } else if ((target.state == "normal" || target.state == "restored") && priv.progress == 0) {
179+ if ((target.state == "normal" || target.state == "restored") && priv.progress == 0) {
202 // save the x/y to restore to
180 // save the x/y to restore to
203 print("!!! Saving restoredX/Y")
181 print("!!! Saving restoredX/Y")
204 target.restoredX = target.x;
182 target.restoredX = target.x;
qml/Stages/WindowControlsOverlay.qml+8−8
@@ -34,13 +34,13 @@ Item {
34 readonly property alias overlayShown: overlay.visible
34 readonly property alias overlayShown: overlay.visible
35 readonly property alias moveHandler: moveHandler
35 readonly property alias moveHandler: moveHandler
36
36
37− signal fakeMaximizeAnimationRequested(real progress)
37+ signal fakeMaximizeAnimationRequested(real amount)
38− signal fakeMaximizeLeftAnimationRequested(real progress)
38+ signal fakeMaximizeLeftAnimationRequested(real amount)
39− signal fakeMaximizeRightAnimationRequested(real progress)
39+ signal fakeMaximizeRightAnimationRequested(real amount)
40− signal fakeMaximizeTopLeftAnimationRequested(real progress)
40+ signal fakeMaximizeTopLeftAnimationRequested(real amount)
41− signal fakeMaximizeTopRightAnimationRequested(real progress)
41+ signal fakeMaximizeTopRightAnimationRequested(real amount)
42− signal fakeMaximizeBottomLeftAnimationRequested(real progress)
42+ signal fakeMaximizeBottomLeftAnimationRequested(real amount)
43− signal fakeMaximizeBottomRightAnimationRequested(real progress)
43+ signal fakeMaximizeBottomRightAnimationRequested(real amount)
44 signal stopFakeAnimation()
44 signal stopFakeAnimation()
45 signal shouldCommitSnapWindow()
45 signal shouldCommitSnapWindow()
46
46
@@ -146,7 +146,6 @@ Item {
146 visible: overlay.visible
146 visible: overlay.visible
147 enabled: visible
147 enabled: visible
148 hoverEnabled: true
148 hoverEnabled: true
149− cursorShape: moveHandler.dragging ? Qt.ClosedHandCursor : (overlay.visible ? Qt.OpenHandCursor : Qt.ArrowCursor)
150
149
151 onPressedChanged: moveHandler.handlePressedChanged(pressed, pressedButtons, mouseX, mouseY)
150 onPressedChanged: moveHandler.handlePressedChanged(pressed, pressedButtons, mouseX, mouseY)
152 onPositionChanged: moveHandler.handlePositionChanged(mouse)
151 onPositionChanged: moveHandler.handlePositionChanged(mouse)
@@ -170,6 +169,7 @@ Item {
170 onFakeMaximizeBottomLeftAnimationRequested: root.fakeMaximizeBottomLeftAnimationRequested(progress)
169 onFakeMaximizeBottomLeftAnimationRequested: root.fakeMaximizeBottomLeftAnimationRequested(progress)
171 onFakeMaximizeBottomRightAnimationRequested: root.fakeMaximizeBottomRightAnimationRequested(progress)
170 onFakeMaximizeBottomRightAnimationRequested: root.fakeMaximizeBottomRightAnimationRequested(progress)
172 onStopFakeAnimation: root.stopFakeAnimation()
171 onStopFakeAnimation: root.stopFakeAnimation()
172+ onShouldCommitSnapWindow: root.shouldCommitSnapWindow();
173 }
173 }
174
174
175 // dismiss area
175 // dismiss area