on xenial help sign in
Make the application lose focus while the panel is open.
5a05204Daniel d'Andrada
qml/Panel/Indicators.qml+1
@@ -37,6 +37,7 @@ Showable {
37 readonly property int lockThreshold: openedHeight / 2
37 readonly property int lockThreshold: openedHeight / 2
38 property bool fullyOpened: height == openedHeight
38 property bool fullyOpened: height == openedHeight
39 property bool partiallyOpened: height > panelHeight && !fullyOpened
39 property bool partiallyOpened: height > panelHeight && !fullyOpened
40+ property bool fullyClosed: height <= panelHeight
40 property bool contentEnabled: true
41 property bool contentEnabled: true
41 property bool initalizeItem: true
42 property bool initalizeItem: true
42 readonly property alias content: menuContent
43 readonly property alias content: menuContent
qml/Shell.qml+1
@@ -461,6 +461,7 @@ Item {
461 target: applicationsDisplayLoader.item
461 target: applicationsDisplayLoader.item
462 property: "interactive"
462 property: "interactive"
463 value: stages.roughlyFullyShown && !greeter.shown && !lockscreen.shown
463 value: stages.roughlyFullyShown && !greeter.shown && !lockscreen.shown
464+ && panel.indicators.fullyClosed
464 }
465 }
465 Binding {
466 Binding {
466 target: applicationsDisplayLoader.item
467 target: applicationsDisplayLoader.item
tests/qmltests/tst_Shell.qml+44
@@ -378,6 +378,38 @@ Item {
378 tryCompare(item, "visible", false);
378 tryCompare(item, "visible", false);
379 }
379 }
380
380
381+ function test_surfaceLosesFocusWhilePanelIsOpen() {
382+ var app = ApplicationManager.startApplication("dialer-app");
383+ // wait until the app is fully loaded (ie, real surface replaces splash screen)
384+ tryCompareFunction(function() { return app.surface != null }, true);
385+
386+ tryCompare(app.surface, "focus", true);
387+
388+ // Drag the indicators panel half-open
389+ var touchX = shell.width / 2;
390+ var indicators = findChild(shell, "indicators");
391+ touchFlick(indicators,
392+ touchX /* fromX */, indicators.panelHeight * 0.5 /* fromY */,
393+ touchX /* toX */, shell.height * 0.5 /* toY */,
394+ true /* beginTouch */, false /* endTouch */);
395+ verify(indicators.partiallyOpened);
396+
397+ tryCompare(app.surface, "focus", false);
398+
399+ // And finish getting it open
400+ touchFlick(indicators,
401+ touchX /* fromX */, shell.height * 0.5 /* fromY */,
402+ touchX /* toX */, shell.height * 0.9 /* toY */,
403+ false /* beginTouch */, true /* endTouch */);
404+ tryCompare(indicators, "fullyOpened", true);
405+
406+ tryCompare(app.surface, "focus", false);
407+
408+ dragToCloseIndicatorsPanel();
409+
410+ tryCompare(app.surface, "focus", true);
411+ }
412+
381 // Wait for the whole UI to settle down
413 // Wait for the whole UI to settle down
382 function waitForUIToSettle() {
414 function waitForUIToSettle() {
383 waitUntilApplicationWindowIsFullyHidden();
415 waitUntilApplicationWindowIsFullyHidden();
@@ -385,6 +417,18 @@ Item {
385 tryCompare(dashContentList, "moving", false);
417 tryCompare(dashContentList, "moving", false);
386 }
418 }
387
419
420+ function dragToCloseIndicatorsPanel() {
421+ var indicators = findChild(shell, "indicators");
422+
423+ var touchStartX = shell.width / 2;
424+ var touchStartY = shell.height - (indicators.panelHeight * 0.5);
425+ touchFlick(shell,
426+ touchStartX, touchStartY,
427+ touchStartX, shell.height * 0.1);
428+
429+ tryCompare(indicators, "fullyClosed", true);
430+ }
431+
388 function dragLauncherIntoView() {
432 function dragLauncherIntoView() {
389 var launcherPanel = findChild(shell, "launcherPanel");
433 var launcherPanel = findChild(shell, "launcherPanel");
390 verify(launcherPanel.x = - launcherPanel.width);
434 verify(launcherPanel.x = - launcherPanel.width);