on xenial help sign in
set lp:~lukas-kde/unity8/fix-window-title-vs-menu as prereq
commitefdd41ff77e0d4649e18a6e6a74dc81e5c7284cc authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 5 Apr 2017, 00:11 (10 years ago) parent98e912cf992477
6 files changed+17−40
qml/Panel/Panel.qml+8−8 qml/Stage/DecoratedWindow.qml+1 qml/Stage/Stage.qml+3−2 qml/Stage/WindowDecoration.qml+1 tests/qmltests/Panel/tst_Panel.qml+3−25 tests/qmltests/Stage/tst_DesktopStage.qml+1−5
qml/Panel/Panel.qml+8−8
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013-2016 Canonical, Ltd.
2+ * Copyright (C) 2013-2017 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -85,15 +85,15 @@ Item {
8585 property bool showWindowDecorationControls: (revealControls && PanelState.decorationsVisible) ||
8686 PanelState.decorationsAlwaysVisible
8787
88− property bool showPointerMenu: revealControls &&
88+ property bool showPointerMenu: revealControls && enablePointerMenu &&
8989 (PanelState.decorationsVisible || mode == "staged")
9090
91− property bool enablePointerMenu: revealControls &&
92− applicationMenus.available &&
91+ property bool enablePointerMenu: applicationMenus.available &&
9392 applicationMenus.model
9493
9594 property bool showTouchMenu: !greeterShown &&
96− !showPointerMenu
95+ !showPointerMenu &&
96+ !showWindowDecorationControls
9797
9898 property bool enableTouchMenus: showTouchMenu &&
9999 applicationMenus.available &&
@@ -211,7 +211,7 @@ Item {
211211 opacity: d.showPointerMenu ? 1 : 0
212212 visible: opacity != 0
213213 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
214− active: __applicationMenus.model && !callHint.visible
214+ active: d.showPointerMenu && !callHint.visible
215215
216216 width: parent.width - windowControlButtons.width - units.gu(2) - __indicators.barWidth
217217
@@ -220,7 +220,7 @@ Item {
220220 sourceComponent: MenuBar {
221221 id: bar
222222 objectName: "menuBar"
223− anchors.left: parent.left
223+ anchors.left: parent ? parent.left : undefined
224224 anchors.margins: units.gu(1)
225225 height: menuBarLoader.height
226226 enableKeyFilter: valid && PanelState.decorationsVisible
@@ -339,7 +339,7 @@ Item {
339339 maximumLineCount: 1
340340 fontSize: "medium"
341341 font.weight: Font.Medium
342− color: Theme.palette.selected.backgroundText
342+ color: theme.palette.selected.backgroundText
343343 opacity: __applicationMenus.visible && !__applicationMenus.expanded ? 1 : 0
344344 visible: opacity != 0
345345 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
qml/Stage/DecoratedWindow.qml+1
@@ -38,6 +38,7 @@ FocusScope {
3838 property alias maximizeButtonShown: decoration.maximizeButtonShown
3939 property alias interactive: applicationWindow.interactive
4040 readonly property alias orientationChangesEnabled: applicationWindow.orientationChangesEnabled
41+ property alias windowControlButtonsVisible: decoration.windowControlButtonsVisible
4142
4243 // Changing this will actually add/remove a decoration, meaning, requestedHeight will take the decoration into account.
4344 property bool hasDecoration: true
qml/Stage/Stage.qml+3−2
@@ -391,7 +391,7 @@ FocusScope {
391391 Binding {
392392 target: PanelState
393393 property: "decorationsVisible"
394− value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
394+ value: mode == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !root.spreadShown
395395 }
396396
397397 Binding {
@@ -1393,6 +1393,7 @@ FocusScope {
13931393 requestedHeight: appContainer.height;
13941394 }
13951395 PropertyChanges { target: touchControls; enabled: true }
1396+ PropertyChanges { target: decoratedWindow; windowControlButtonsVisible: false }
13961397 },
13971398 State {
13981399 name: "fullscreen"; when: appDelegate.fullscreen && !appDelegate.minimized
@@ -1415,7 +1416,7 @@ FocusScope {
14151416 }
14161417 PropertyChanges { target: touchControls; enabled: true }
14171418 PropertyChanges { target: resizeArea; enabled: true }
1418− PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1419+ PropertyChanges { target: decoratedWindow; shadowOpacity: .3; windowControlButtonsVisible: true}
14191420 },
14201421 State {
14211422 name: "restored";
qml/Stage/WindowDecoration.qml+1
@@ -34,6 +34,7 @@ MouseArea {
3434 property var menu: undefined
3535 property bool enableMenus: true
3636 property bool windowMoving: false
37+ property alias windowControlButtonsVisible: buttons.visible
3738
3839 readonly property real buttonsWidth: buttons.width + row.spacing
3940
tests/qmltests/Panel/tst_Panel.qml+3−25
@@ -779,40 +779,18 @@ PanelTest {
779779
780780 var appTitle = findChild(panel, "panelTitle"); verify(appTitle);
781781 var appMenuRow = findChild(panel.applicationMenus, "panelRow"); verify(appMenuRow);
782− var appMenuBar = findChild(panel, "menuBar"); verify(appMenuBar);
782+ var menuBarLoader = findChild(panel, "menuBarLoader"); verify(menuBarLoader);
783783
784784 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");
786786
787787 mouseMove(panel, panel.width/2, panel.panelHeight);
788788
789+ var appMenuBar = findChild(panel, "menuBar"); verify(appMenuBar);
789790 tryCompare(appTitle, "visible", false, undefined, "App title should not be visible on mouse hover");
790791 tryCompare(appMenuBar, "visible", true, undefined, "App menu bar should be visible on mouse hover");
791792 }
792793
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−
816794 function test_keyboardNavigation_data() {
817795 return [
818796 {tag: "tab to start", doTab: false},
tests/qmltests/Stage/tst_DesktopStage.qml+1−5
@@ -870,11 +870,7 @@ Item {
870870 maximizeAppDelegate(appDelegate);
871871
872872 // Close the window and restart the application
873− var closeButton = findChild(appDelegate, "closeWindowButton");
874− appDelegate = null;
875− verify(closeButton);
876− mouseClick(closeButton);
877− closeButton = null;
873+ appDelegate.close();
878874 tryCompare(topSurfaceList, "count", originalWindowCount);
879875 wait(100); // plus some spare room
880876 appDelegate = startApplication("dialer-app");