@@ -29,7 +29,7 @@ Item {
29 property int stageHeight
29 property int stageHeight
30 property real buttonsWidth: 0
30 property real buttonsWidth: 0
32− readonly property alias dragging: priv.dragging
32+ property alias dragging: priv.dragging
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";
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);
@@ -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));
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);
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);
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);
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);
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);
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);
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);
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();
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();