on xenial help sign in
Do not hide panel when launching an application if the mouse is on the panel
commitfeeb59e21411df7028a1c41536537236beb8e46e authorAlbert Astals Cid <albert.astals@canonical.com> dateFri 14 Oct 2016, 13:04 (10 years ago) parent03243cb
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
@@ -102,7 +105,10 @@ FocusScope {
102105 }
103106 }
104107
105− function hide() {
108+ function hide(flags) {
109+ if ((flags & ignoreHideIfMouseOverLauncher) && Utils.Functions.itemUnderMouse(panel)) {
110+ return;
111+ }
106112 switchToNextState("")
107113 }
108114
@@ -359,11 +365,11 @@ FocusScope {
359365 property bool animate: true
360366
361367 onApplicationSelected: {
362− root.hide();
368+ root.hide(ignoreHideIfMouseOverLauncher);
363369 launcherApplicationSelected(appId)
364370 }
365371 onShowDashHome: {
366− root.hide();
372+ root.hide(ignoreHideIfMouseOverLauncher);
367373 root.showDashHome();
368374 }
369375
qml/Shell.qml+1−1
@@ -132,7 +132,7 @@ StyledItem {
132132 greeter.notifyAppFocusRequested(appId);
133133
134134 panel.indicators.hide();
135− launcher.hide();
135+ launcher.hide(launcher.ignoreHideIfMouseOverLauncher);
136136 }
137137
138138 // For autopilot consumption