on xenial help sign in
feature parity: with a maximized window, "dragging" the panel down should restore it
commit6fe702ef5c9eb4a1887a06d55142a39de3d66612 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 29 Mar 2016, 16:02 (11 years ago) parent1c30dff
2 files changed+34
qml/Panel/Panel.qml+10 tests/qmltests/tst_Shell.qml+24
qml/Panel/Panel.qml+10
@@ -101,6 +101,7 @@ Item {
101101 }
102102
103103 MouseArea {
104+ objectName: "windowControlArea"
104105 anchors {
105106 top: parent.top
106107 left: parent.left
@@ -111,6 +112,15 @@ Item {
111112 onClicked: callHint.visible ? callHint.showLiveCall() : PanelState.focusMaximizedApp()
112113 onDoubleClicked: PanelState.maximize()
113114
115+ property bool mouseWasPressed: false
116+ onPressed: mouseWasPressed = containsPress
117+ onExited: {
118+ if (mouseWasPressed && !indicatorAreaBackground.contains(Qt.point(mouseX, mouseY))) {
119+ PanelState.maximize(); // restore the window when "dragging" the panel down
120+ mouseWasPressed = false;
121+ }
122+ }
123+
114124 // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
115125 // cf. https://bugreports.qt.io/browse/QTBUG-32909
116126 WindowControlButtons {
tests/qmltests/tst_Shell.qml+24
@@ -2345,5 +2345,29 @@ Rectangle {
23452345 tryCompare(app2.session.lastSurface, "keymapLayout", "fr");
23462346 tryCompare(app2.session.lastSurface, "keymapVariant", "");
23472347 }
2348+
2349+ function test_dragPanelToRestoreMaximizedWindow() {
2350+ loadShell("desktop");
2351+ shell.usageScenario = "desktop";
2352+ waitForRendering(shell);
2353+ var panel = findChild(shell, "windowControlArea");
2354+ verify(panel);
2355+
2356+ var app = ApplicationManager.startApplication("dialer-app")
2357+ waitUntilAppWindowIsFullyLoaded(app);
2358+
2359+ // start dialer, maximize it
2360+ var appContainer = findChild(shell, "appContainer");
2361+ var appDelegate = findChild(appContainer, "appDelegate_dialer-app");
2362+ verify(appDelegate);
2363+ appDelegate.maximize();
2364+ tryCompare(appDelegate, "state", "maximized");
2365+
2366+ mousePress(panel);
2367+ mouseMove(shell, shell.width/2, shell.height/2);
2368+ mouseRelease(shell);
2369+
2370+ tryCompare(appDelegate, "state", "normal");
2371+ }
23482372 }
23492373}