on xenial help sign in
WIP: MousePointer based edge push
5015805Lukáš Tinkl
plugins/Cursor/MousePointer.cpp+5
@@ -73,6 +73,8 @@ void MousePointer::handleMouseEvent(ulong timestamp, QPointF movement, Qt::Mouse
73 Q_EMIT pushedRightBoundary(newX - (sceneWidth - 1), buttons);
73 Q_EMIT pushedRightBoundary(newX - (sceneWidth - 1), buttons);
74 } else if (newY < m_panelHeight) { // top edge
74 } else if (newY < m_panelHeight) { // top edge
75 Q_EMIT pushedTopBoundary(qAbs(newY), buttons);
75 Q_EMIT pushedTopBoundary(qAbs(newY), buttons);
76+ } else if (Q_LIKELY(newX >= 0 && newX < sceneWidth && newY >= 0 && newY < sceneHeight)) { // normal pos, not pushing
77+ Q_EMIT pushStopped();
76 }
78 }
77
79
78 setX(qBound(0.0, newX, sceneWidth - 1));
80 setX(qBound(0.0, newX, sceneWidth - 1));
@@ -98,6 +100,9 @@ void MousePointer::itemChange(ItemChange change, const ItemChangeData &value)
98{
100{
99 if (change == ItemSceneChange) {
101 if (change == ItemSceneChange) {
100 registerWindow(value.window);
102 registerWindow(value.window);
103+ if (value.window) {
104+ m_panelHeight = QQmlProperty::read(this, "panelHeight").toInt(); // when we move e.g. to a different screen (with possible different DGU)
105+ }
101 }
106 }
102}
107}
103
108
plugins/Cursor/MousePointer.h+1
@@ -51,6 +51,7 @@ Q_SIGNALS:
51 void pushedTopRightCorner(qreal amount, Qt::MouseButtons buttons);
51 void pushedTopRightCorner(qreal amount, Qt::MouseButtons buttons);
52 void pushedBottomLeftCorner(qreal amount, Qt::MouseButtons buttons);
52 void pushedBottomLeftCorner(qreal amount, Qt::MouseButtons buttons);
53 void pushedBottomRightCorner(qreal amount, Qt::MouseButtons buttons);
53 void pushedBottomRightCorner(qreal amount, Qt::MouseButtons buttons);
54+ void pushStopped();
54 void mouseMoved();
55 void mouseMoved();
55
56
56protected:
57protected:
qml/Shell.qml+31−7
@@ -778,35 +778,59 @@ StyledItem {
778
778
779 height: units.gu(3)
779 height: units.gu(3)
780
780
781+ readonly property var previewRectangle: applicationsDisplayLoader.item && applicationsDisplayLoader.item.previewRectangle &&
782+ applicationsDisplayLoader.item.previewRectangle.targetDragging ?
783+ applicationsDisplayLoader.item.previewRectangle : null
784+
781 onPushedLeftBoundary: {
785 onPushedLeftBoundary: {
782− print("!!! Left edge:", amount, buttons)
783 if (buttons === Qt.NoButton) {
786 if (buttons === Qt.NoButton) {
784 launcher.pushEdge(amount);
787 launcher.pushEdge(amount);
788+ } else if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeMaximizedLeftRight) {
789+ previewRectangle.maximizeLeft(amount);
785 }
790 }
786 }
791 }
787
792
788 onPushedRightBoundary: {
793 onPushedRightBoundary: {
789− print("!!! Right edge:", amount, buttons)
790 if (buttons === Qt.NoButton && applicationsDisplayLoader.item
794 if (buttons === Qt.NoButton && applicationsDisplayLoader.item
791 && applicationsDisplayLoader.item.pushRightEdge) {
795 && applicationsDisplayLoader.item.pushRightEdge) {
792 applicationsDisplayLoader.item.pushRightEdge(amount);
796 applicationsDisplayLoader.item.pushRightEdge(amount);
797+ } else if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeMaximizedLeftRight) {
798+ previewRectangle.maximizeRight(amount);
793 }
799 }
794 }
800 }
795
801
796 onPushedTopBoundary: {
802 onPushedTopBoundary: {
797− print("!!! Top edge:", amount, buttons)
803+ if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeMaximized) {
804+ previewRectangle.maximize(amount);
805+ }
798 }
806 }
799 onPushedTopLeftCorner: {
807 onPushedTopLeftCorner: {
800− print("!!! Top left corner:", amount, buttons)
808+ if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeCornerMaximized) {
809+ previewRectangle.maximizeTopLeft(amount);
810+ }
801 }
811 }
802 onPushedTopRightCorner: {
812 onPushedTopRightCorner: {
803− print("!!! Top right corner:", amount, buttons)
813+ if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeCornerMaximized) {
814+ previewRectangle.maximizeTopRight(amount);
815+ }
804 }
816 }
805 onPushedBottomLeftCorner: {
817 onPushedBottomLeftCorner: {
806− print("!!! Bottom left corner:", amount, buttons)
818+ if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeCornerMaximized) {
819+ previewRectangle.maximizeBottomLeft(amount);
820+ }
807 }
821 }
808 onPushedBottomRightCorner: {
822 onPushedBottomRightCorner: {
809− print("!!! Bottom right corner:", amount, buttons)
823+ if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeCornerMaximized) {
824+ previewRectangle.maximizeBottomRight(amount);
825+ }
826+ }
827+ onPushStopped: {
828+ if (previewRectangle) {
829+ if (previewRectangle.progress > 0 && previewRectangle.progress < 0.1) {
830+ print("!!! Stopping at", previewRectangle.progress)
831+ previewRectangle.stop();
832+ }
833+ }
810 }
834 }
811
835
812 onMouseMoved: {
836 onMouseMoved: {
qml/Stages/DecoratedWindow.qml+7−1
@@ -72,6 +72,8 @@ FocusScope {
72 signal fakeMaximizeBottomRightAnimationRequested(real progress)
72 signal fakeMaximizeBottomRightAnimationRequested(real progress)
73 signal stopFakeAnimation()
73 signal stopFakeAnimation()
74
74
75+ signal shouldCommitSnapWindow()
76+
75 Rectangle {
77 Rectangle {
76 id: selectionHighlight
78 id: selectionHighlight
77 anchors.fill: parent
79 anchors.fill: parent
@@ -116,7 +118,11 @@ FocusScope {
116
118
117 onPressedChanged: moveHandler.handlePressedChanged(pressed, pressedButtons, mouseX, mouseY)
119 onPressedChanged: moveHandler.handlePressedChanged(pressed, pressedButtons, mouseX, mouseY)
118 onPositionChanged: moveHandler.handlePositionChanged(mouse)
120 onPositionChanged: moveHandler.handlePositionChanged(mouse)
121+ onReleased: {
122+ print("!!! Mouse released on decoration")
123+ root.shouldCommitSnapWindow();
119− onReleased: moveHandler.handleReleased(mouse)
124+ moveHandler.handleReleased(mouse);
125+ }
120 }
126 }
121
127
122 MoveHandler {
128 MoveHandler {
qml/Stages/DesktopStage.qml+5−1
@@ -45,6 +45,9 @@ AbstractStage {
45 // Used by TutorialRight
45 // Used by TutorialRight
46 property bool spreadShown: spread.state == "altTab"
46 property bool spreadShown: spread.state == "altTab"
47
47
48+ // used by the snap windows (edge maximize) feature
49+ readonly property alias previewRectangle: fakeRectangle
50+
48 mainApp: priv.focusedAppDelegate ? priv.focusedAppDelegate.application : null
51 mainApp: priv.focusedAppDelegate ? priv.focusedAppDelegate.application : null
49
52
50 // application windows never rotate independently
53 // application windows never rotate independently
@@ -662,9 +665,9 @@ AbstractStage {
662 enabled: appDelegate.animationsEnabled
665 enabled: appDelegate.animationsEnabled
663 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
666 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
664 SequentialAnimation {
667 SequentialAnimation {
665− ScriptAction { script: { fakeRectangle.stop(); } }
666 UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight" }
668 UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight" }
667 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
669 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
670+ ScriptAction { script: { fakeRectangle.stop(); } }
668 }
671 }
669 }
672 }
670 ]
673 ]
@@ -744,6 +747,7 @@ AbstractStage {
744 onMaximizeVerticallyClicked: appDelegate.maximizedVertically ? appDelegate.restoreFromMaximized() : appDelegate.maximizeVertically()
747 onMaximizeVerticallyClicked: appDelegate.maximizedVertically ? appDelegate.restoreFromMaximized() : appDelegate.maximizeVertically()
745 onMinimizeClicked: appDelegate.minimize()
748 onMinimizeClicked: appDelegate.minimize()
746 onDecorationPressed: { appDelegate.focus = true; }
749 onDecorationPressed: { appDelegate.focus = true; }
750+ onShouldCommitSnapWindow: fakeRectangle.commit();
747
751
748 onFakeMaximizeAnimationRequested: if (!appDelegate.maximized) fakeRectangle.maximize(progress)
752 onFakeMaximizeAnimationRequested: if (!appDelegate.maximized) fakeRectangle.maximize(progress)
749 onFakeMaximizeLeftAnimationRequested: if (!appDelegate.maximizedLeft) fakeRectangle.maximizeLeft(progress)
753 onFakeMaximizeLeftAnimationRequested: if (!appDelegate.maximizedLeft) fakeRectangle.maximizeLeft(progress)
qml/Stages/FakeMaximizeDelegate.qml+82−26
@@ -16,11 +16,12 @@
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18import Ubuntu.Components 1.3
18import Ubuntu.Components 1.3
19+import Utils 0.1 // For EdgeBarrierSettings
19import "../Components/PanelState"
20import "../Components/PanelState"
20
21
21Rectangle {
22Rectangle {
22 id: fakeRectangle
23 id: fakeRectangle
23− visible: opacity > 0 // we go from 0.2 to 0.6
24+ visible: opacity > 0 && target && !target.anyMaximized // we go from 0.2 to 0.6
24 enabled: visible
25 enabled: visible
25 color: "#ffffff"
26 color: "#ffffff"
26 border.width: units.dp(1)
27 border.width: units.dp(1)
@@ -33,12 +34,43 @@ Rectangle {
33 property real appContainerWidth
34 property real appContainerWidth
34 property real appContainerHeight
35 property real appContainerHeight
35
36
37+ readonly property bool targetDragging: target && target.moveHandler.dragging
38+
39+ // Edge push progress
40+ // Value range is [0.0, 1.0]
41+ readonly property real progress: Math.min(Math.max(0.0, priv.accumulatedPush / EdgeBarrierSettings.pushThreshold), 1.0)
42+ onProgressChanged: {
43+ print("!!! Progress:", progress)
44+ }
45+
36 QtObject {
46 QtObject {
37 id: priv
47 id: priv
38
48
39− property real progress: 0
49+ property real accumulatedPush: 0
50+
51+ function push(amount) {
52+ if (accumulatedPush === EdgeBarrierSettings.pushThreshold) {
53+ // NO-OP
54+ print("!!! Accumulated push already at threshold")
55+ return;
56+ }
57+
58+ if (accumulatedPush + amount > EdgeBarrierSettings.pushThreshold) {
59+ accumulatedPush = EdgeBarrierSettings.pushThreshold;
60+ } else {
61+ accumulatedPush += amount;
62+ }
63+
64+ if (accumulatedPush === EdgeBarrierSettings.pushThreshold) {
65+ print("!!! Reached push progress 1, maximizing")
66+ commit();
67+ }
68+ }
40
69
41 function setup(edge) {
70 function setup(edge) {
71+ if (edge !== fakeRectangle.edge) {
72+ stop(); // a different edge, start anew
73+ }
42 fakeRectangle.x = target.x;
74 fakeRectangle.x = target.x;
43 fakeRectangle.y = target.y;
75 fakeRectangle.y = target.y;
44 fakeRectangle.width = target.width;
76 fakeRectangle.width = target.width;
@@ -47,25 +79,49 @@ Rectangle {
47 fakeRectangle.transformOrigin = edge;
79 fakeRectangle.transformOrigin = edge;
48 }
80 }
49
81
50− function projectOpacity(progress) {
82+ function projectOpacity() {
51 // progress falls into [0,1], opacity moves in [0.2,0.6]
83 // progress falls into [0,1], opacity moves in [0.2,0.6]
52 fakeRectangle.opacity = MathUtils.clampAndProject(progress, 0.0, 1.0, 0.2, 0.6);
84 fakeRectangle.opacity = MathUtils.clampAndProject(progress, 0.0, 1.0, 0.2, 0.6);
53 }
85 }
54
86
55− function projectScale(progress) {
87+ function projectScale() {
56− // progress falls into [0,1], scale moves in [1,2] as a hint, when under 30%
88+ // progress falls into [0,1], scale moves in [1,2] as a hint, when under 10%
57 fakeRectangle.scale = MathUtils.clampAndProject(progress, 0, 1, 1, 2);
89 fakeRectangle.scale = MathUtils.clampAndProject(progress, 0, 1, 1, 2);
58 }
90 }
59
91
60− function processAnimation(progress, animation) {
92+ function processAnimation(amount, animation) {
61− if (priv.progress >= 0.3) {
93+ priv.push(amount);
94+
95+ if (progress > 0.1) { // above 10% we start the full preview animation
62 fakeRectangle.scale = 1;
96 fakeRectangle.scale = 1;
63 animation.start();
97 animation.start();
64− } else if (progress > priv.progress) {
98+ } else {
65− priv.progress += progress;
66− priv.projectScale(progress);
99+ priv.projectScale();
100+ }
101+
102+ priv.projectOpacity();
103+ }
104+ }
105+
106+ function commit() {
107+ if (progress > 0.1 && edge != -1) {
108+ print("!!! Committing edge", edge, ", progress:", progress);
109+ target.moveHandler.handlePressedChanged(false, Qt.LeftButton, 0, 0); // cancel the drag
110+ if (edge == Item.Top) {
111+ target.maximize();
112+ } else if (edge == Item.Left) {
113+ target.maximizeLeft();
114+ } else if (edge == Item.Right) {
115+ target.maximizeRight();
116+ } else if (edge == Item.TopLeft) {
117+ target.maximizeTopLeft();
118+ } else if (edge == Item.TopRight) {
119+ target.maximizeTopRight();
120+ } else if (edge == Item.BottomLeft) {
121+ target.maximizeBottomLeft();
122+ } else if (edge == Item.BottomRight) {
123+ target.maximizeBottomRight();
67 }
124 }
68− priv.projectOpacity(progress);
69 }
125 }
70 }
126 }
71
127
@@ -73,56 +129,56 @@ Rectangle {
73 print("!!! Stop")
129 print("!!! Stop")
74 opacity = 0;
130 opacity = 0;
75 edge = -1;
131 edge = -1;
76− priv.progress = 0;
132+ priv.accumulatedPush = 0;
77 }
133 }
78
134
79− function maximize(progress) {
135+ function maximize(amount) {
80 if (fakeRectangle.edge != Item.Top) {
136 if (fakeRectangle.edge != Item.Top) {
81 priv.setup(Item.Top);
137 priv.setup(Item.Top);
82 }
138 }
83− priv.processAnimation(progress, fakeMaximizeAnimation);
139+ priv.processAnimation(amount, fakeMaximizeAnimation);
84 }
140 }
85
141
86− function maximizeLeft(progress) {
142+ function maximizeLeft(amount) {
87 if (fakeRectangle.edge != Item.Left) {
143 if (fakeRectangle.edge != Item.Left) {
88 priv.setup(Item.Left);
144 priv.setup(Item.Left);
89 }
145 }
90− priv.processAnimation(progress, fakeMaximizeLeftAnimation);
146+ priv.processAnimation(amount, fakeMaximizeLeftAnimation);
91 }
147 }
92
148
93− function maximizeRight(progress) {
149+ function maximizeRight(amount) {
94 if (fakeRectangle.edge != Item.Right) {
150 if (fakeRectangle.edge != Item.Right) {
95 priv.setup(Item.Right);
151 priv.setup(Item.Right);
96 }
152 }
97− priv.processAnimation(progress, fakeMaximizeRightAnimation);
153+ priv.processAnimation(amount, fakeMaximizeRightAnimation);
98 }
154 }
99
155
100− function maximizeTopLeft(progress) {
156+ function maximizeTopLeft(amount) {
101 if (fakeRectangle.edge != Item.TopLeft) {
157 if (fakeRectangle.edge != Item.TopLeft) {
102 priv.setup(Item.TopLeft);
158 priv.setup(Item.TopLeft);
103 }
159 }
104− priv.processAnimation(progress, fakeMaximizeTopLeftAnimation);
160+ priv.processAnimation(amount, fakeMaximizeTopLeftAnimation);
105 }
161 }
106
162
107− function maximizeTopRight(progress) {
163+ function maximizeTopRight(amount) {
108 if (fakeRectangle.edge != Item.TopRight) {
164 if (fakeRectangle.edge != Item.TopRight) {
109 priv.setup(Item.TopRight);
165 priv.setup(Item.TopRight);
110 }
166 }
111− priv.processAnimation(progress, fakeMaximizeTopRightAnimation);
167+ priv.processAnimation(amount, fakeMaximizeTopRightAnimation);
112 }
168 }
113
169
114− function maximizeBottomLeft(progress) {
170+ function maximizeBottomLeft(amount) {
115 if (fakeRectangle.edge != Item.BottomLeft) {
171 if (fakeRectangle.edge != Item.BottomLeft) {
116 priv.setup(Item.BottomLeft);
172 priv.setup(Item.BottomLeft);
117 }
173 }
118− priv.processAnimation(progress, fakeMaximizeBottomLeftAnimation);
174+ priv.processAnimation(amount, fakeMaximizeBottomLeftAnimation);
119 }
175 }
120
176
121− function maximizeBottomRight(progress) {
177+ function maximizeBottomRight(amount) {
122 if (fakeRectangle.edge != Item.BottomRight) {
178 if (fakeRectangle.edge != Item.BottomRight) {
123 priv.setup(Item.BottomRight);
179 priv.setup(Item.BottomRight);
124 }
180 }
125− priv.processAnimation(progress, fakeMaximizeBottomRightAnimation);
181+ priv.processAnimation(amount, fakeMaximizeBottomRightAnimation);
126 }
182 }
127
183
128 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
184 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
qml/Stages/MoveHandler.qml+64−63
@@ -29,7 +29,7 @@ Item {
29 property int stageHeight
29 property int stageHeight
30 property real buttonsWidth: 0
30 property real buttonsWidth: 0
31
31
32− readonly property alias dragging: priv.dragging
32+ property alias dragging: priv.dragging
33
33
34 signal fakeMaximizeAnimationRequested(real progress)
34 signal fakeMaximizeAnimationRequested(real progress)
35 signal fakeMaximizeLeftAnimationRequested(real progress)
35 signal fakeMaximizeLeftAnimationRequested(real progress)
@@ -104,6 +104,7 @@ Item {
104 Mir.cursorName = "grabbing";
104 Mir.cursorName = "grabbing";
105
105
106 if (target.anyMaximized) { // restore from maximized when dragging away from edges/corners
106 if (target.anyMaximized) { // restore from maximized when dragging away from edges/corners
107+ print("!!! Restoring maximized window after a drag away")
107 priv.progress = 0;
108 priv.progress = 0;
108 target.restore(false, WindowStateStorage.WindowStateNormal);
109 target.restore(false, WindowStateStorage.WindowStateNormal);
109 }
110 }
@@ -115,75 +116,75 @@ Item {
115 target.requestedX = Math.round(pos.x - priv.distanceX);
116 target.requestedX = Math.round(pos.x - priv.distanceX);
116 target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
117 target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
117
118
118− var globalPos = mapToItem(null, mouse.x, mouse.y);
119+// var globalPos = mapToItem(null, mouse.x, mouse.y);
119− var globalX = globalPos.x;
120+// var globalX = globalPos.x;
120− var globalY = globalPos.y;
121+// var globalY = globalPos.y;
121− if (globalX < priv.triggerArea && globalY < PanelState.panelHeight) { // top left
122+// if (globalX < priv.triggerArea && globalY < PanelState.panelHeight) { // top left
122− if (target.canBeCornerMaximized) {
123+// if (target.canBeCornerMaximized) {
123− priv.progress = priv.progressInCorner(0, PanelState.panelHeight, globalX, globalY);
124+// priv.progress = priv.progressInCorner(0, PanelState.panelHeight, globalX, globalY);
124− priv.resetEdges();
125+// priv.resetEdges();
125− priv.nearTopLeftCorner = true;
126+// priv.nearTopLeftCorner = true;
126− root.fakeMaximizeTopLeftAnimationRequested(priv.progress);
127+// root.fakeMaximizeTopLeftAnimationRequested(priv.progress);
127− }
128+// }
128− } else if (globalX > stageWidth - priv.triggerArea && globalY < PanelState.panelHeight) { // top right
129+// } else if (globalX > stageWidth - priv.triggerArea && globalY < PanelState.panelHeight) { // top right
129− if (target.canBeCornerMaximized) {
130+// if (target.canBeCornerMaximized) {
130− priv.progress = priv.progressInCorner(stageWidth, PanelState.panelHeight, globalX, globalY);
131+// priv.progress = priv.progressInCorner(stageWidth, PanelState.panelHeight, globalX, globalY);
131− priv.resetEdges();
132+// priv.resetEdges();
132− priv.nearTopRightCorner = true;
133+// priv.nearTopRightCorner = true;
133− root.fakeMaximizeTopRightAnimationRequested(priv.progress);
134+// root.fakeMaximizeTopRightAnimationRequested(priv.progress);
134− }
135+// }
135− } else if (globalX < priv.triggerArea && globalY > stageHeight - priv.triggerArea) { // bottom left
136+// } else if (globalX < priv.triggerArea && globalY > stageHeight - priv.triggerArea) { // bottom left
136− if (target.canBeCornerMaximized) {
137+// if (target.canBeCornerMaximized) {
137− priv.progress = priv.progressInCorner(0, stageHeight, globalX, globalY);
138+// priv.progress = priv.progressInCorner(0, stageHeight, globalX, globalY);
138− priv.resetEdges();
139+// priv.resetEdges();
139− priv.nearBottomLeftCorner = true;
140+// priv.nearBottomLeftCorner = true;
140− root.fakeMaximizeBottomLeftAnimationRequested(priv.progress);
141+// root.fakeMaximizeBottomLeftAnimationRequested(priv.progress);
141− }
142+// }
142− } else if (globalX > stageWidth - priv.triggerArea && globalY > stageHeight - priv.triggerArea) { // bottom right
143+// } else if (globalX > stageWidth - priv.triggerArea && globalY > stageHeight - priv.triggerArea) { // bottom right
143− if (target.canBeCornerMaximized) {
144+// if (target.canBeCornerMaximized) {
144− priv.progress = priv.progressInCorner(stageWidth, stageHeight, globalX, globalY);
145+// priv.progress = priv.progressInCorner(stageWidth, stageHeight, globalX, globalY);
145− priv.resetEdges();
146+// priv.resetEdges();
146− priv.nearBottomRightCorner = true;
147+// priv.nearBottomRightCorner = true;
147− root.fakeMaximizeBottomRightAnimationRequested(priv.progress);
148+// root.fakeMaximizeBottomRightAnimationRequested(priv.progress);
148− }
149+// }
149− } else if (globalX < priv.triggerArea) { // left
150+// } else if (globalX < priv.triggerArea) { // left
150− if (target.canBeMaximizedLeftRight) {
151+// if (target.canBeMaximizedLeftRight) {
151− priv.progress = MathUtils.clampAndProject(globalX, priv.triggerArea, 0, 0, 1);
152+// priv.progress = MathUtils.clampAndProject(globalX, priv.triggerArea, 0, 0, 1);
152− priv.resetEdges();
153+// priv.resetEdges();
153− priv.nearLeftEdge = true;
154+// priv.nearLeftEdge = true;
154− root.fakeMaximizeLeftAnimationRequested(priv.progress);
155+// root.fakeMaximizeLeftAnimationRequested(priv.progress);
155− }
156+// }
156− } else if (globalX > stageWidth - priv.triggerArea) { // right
157+// } else if (globalX > stageWidth - priv.triggerArea) { // right
157− if (target.canBeMaximizedLeftRight) {
158+// if (target.canBeMaximizedLeftRight) {
158− priv.progress = MathUtils.clampAndProject(globalX, stageWidth - priv.triggerArea, stageWidth, 0, 1);
159+// priv.progress = MathUtils.clampAndProject(globalX, stageWidth - priv.triggerArea, stageWidth, 0, 1);
159− priv.resetEdges();
160+// priv.resetEdges();
160− priv.nearRightEdge = true;
161+// priv.nearRightEdge = true;
161− root.fakeMaximizeRightAnimationRequested(priv.progress);
162+// root.fakeMaximizeRightAnimationRequested(priv.progress);
162− }
163+// }
163− } else if (globalY < PanelState.panelHeight) { // top
164+// } else if (globalY < PanelState.panelHeight) { // top
164− if (target.canBeMaximized) {
165+// if (target.canBeMaximized) {
165− priv.progress = MathUtils.clampAndProject(globalY, Math.max(PanelState.panelHeight, priv.triggerArea), 0, 0, 1);
166+// priv.progress = MathUtils.clampAndProject(globalY, Math.max(PanelState.panelHeight, priv.triggerArea), 0, 0, 1);
166− priv.resetEdges();
167+// priv.resetEdges();
167− priv.nearTopEdge = true;
168+// priv.nearTopEdge = true;
168− root.fakeMaximizeAnimationRequested(priv.progress);
169+// root.fakeMaximizeAnimationRequested(priv.progress);
169− }
170+// }
170− } else if (priv.nearLeftEdge || priv.nearRightEdge || priv.nearTopEdge || priv.nearTopLeftCorner || priv.nearTopRightCorner ||
171+// } else if (priv.nearLeftEdge || priv.nearRightEdge || priv.nearTopEdge || priv.nearTopLeftCorner || priv.nearTopRightCorner ||
171− priv.nearBottomLeftCorner || priv.nearBottomRightCorner) {
172+// priv.nearBottomLeftCorner || priv.nearBottomRightCorner) {
172− print("!!! Exited")
173+// print("!!! Exited")
173− priv.progress = 0;
174+// priv.progress = 0;
174− priv.resetEdges();
175+// priv.resetEdges();
175− root.stopFakeAnimation();
176+// root.stopFakeAnimation();
176− }
177+// }
177 }
178 }
178 }
179 }
179
180
180 function handleReleased(mouse) {
181 function handleReleased(mouse) {
181− print("Mouse released (left/top/right)", priv.nearLeftEdge, priv.nearTopEdge, priv.nearRightEdge)
182 if (mouse.button == Qt.LeftButton && (target.state == "normal" || target.state == "restored") && priv.progress == 0) {
182 if (mouse.button == Qt.LeftButton && (target.state == "normal" || target.state == "restored") && priv.progress == 0) {
183 // save the x/y to restore to
183 // save the x/y to restore to
184+ print("!!! Saving restoredX/Y")
184 target.restoredX = target.x;
185 target.restoredX = target.x;
185 target.restoredY = target.y;
186 target.restoredY = target.y;
186− } else if (priv.progress < 0.3) { // cancel the preview shape if under 30%
187+ } /*else if (priv.progress < 0.3) { // cancel the preview shape if under 30%
187 priv.progress = 0;
188 priv.progress = 0;
188 priv.resetEdges();
189 priv.resetEdges();
189 root.stopFakeAnimation();
190 root.stopFakeAnimation();
@@ -208,6 +209,6 @@ Item {
208 } else if (priv.nearBottomRightCorner) {
209 } else if (priv.nearBottomRightCorner) {
209 target.maximizeBottomRight();
210 target.maximizeBottomRight();
210 priv.resetEdges();
211 priv.resetEdges();
211− }
212+ }*/
212 }
213 }
213}
214}
tests/mocks/Cursor/Cursor.qml+1
@@ -26,5 +26,6 @@ Item {
26 signal pushedTopRightCorner(real amount, int buttons)
26 signal pushedTopRightCorner(real amount, int buttons)
27 signal pushedBottomLeftCorner(real amount, int buttons)
27 signal pushedBottomLeftCorner(real amount, int buttons)
28 signal pushedBottomRightCorner(real amount, int buttons)
28 signal pushedBottomRightCorner(real amount, int buttons)
29+ signal pushStopped()
29 signal mouseMoved()
30 signal mouseMoved()
30}
31}