on xenial help sign in
use DND for restoring from panel
8bfb5ebLukáš Tinkl
qml/Components/PanelState/PanelState.qml+1
@@ -26,6 +26,7 @@ QtObject {
26 property bool closeButtonShown: true
26 property bool closeButtonShown: true
27 property bool dropShadow: false
27 property bool dropShadow: false
28 property int panelHeight: 0
28 property int panelHeight: 0
29+ property var maximizedAppDelegate: null
29
30
30 signal closeClicked()
31 signal closeClicked()
31 signal minimizeClicked()
32 signal minimizeClicked()
qml/Panel/Panel.qml+15−7
@@ -102,13 +102,21 @@ Item {
102 hoverEnabled: true
102 hoverEnabled: true
103 onClicked: callHint.visible ? callHint.showLiveCall() : PanelState.focusMaximizedApp()
103 onClicked: callHint.visible ? callHint.showLiveCall() : PanelState.focusMaximizedApp()
104 onDoubleClicked: PanelState.restoreClicked()
104 onDoubleClicked: PanelState.restoreClicked()
105−
105+ drag.target: PanelState.maximizedAppDelegate
106− property bool mouseWasPressed: false
106+ drag.axis: Drag.XAndYAxis
107− onPressed: mouseWasPressed = containsPress
107+ drag.minimumX: 0
108− onMouseYChanged: {
108+ drag.minimumY: panelHeight
109− if (mouseWasPressed && mouseY > panelHeight) {
109+ drag.maximumX: PanelState.maximizedAppDelegate ? PanelState.maximizedAppDelegate.moveHandler.stageWidth : 0
110− PanelState.restoreClicked(); // restore the window when "dragging" the panel down
110+ drag.maximumY: PanelState.maximizedAppDelegate ? PanelState.maximizedAppDelegate.moveHandler.stageHeight : 0
111− mouseWasPressed = false;
111+ drag.threshold: panelHeight
112+ drag.filterChildren: true
113+ onReleased: {
114+ if (drag.active) {
115+ var delegate = PanelState.maximizedAppDelegate;
116+ print("!!! Released drag at", mouse.x, mouse.y, drag.active)
117+ delegate.restoredX = Math.round(mouse.x - delegate.moveHandler.buttonsWidth);
118+ delegate.restoredY = Math.round(Math.max(mouse.y, panelHeight));
119+ delegate.restoreFromMaximized(false);
112 }
120 }
113 }
121 }
114
122
qml/Stages/DesktopStage.qml+7
@@ -205,6 +205,12 @@ AbstractStage {
205 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
205 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
206 }
206 }
207
207
208+ Binding {
209+ target: PanelState
210+ property: "maximizedAppDelegate"
211+ value: priv.foregroundMaximizedAppDelegate ? priv.foregroundMaximizedAppDelegate : null
212+ }
213+
208 Component.onDestruction: {
214 Component.onDestruction: {
209 PanelState.title = "";
215 PanelState.title = "";
210 PanelState.buttonsVisible = false;
216 PanelState.buttonsVisible = false;
@@ -349,6 +355,7 @@ AbstractStage {
349 readonly property var surface: model.surface
355 readonly property var surface: model.surface
350 readonly property alias resizeArea: resizeArea
356 readonly property alias resizeArea: resizeArea
351 readonly property alias focusedSurface: decoratedWindow.focusedSurface
357 readonly property alias focusedSurface: decoratedWindow.focusedSurface
358+ readonly property alias moveHandler: decoratedWindow.moveHandler
352
359
353 readonly property bool isDash: model.application.appId == "unity8-dash"
360 readonly property bool isDash: model.application.appId == "unity8-dash"
354
361