on xenial help sign in
Do not hide panel when launching an application if the mouse is on the panel
800ba87Albert 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
@@ -105,7 +108,10 @@ FocusScope {
105 }
108 }
106 }
109 }
107
110
108− function hide() {
111+ function hide(flags) {
112+ if ((flags & ignoreHideIfMouseOverLauncher) && Utils.Functions.itemUnderMouse(panel)) {
113+ return;
114+ }
109 switchToNextState("")
115 switchToNextState("")
110 }
116 }
111
117
@@ -416,11 +422,11 @@ FocusScope {
416 property bool animate: true
422 property bool animate: true
417
423
418 onApplicationSelected: {
424 onApplicationSelected: {
419− root.hide();
425+ root.hide(ignoreHideIfMouseOverLauncher);
420 launcherApplicationSelected(appId)
426 launcherApplicationSelected(appId)
421 }
427 }
422 onShowDashHome: {
428 onShowDashHome: {
423− root.hide();
429+ root.hide(ignoreHideIfMouseOverLauncher);
424 root.showDashHome();
430 root.showDashHome();
425 }
431 }
426
432
qml/Shell.qml+1−1
@@ -124,7 +124,7 @@ StyledItem {
124 greeter.notifyAppFocusRequested(appId);
124 greeter.notifyAppFocusRequested(appId);
125
125
126 panel.indicators.hide();
126 panel.indicators.hide();
127− launcher.hide();
127+ launcher.hide(launcher.ignoreHideIfMouseOverLauncher);
128 }
128 }
129
129
130 // For autopilot consumption
130 // For autopilot consumption