on xenial help sign in
improve the whole async DashCommunicator logic
commit720d0eef8e731083755e1cfb34f8175c4f6d19e2 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 19 Sep 2014, 13:08 (12 years ago) parent2d99d78
2 files changed+18−5
plugins/Unity/DashCommunicator/dashcommunicator.cpp+11−5 qml/Shell.qml+7
plugins/Unity/DashCommunicator/dashcommunicator.cpp+11−5
@@ -47,6 +47,8 @@ void DashCommunicator::setCurrentScope(const QString &scopeId, bool animate, boo
4747 }
4848
4949 if (m_dashInterface && m_dashInterface->isValid()) {
50+ // Using an async call just in case the Dash would fail to wake up from suspend
51+ // We don't want to hang the whole shell waiting for reply.
5052 m_dashInterface->asyncCall("SetCurrentScope", scopeId, animate, isSwipe);
5153 }
5254}
@@ -60,6 +62,7 @@ void DashCommunicator::connectToDash()
6062
6163 if (m_applicationManager) {
6264 ApplicationInfoInterface *dash = m_applicationManager->findApplication("unity8-dash");
65+ // Don't try to connect to the Dash while its suspended, it would hang the shell waiting for a reply.
6366 if (dash && dash->state() == ApplicationInfoInterface::Running) {
6467 QDBusConnection connection = QDBusConnection::sessionBus();
6568 m_dashInterface = new QDBusInterface("com.canonical.UnityDash",
@@ -85,9 +88,10 @@ void DashCommunicator::setApplicationManager(unity::shell::application::Applicat
8588
8689 connect(m_applicationManager, &unity::shell::application::ApplicationManagerInterface::applicationAdded, this, &DashCommunicator::applicationAdded);
8790 connect(m_applicationManager, &unity::shell::application::ApplicationManagerInterface::applicationRemoved, this, &DashCommunicator::applicationRemoved);
88−
91+
92+ // If the Dash is around already, immediately try to connect
8993 if (m_applicationManager->findApplication("unity8-dash")) {
90− applicationAdded("unity8-dash");
94+ connectToDash();
9195 }
9296 }
9397}
@@ -99,7 +103,7 @@ void DashCommunicator::applicationAdded(const QString &appId)
99103 }
100104 ApplicationInfoInterface *app = m_applicationManager->findApplication(appId);
101105 if (!app) {
102− qWarning() << "DashCommunicator received an applicationAdded signal for dash, but there's no dash!";
106+ qWarning() << "DashCommunicator received an applicationAdded signal for the dash, but there's no dash around!";
103107 return;
104108 }
105109 connectToDash();
@@ -110,6 +114,8 @@ void DashCommunicator::applicationRemoved(const QString &appId)
110114 if (appId != "unity8-dash") {
111115 return;
112116 }
113− m_dashInterface->deleteLater();
114− m_dashInterface = nullptr;
117+ if (m_dashInterface) {
118+ m_dashInterface->deleteLater();
119+ m_dashInterface = nullptr;
120+ }
115121}
qml/Shell.qml+7
@@ -106,6 +106,13 @@ Item {
106106 applicationManager: ApplicationManager
107107 }
108108
109+ Binding {
110+ target: ApplicationManager
111+ property: "dashActive"
112+ value: launcher.shown || launcher.dashSwipe
113+ }
114+
115+
109116 WindowKeysFilter {
110117 // Handle but do not filter out volume keys
111118 Keys.onVolumeUpPressed: { volumeControl.volumeUp(); event.accepted = false; }