on xenial help sign in
Do not hide panel when launching an application if the mouse is on the panel
feeb59eAlbert Astals Cid
plugins/Utils/globalfunctions.cpp+5
@@ -51,3 +51,8 @@ QQuickItem *GlobalFunctions::itemAt(QQuickItem* parent, int x, int y, QJSValue m
51 }
51 }
52 return nullptr;
52 return nullptr;
53}
53}
54+
55+bool GlobalFunctions::itemUnderMouse(QQuickItem* item)
56+{
57+ return item && item->isUnderMouse();
58+}
plugins/Utils/globalfunctions.h+2
@@ -37,6 +37,8 @@ public:
37 int x,
37 int x,
38 int y,
38 int y,
39 QJSValue matcher);
39 QJSValue matcher);
40+
41+ static Q_INVOKABLE bool itemUnderMouse(QQuickItem* item);
40};
42};
41
43
42#endif // GLOBALFUNCTIONS_H
44#endif // GLOBALFUNCTIONS_H
qml/Launcher/Launcher.qml+9−3
@@ -19,10 +19,13 @@ import "../Components"
19import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
20import Ubuntu.Gestures 0.1
20import Ubuntu.Gestures 0.1
21import Unity.Launcher 0.1
21import Unity.Launcher 0.1
22+import Utils 0.1 as Utils
22
23
23FocusScope {
24FocusScope {
24 id: root
25 id: root
25
26
27+ readonly property int ignoreHideIfMouseOverLauncher: 1
28+
26 property bool autohideEnabled: false
29 property bool autohideEnabled: false
27 property bool lockedVisible: false
30 property bool lockedVisible: false
28 property bool available: true // can be used to disable all interactions
31 property bool available: true // can be used to disable all interactions
@@ -102,7 +105,10 @@ FocusScope {
102 }
105 }
103 }
106 }
104
107
105− function hide() {
108+ function hide(flags) {
109+ if ((flags & ignoreHideIfMouseOverLauncher) && Utils.Functions.itemUnderMouse(panel)) {
110+ return;
111+ }
106 switchToNextState("")
112 switchToNextState("")
107 }
113 }
108
114
@@ -359,11 +365,11 @@ FocusScope {
359 property bool animate: true
365 property bool animate: true
360
366
361 onApplicationSelected: {
367 onApplicationSelected: {
362− root.hide();
368+ root.hide(ignoreHideIfMouseOverLauncher);
363 launcherApplicationSelected(appId)
369 launcherApplicationSelected(appId)
364 }
370 }
365 onShowDashHome: {
371 onShowDashHome: {
366− root.hide();
372+ root.hide(ignoreHideIfMouseOverLauncher);
367 root.showDashHome();
373 root.showDashHome();
368 }
374 }
369
375
qml/Shell.qml+1−1
@@ -132,7 +132,7 @@ StyledItem {
132 greeter.notifyAppFocusRequested(appId);
132 greeter.notifyAppFocusRequested(appId);
133
133
134 panel.indicators.hide();
134 panel.indicators.hide();
135− launcher.hide();
135+ launcher.hide(launcher.ignoreHideIfMouseOverLauncher);
136 }
136 }
137
137
138 // For autopilot consumption
138 // For autopilot consumption