on xenial help sign in
enable revealing the launcher by hitting the left edge using the mouse
0fbe561Michael Zanetti
qml/Launcher/Launcher.qml+40−3
@@ -93,10 +93,10 @@ Item {
93 Timer {
93 Timer {
94 id: dismissTimer
94 id: dismissTimer
95 objectName: "dismissTimer"
95 objectName: "dismissTimer"
96− interval: 5000
96+ interval: 500
97 onTriggered: {
97 onTriggered: {
98 if (root.autohideEnabled) {
98 if (root.autohideEnabled) {
99− if (!panel.preventHiding) {
99+ if (!panel.preventHiding && !hoverArea.containsMouse) {
100 root.state = ""
100 root.state = ""
101 } else {
101 } else {
102 dismissTimer.restart()
102 dismissTimer.restart()
@@ -159,7 +159,7 @@ Item {
159
159
160 MouseArea {
160 MouseArea {
161 id: launcherDragArea
161 id: launcherDragArea
162− enabled: root.available && root.state == "visible"
162+ enabled: root.available && (root.state == "visible" || root.state == "visibleTemporary")
163 anchors.fill: panel
163 anchors.fill: panel
164 anchors.rightMargin: -units.gu(2)
164 anchors.rightMargin: -units.gu(2)
165 drag {
165 drag {
@@ -245,6 +245,33 @@ Item {
245 }
245 }
246 }
246 }
247
247
248+ // TODO: This should be replaced by some mechanism that reveals the launcher
249+ // after a certain resistance has been overcome, like unity7 does. However,
250+ // as we don't get relative mouse coordinates yet, this will do for now.
251+ MouseArea {
252+ id: hoverArea
253+ anchors { fill: panel; rightMargin: -1 }
254+ hoverEnabled: true
255+ propagateComposedEvents: true
256+ onContainsMouseChanged: {
257+ if (containsMouse) {
258+ root.switchToNextState("visibleTemporary");
259+ } else {
260+ dismissTimer.restart();
261+ }
262+ }
263+ onPressed: mouse.accepted = false;
264+
265+ // We need to eat touch events here in order to make sure that
266+ // we don't trigger both, the dragArea and the hoverArea
267+ MultiPointTouchArea {
268+ anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
269+ width: units.dp(1)
270+ mouseEnabled: false
271+ enabled: parent.enabled
272+ }
273+ }
274+
248 EdgeDragArea {
275 EdgeDragArea {
249 id: dragArea
276 id: dragArea
250 objectName: "launcherDragArea"
277 objectName: "launcherDragArea"
@@ -300,6 +327,16 @@ Item {
300 target: panel
327 target: panel
301 x: -root.x // so we never go past panelWidth, even when teased by tutorial
328 x: -root.x // so we never go past panelWidth, even when teased by tutorial
302 }
329 }
330+ PropertyChanges { target: hoverArea; enabled: false }
331+ },
332+ State {
333+ name: "visibleTemporary"
334+ extend: "visible"
335+ PropertyChanges {
336+ target: root
337+ autohideEnabled: true
338+ }
339+ PropertyChanges { target: hoverArea; enabled: true }
303 },
340 },
304 State {
341 State {
305 name: "teasing"
342 name: "teasing"