on xenial help sign in
Do not hide panel when launching an application if the mouse is on the panel

Need Functions.itemUnderMouse because MouseArea.containsMouse returns true when tapping (i.e. no mouse used) on it. Unfortunately the QML testlib do not set the proper value when issueing a mouseMove so i can't add a test that proofs it works, i'll try to propose something upstream and then add the test at a later MR (LP: #1591311) Approved by: Lukáš Tinkl, Unity8 CI Bot

commit800ba870b935dcb66825b6dfd23d4217b4d74ee5 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 7 Dec 2016, 13:47 (10 years ago) parentf323373feeb59e
4 files changed+17−4
plugins/Utils/globalfunctions.cpp+5 plugins/Utils/globalfunctions.h+2 qml/Launcher/Launcher.qml+9−3 qml/Shell.qml+1−1
plugins/Utils/globalfunctions.cpp+5
@@ -51,3 +51,8 @@ QQuickItem *GlobalFunctions::itemAt(QQuickItem* parent, int x, int y, QJSValue m
5151 }
5252 return nullptr;
5353}
54+
55+bool GlobalFunctions::itemUnderMouse(QQuickItem* item)
56+{
57+ return item && item->isUnderMouse();
58+}
plugins/Utils/globalfunctions.h+2
@@ -37,6 +37,8 @@ public:
3737 int x,
3838 int y,
3939 QJSValue matcher);
40+
41+ static Q_INVOKABLE bool itemUnderMouse(QQuickItem* item);
4042};
4143
4244#endif // GLOBALFUNCTIONS_H
qml/Launcher/Launcher.qml+9−3
@@ -19,10 +19,13 @@ import "../Components"
1919import Ubuntu.Components 1.3
2020import Ubuntu.Gestures 0.1
2121import Unity.Launcher 0.1
22+import Utils 0.1 as Utils
2223
2324FocusScope {
2425 id: root
2526
27+ readonly property int ignoreHideIfMouseOverLauncher: 1
28+
2629 property bool autohideEnabled: false
2730 property bool lockedVisible: false
2831 property bool available: true // can be used to disable all interactions
@@ -105,7 +108,10 @@ FocusScope {
105108 }
106109 }
107110
108− function hide() {
111+ function hide(flags) {
112+ if ((flags & ignoreHideIfMouseOverLauncher) && Utils.Functions.itemUnderMouse(panel)) {
113+ return;
114+ }
109115 switchToNextState("")
110116 }
111117
@@ -416,11 +422,11 @@ FocusScope {
416422 property bool animate: true
417423
418424 onApplicationSelected: {
419− root.hide();
425+ root.hide(ignoreHideIfMouseOverLauncher);
420426 launcherApplicationSelected(appId)
421427 }
422428 onShowDashHome: {
423− root.hide();
429+ root.hide(ignoreHideIfMouseOverLauncher);
424430 root.showDashHome();
425431 }
426432
qml/Shell.qml+1−1
@@ -124,7 +124,7 @@ StyledItem {
124124 greeter.notifyAppFocusRequested(appId);
125125
126126 panel.indicators.hide();
127− launcher.hide();
127+ launcher.hide(launcher.ignoreHideIfMouseOverLauncher);
128128 }
129129
130130 // For autopilot consumption