@@ -19,6 +19,7 @@
1919#include "AccountsService.h"
2020#include "AccountsServiceDBusAdaptor.h"
2121
22+#include <QDBusInterface>
2223#include <QFile>
2324#include <QStringList>
2425#include <QDebug>
@@ -35,6 +36,11 @@ AccountsService::AccountsService(QObject* parent, const QString &user)
3536 m_hereEnabled(false),
3637 m_hereLicensePath() // null means not set yet
3738{
39+ m_unityInput = new QDBusInterface(QStringLiteral("com.canonical.Unity.Input"),
40+ QStringLiteral("/com/canonical/Unity/Input"),
41+ QStringLiteral("com.canonical.Unity.Input"),
42+ QDBusConnection::SM_BUSNAME(), this);
43+
3844 connect(m_service, &AccountsServiceDBusAdaptor::propertiesChanged, this, &AccountsService::onPropertiesChanged);
3945 connect(m_service, &AccountsServiceDBusAdaptor::maybeChanged, this, &AccountsService::onMaybeChanged);
4046
@@ -58,6 +64,8 @@ void AccountsService::setUser(const QString &user)
5864 updateEnableLauncherWhileLocked(false);
5965 updateEnableIndicatorsWhileLocked(false);
6066 updateBackgroundFile(false);
67+ updateMouseCursorSpeed();
68+ updateTouchpadCursorSpeed();
6169 updateStatsWelcomeScreen(false);
6270 updatePasswordDisplayHint(false);
6371 updateFailedLogins(false);
@@ -246,6 +254,52 @@ void AccountsService::updateBackgroundFile(bool async)
246254 }
247255}
248256
257+void AccountsService::updateMouseCursorSpeed()
258+{
259+ QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
260+ QStringLiteral("com.ubuntu.AccountsService.Input"),
261+ QStringLiteral("MouseCursorSpeed"));
262+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
263+
264+ connect(watcher, &QDBusPendingCallWatcher::finished,
265+ this, [this](QDBusPendingCallWatcher* watcher) {
266+
267+ QDBusPendingReply<QVariant> reply = *watcher;
268+ watcher->deleteLater();
269+ if (reply.isError()) {
270+ qWarning() << "Failed to get 'MouseCursorSpeed' property - " << reply.error().message();
271+ return;
272+ }
273+
274+ // Merely proxy this along to USC. We don't care about keeping a copy
275+ // or exporting it internally.
276+ m_unityInput->asyncCall(QStringLiteral("setMouseCursorSpeed"), reply.value());
277+ });
278+}
279+
280+void AccountsService::updateTouchpadCursorSpeed()
281+{
282+ QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
283+ QStringLiteral("com.ubuntu.AccountsService.Input"),
284+ QStringLiteral("TouchpadCursorSpeed"));
285+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
286+
287+ connect(watcher, &QDBusPendingCallWatcher::finished,
288+ this, [this](QDBusPendingCallWatcher* watcher) {
289+
290+ QDBusPendingReply<QVariant> reply = *watcher;
291+ watcher->deleteLater();
292+ if (reply.isError()) {
293+ qWarning() << "Failed to get 'TouchpadCursorSpeed' property - " << reply.error().message();
294+ return;
295+ }
296+
297+ // Merely proxy this along to USC. We don't care about keeping a copy
298+ // or exporting it internally.
299+ m_unityInput->asyncCall(QStringLiteral("setTouchpadCursorSpeed"), reply.value());
300+ });
301+}
302+
249303void AccountsService::updateStatsWelcomeScreen(bool async)
250304{
251305 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
@@ -423,6 +477,13 @@ void AccountsService::onPropertiesChanged(const QString &user, const QString &in
423477 if (changed.contains(QStringLiteral("FailedLogins"))) {
424478 updateFailedLogins();
425479 }
480+ } else if (interface == QLatin1String("com.ubuntu.AccountsService.Input")) {
481+ if (changed.contains(QStringLiteral("MouseCursorSpeed"))) {
482+ updateMouseCursorSpeed();
483+ }
484+ if (changed.contains(QStringLiteral("TouchpadCursorSpeed"))) {
485+ updateTouchpadCursorSpeed();
486+ }
426487 } else if (interface == QLatin1String("com.ubuntu.touch.AccountsService.SecurityPrivacy")) {
427488 if (changed.contains(QStringLiteral("StatsWelcomeScreen"))) {
428489 updateStatsWelcomeScreen();