on xenial help sign in
With a maximized window, "dragging" the panel down should restore it
commit7f8d853cd62effa18ca004fcec733a04062a8ec6 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateFri 27 May 2016, 13:51 (10 years ago) parente0897cceb06446
2 files changed+35
qml/Panel/Panel.qml+10 tests/qmltests/tst_Shell.qml+25
qml/Panel/Panel.qml+10
@@ -92,6 +92,7 @@ Item {
9292 }
9393
9494 MouseArea {
95+ objectName: "windowControlArea"
9596 anchors {
9697 top: parent.top
9798 left: parent.left
@@ -102,6 +103,15 @@ Item {
102103 onClicked: callHint.visible ? callHint.showLiveCall() : PanelState.focusMaximizedApp()
103104 onDoubleClicked: PanelState.maximize()
104105
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+
105115 // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
106116 // cf. https://bugreports.qt.io/browse/QTBUG-32909
107117 WindowControlButtons {
tests/qmltests/tst_Shell.qml+25
@@ -2429,5 +2429,30 @@ Rectangle {
24292429 ApplicationManager.requestFocusApplication("calendar-app");
24302430 tryCompare(app2Surface, "keymap", "fr");
24312431 }
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+ }
24322457 }
24332458}