on xenial help sign in
With a maximized window, "dragging" the panel down should restore it
7f8d853Lukáš Tinkl
qml/Panel/Panel.qml+10
@@ -92,6 +92,7 @@ Item {
92 }
92 }
93
93
94 MouseArea {
94 MouseArea {
95+ objectName: "windowControlArea"
95 anchors {
96 anchors {
96 top: parent.top
97 top: parent.top
97 left: parent.left
98 left: parent.left
@@ -102,6 +103,15 @@ Item {
102 onClicked: callHint.visible ? callHint.showLiveCall() : PanelState.focusMaximizedApp()
103 onClicked: callHint.visible ? callHint.showLiveCall() : PanelState.focusMaximizedApp()
103 onDoubleClicked: PanelState.maximize()
104 onDoubleClicked: PanelState.maximize()
104
105
106+ property bool mouseWasPressed: false
107+ onPressed: mouseWasPressed = containsPress
108+ onMouseYChanged: {
109+ if (mouseWasPressed && mouseY > panelHeight) {
110+ PanelState.restoreClicked(); // restore the window when "dragging" the panel down
111+ mouseWasPressed = false;
112+ }
113+ }
114+
105 // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
115 // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
106 // cf. https://bugreports.qt.io/browse/QTBUG-32909
116 // cf. https://bugreports.qt.io/browse/QTBUG-32909
107 WindowControlButtons {
117 WindowControlButtons {
tests/qmltests/tst_Shell.qml+25
@@ -2429,5 +2429,30 @@ Rectangle {
2429 ApplicationManager.requestFocusApplication("calendar-app");
2429 ApplicationManager.requestFocusApplication("calendar-app");
2430 tryCompare(app2Surface, "keymap", "fr");
2430 tryCompare(app2Surface, "keymap", "fr");
2431 }
2431 }
2432+
2433+ function test_dragPanelToRestoreMaximizedWindow() {
2434+ loadShell("desktop");
2435+ shell.usageScenario = "desktop";
2436+ waitForRendering(shell);
2437+ var panel = findChild(shell, "windowControlArea");
2438+ verify(panel);
2439+
2440+ var appSurfaceId = topLevelSurfaceList.nextId;
2441+ var app = ApplicationManager.startApplication("dialer-app")
2442+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2443+
2444+ // start dialer, maximize it
2445+ var appContainer = findChild(shell, "appContainer");
2446+ var appDelegate = findChild(appContainer, "appDelegate_" + appSurfaceId);
2447+ verify(appDelegate);
2448+ appDelegate.maximize();
2449+ tryCompare(appDelegate, "state", "maximized");
2450+
2451+ mousePress(panel);
2452+ mouseMove(shell, shell.width/2, shell.height/2);
2453+ mouseRelease(shell);
2454+
2455+ tryCompare(appDelegate, "state", "normal");
2456+ }
2432 }
2457 }
2433}
2458}