on xenial help sign in
Improve Launcher ←→ touch menu interaction

If launcher is shown: * Touch menus show shifted to the right to not overlap * When launcher is hidden they don't move back until you close them If touch menu is shown: * Opening the launcher closes them

commitbdc4f80741481d583f442725aa5e018b2f88fcef authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 8 Mar 2017, 15:53 (10 years ago) parent78e61ae
5 files changed+43−21
qml/Panel/Panel.qml+2 qml/Panel/PanelBar.qml+1 qml/Panel/PanelItemRow.qml+2−1 qml/Panel/PanelMenu.qml+31−19 qml/Shell.qml+7−1
qml/Panel/Panel.qml+2
@@ -41,6 +41,7 @@ Item {
4141 property real expandedPanelHeight: units.gu(7)
4242 property real indicatorMenuWidth: width
4343 property real applicationMenuWidth: width
44+ property alias applicationMenuContentX: __applicationMenus.menuContentX
4445
4546 property alias applicationMenus: __applicationMenus
4647 property alias indicators: __indicators
@@ -250,6 +251,7 @@ Item {
250251 PanelMenu {
251252 id: __applicationMenus
252253
254+ x: root.applicationMenuContentX
253255 model: registeredMenuModel.model
254256 width: root.applicationMenuWidth
255257 minimizedPanelHeight: root.minimizedPanelHeight
qml/Panel/PanelBar.qml+1
@@ -32,6 +32,7 @@ Item {
3232
3333 property alias showRowTitle: row.showRowTitle
3434 property alias rowTitle: row.rowTitle
35+ property alias shiftLeftTitle: row.shiftLeftTitle
3536 property alias rowItemDelegate: row.delegate
3637
3738 implicitWidth: flickable.contentWidth
qml/Panel/PanelItemRow.qml+2−1
@@ -25,6 +25,7 @@ Item {
2525
2626 property bool showRowTitle: false
2727 property alias rowTitle: rowLabel.text
28+ property real shiftLeftTitle: 0
2829 property QtObject model: null
2930 property real overFlowWidth: width
3031 property bool expanded: false
@@ -143,7 +144,7 @@ Item {
143144 objectName: "panelTitle"
144145 anchors {
145146 left: parent.left
146− leftMargin: units.gu(1)
147+ leftMargin: units.gu(1) - root.shiftLeftTitle
147148 verticalCenter: parent.verticalCenter
148149 }
149150 width: implicitWidth + units.gu(2)
qml/Panel/PanelMenu.qml+31−19
@@ -33,6 +33,7 @@ Showable {
3333 property bool enableHint: true
3434 property bool showOnClick: true
3535 property color panelColor: theme.palette.normal.background
36+ property real menuContentX: 0
3637
3738 property alias alignment: bar.alignment
3839 property alias rowTitle: bar.rowTitle
@@ -77,33 +78,42 @@ Showable {
7778
7879 shown: false
7980 height: minimizedPanelHeight
80− clip: root.partiallyOpened
8181
8282 onUnitProgressChanged: d.updateState()
8383
84− // eater
85− MouseArea {
86− anchors.fill: content
87− hoverEnabled: true
88− acceptedButtons: Qt.AllButtons
89− onWheel: wheel.accepted = true;
90− enabled: root.state != "initial"
91− visible: content.visible
92− }
93−
94− MenuContent {
95− id: content
96− objectName: "menuContent"
97−
84+ Item {
9885 anchors {
9986 left: parent.left
10087 right: parent.right
10188 top: bar.bottom
89+ bottom: parent.bottom
90+ }
91+ clip: root.partiallyOpened
92+
93+ // eater
94+ MouseArea {
95+ anchors.fill: content
96+ hoverEnabled: true
97+ acceptedButtons: Qt.AllButtons
98+ onWheel: wheel.accepted = true;
99+ enabled: root.state != "initial"
100+ visible: content.visible
101+ }
102+
103+ MenuContent {
104+ id: content
105+ objectName: "menuContent"
106+
107+ anchors {
108+ left: parent.left
109+ right: parent.right
110+ top: parent.top
111+ }
112+ height: openedHeight - bar.height - handle.height
113+ model: root.model
114+ visible: root.unitProgress > 0
115+ currentMenuIndex: bar.currentItemIndex
102116 }
103− height: openedHeight - bar.height - handle.height
104− model: root.model
105− visible: root.unitProgress > 0
106− currentMenuIndex: bar.currentItemIndex
107117 }
108118
109119 Handle {
@@ -165,6 +175,7 @@ Showable {
165175 enableLateralChanges: false
166176 lateralPosition: -1
167177 unitProgress: root.unitProgress
178+ shiftLeftTitle: root.menuContentX
168179
169180 height: expanded ? expandedPanelHeight : minimizedPanelHeight
170181 Behavior on height { NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing } }
@@ -217,6 +228,7 @@ Showable {
217228 objectName: "showDragHandle"
218229 anchors.bottom: parent.bottom
219230 anchors.left: alignment == Qt.AlignLeft ? parent.left : undefined
231+ anchors.leftMargin: -root.menuContentX
220232 anchors.right: alignment == Qt.AlignRight ? parent.right : undefined
221233 width: root.barWidth // show handle should only cover panel items.
222234 height: minimizedPanelHeight
qml/Shell.qml+7−1
@@ -499,6 +499,11 @@ StyledItem {
499499 expandedPanelHeight: units.gu(7)
500500 indicatorMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
501501 applicationMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
502+ applicationMenuContentX: {
503+ if (launcher.shown) return launcher.panelWidth;
504+ else if (!applicationMenus.fullyClosed) return applicationMenus.x;
505+ else return 0;
506+ }
502507
503508 indicators {
504509 hides: [launcher]
@@ -565,7 +570,8 @@ StyledItem {
565570 }
566571 onShownChanged: {
567572 if (shown) {
568− panel.indicators.hide()
573+ panel.indicators.hide();
574+ panel.applicationMenus.hide();
569575 }
570576 }
571577 onFocusChanged: {