on xenial help sign in
Sanitize the logic for pointer vs. touch menus, fixes hiding the window title in staged mode, when hovering the panel with mouse and no menus available.
81e8b93Lukáš Tinkl
qml/Panel/Panel.qml+8−8
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013-2016 Canonical, Ltd.
2+ * Copyright (C) 2013-2017 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -85,15 +85,15 @@ Item {
85 property bool showWindowDecorationControls: (revealControls && PanelState.decorationsVisible) ||
85 property bool showWindowDecorationControls: (revealControls && PanelState.decorationsVisible) ||
86 PanelState.decorationsAlwaysVisible
86 PanelState.decorationsAlwaysVisible
87
87
88− property bool showPointerMenu: revealControls &&
88+ property bool showPointerMenu: revealControls && enablePointerMenu &&
89 (PanelState.decorationsVisible || mode == "staged")
89 (PanelState.decorationsVisible || mode == "staged")
90
90
91− property bool enablePointerMenu: revealControls &&
92− applicationMenus.available &&
91+ property bool enablePointerMenu: applicationMenus.available &&
93 applicationMenus.model
92 applicationMenus.model
94
93
95 property bool showTouchMenu: !greeterShown &&
94 property bool showTouchMenu: !greeterShown &&
96− !showPointerMenu
95+ !showPointerMenu &&
96+ !showWindowDecorationControls
97
97
98 property bool enableTouchMenus: showTouchMenu &&
98 property bool enableTouchMenus: showTouchMenu &&
99 applicationMenus.available &&
99 applicationMenus.available &&
@@ -211,7 +211,7 @@ Item {
211 opacity: d.showPointerMenu ? 1 : 0
211 opacity: d.showPointerMenu ? 1 : 0
212 visible: opacity != 0
212 visible: opacity != 0
213 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
213 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
214− active: __applicationMenus.model && !callHint.visible
214+ active: d.showPointerMenu && !callHint.visible
215
215
216 width: parent.width - windowControlButtons.width - units.gu(2) - __indicators.barWidth
216 width: parent.width - windowControlButtons.width - units.gu(2) - __indicators.barWidth
217
217
@@ -220,7 +220,7 @@ Item {
220 sourceComponent: MenuBar {
220 sourceComponent: MenuBar {
221 id: bar
221 id: bar
222 objectName: "menuBar"
222 objectName: "menuBar"
223− anchors.left: parent.left
223+ anchors.left: parent ? parent.left : undefined
224 anchors.margins: units.gu(1)
224 anchors.margins: units.gu(1)
225 height: menuBarLoader.height
225 height: menuBarLoader.height
226 enableKeyFilter: valid && PanelState.decorationsVisible
226 enableKeyFilter: valid && PanelState.decorationsVisible
@@ -339,7 +339,7 @@ Item {
339 maximumLineCount: 1
339 maximumLineCount: 1
340 fontSize: "medium"
340 fontSize: "medium"
341 font.weight: Font.Medium
341 font.weight: Font.Medium
342− color: Theme.palette.selected.backgroundText
342+ color: theme.palette.selected.backgroundText
343 opacity: __applicationMenus.visible && !__applicationMenus.expanded ? 1 : 0
343 opacity: __applicationMenus.visible && !__applicationMenus.expanded ? 1 : 0
344 visible: opacity != 0
344 visible: opacity != 0
345 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
345 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
qml/Stage/DecoratedWindow.qml+1
@@ -38,6 +38,7 @@ FocusScope {
38 property alias maximizeButtonShown: decoration.maximizeButtonShown
38 property alias maximizeButtonShown: decoration.maximizeButtonShown
39 property alias interactive: applicationWindow.interactive
39 property alias interactive: applicationWindow.interactive
40 readonly property alias orientationChangesEnabled: applicationWindow.orientationChangesEnabled
40 readonly property alias orientationChangesEnabled: applicationWindow.orientationChangesEnabled
41+ property alias windowControlButtonsVisible: decoration.windowControlButtonsVisible
41
42
42 // Changing this will actually add/remove a decoration, meaning, requestedHeight will take the decoration into account.
43 // Changing this will actually add/remove a decoration, meaning, requestedHeight will take the decoration into account.
43 property bool hasDecoration: true
44 property bool hasDecoration: true
qml/Stage/Stage.qml+3−2
@@ -390,7 +390,7 @@ FocusScope {
390 Binding {
390 Binding {
391 target: PanelState
391 target: PanelState
392 property: "decorationsVisible"
392 property: "decorationsVisible"
393− value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
393+ value: mode == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !root.spreadShown
394 }
394 }
395
395
396 Binding {
396 Binding {
@@ -1384,6 +1384,7 @@ FocusScope {
1384 requestedHeight: appContainer.height;
1384 requestedHeight: appContainer.height;
1385 }
1385 }
1386 PropertyChanges { target: touchControls; enabled: true }
1386 PropertyChanges { target: touchControls; enabled: true }
1387+ PropertyChanges { target: decoratedWindow; windowControlButtonsVisible: false }
1387 },
1388 },
1388 State {
1389 State {
1389 name: "fullscreen"; when: appDelegate.fullscreen && !appDelegate.minimized
1390 name: "fullscreen"; when: appDelegate.fullscreen && !appDelegate.minimized
@@ -1405,7 +1406,7 @@ FocusScope {
1405 }
1406 }
1406 PropertyChanges { target: touchControls; enabled: true }
1407 PropertyChanges { target: touchControls; enabled: true }
1407 PropertyChanges { target: resizeArea; enabled: true }
1408 PropertyChanges { target: resizeArea; enabled: true }
1408− PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1409+ PropertyChanges { target: decoratedWindow; shadowOpacity: .3; windowControlButtonsVisible: true}
1409 },
1410 },
1410 State {
1411 State {
1411 name: "restored";
1412 name: "restored";
qml/Stage/WindowDecoration.qml+1
@@ -34,6 +34,7 @@ MouseArea {
34 property var menu: undefined
34 property var menu: undefined
35 property bool enableMenus: true
35 property bool enableMenus: true
36 property bool windowMoving: false
36 property bool windowMoving: false
37+ property alias windowControlButtonsVisible: buttons.visible
37
38
38 readonly property real buttonsWidth: buttons.width + row.spacing
39 readonly property real buttonsWidth: buttons.width + row.spacing
39
40
tests/qmltests/Panel/tst_Panel.qml+3−25
@@ -779,40 +779,18 @@ PanelTest {
779
779
780 var appTitle = findChild(panel, "panelTitle"); verify(appTitle);
780 var appTitle = findChild(panel, "panelTitle"); verify(appTitle);
781 var appMenuRow = findChild(panel.applicationMenus, "panelRow"); verify(appMenuRow);
781 var appMenuRow = findChild(panel.applicationMenus, "panelRow"); verify(appMenuRow);
782− var appMenuBar = findChild(panel, "menuBar"); verify(appMenuBar);
782+ var menuBarLoader = findChild(panel, "menuBarLoader"); verify(menuBarLoader);
783
783
784 tryCompare(appTitle, "visible", true, undefined, "App title should be visible");
784 tryCompare(appTitle, "visible", true, undefined, "App title should be visible");
785− tryCompare(appMenuBar, "visible", false, undefined, "App menu bar should not be visible");
785+ tryCompare(menuBarLoader, "visible", false, undefined, "App menu bar should not be visible");
786
786
787 mouseMove(panel, panel.width/2, panel.panelHeight);
787 mouseMove(panel, panel.width/2, panel.panelHeight);
788
788
789+ var appMenuBar = findChild(panel, "menuBar"); verify(appMenuBar);
789 tryCompare(appTitle, "visible", false, undefined, "App title should not be visible on mouse hover");
790 tryCompare(appTitle, "visible", false, undefined, "App title should not be visible on mouse hover");
790 tryCompare(appMenuBar, "visible", true, undefined, "App menu bar should be visible on mouse hover");
791 tryCompare(appMenuBar, "visible", true, undefined, "App menu bar should be visible on mouse hover");
791 }
792 }
792
793
793− function test_windowedApplicationMenuShowOnMouseHoverWhenDecorationsShown() {
794− PanelState.title = "Fake Title";
795− panel.mode = "windowed";
796− mouseEmulation.checked = false;
797−
798− var appTitle = findChild(panel, "panelTitle"); verify(appTitle);
799− var appMenuRow = findChild(panel.applicationMenus, "panelRow"); verify(appMenuRow);
800− var appMenuBar = findChild(panel, "menuBar"); verify(appMenuBar);
801−
802− tryCompare(appTitle, "visible", true, undefined, "App title should be visible");
803− tryCompare(appMenuBar, "visible", false, undefined, "App menu bar should not be visible");
804−
805− mouseMove(panel, panel.width/2, panel.panelHeight);
806−
807− tryCompare(appTitle, "visible", true, undefined, "App title should still be visible on mouse hover when panel decorations are not visible");
808− tryCompare(appMenuBar, "visible", false, undefined, "App menu bar should be visible on mouse hover when panel decorations are not visible");
809−
810− PanelState.decorationsVisible = true;
811−
812− tryCompare(appTitle, "visible", false, undefined, "App title should still be visible on mouse hover when panel decorations are visible");
813− tryCompare(appMenuBar, "visible", true, undefined, "App menu bar should be visible on mouse hover when panel decorations not visible");
814− }
815−
816 function test_keyboardNavigation_data() {
794 function test_keyboardNavigation_data() {
817 return [
795 return [
818 {tag: "tab to start", doTab: false},
796 {tag: "tab to start", doTab: false},
tests/qmltests/Stage/tst_DesktopStage.qml+1−5
@@ -870,11 +870,7 @@ Item {
870 maximizeAppDelegate(appDelegate);
870 maximizeAppDelegate(appDelegate);
871
871
872 // Close the window and restart the application
872 // Close the window and restart the application
873− var closeButton = findChild(appDelegate, "closeWindowButton");
873+ appDelegate.close();
874− appDelegate = null;
875− verify(closeButton);
876− mouseClick(closeButton);
877− closeButton = null;
878 tryCompare(topSurfaceList, "count", originalWindowCount);
874 tryCompare(topSurfaceList, "count", originalWindowCount);
879 wait(100); // plus some spare room
875 wait(100); // plus some spare room
880 appDelegate = startApplication("dialer-app");
876 appDelegate = startApplication("dialer-app");