From 2eb763441c27d2b19e0be615ca24cc6f8408547a Mon Sep 17 00:00:00 2001 From: trigg Date: Sun, 29 Mar 2026 13:50:43 +0100 Subject: [PATCH] locker: remove _sync usage in fingerprint reader --- src/locker/plugin/fingerprint.cpp | 99 +++++++++++++++++-------------- 1 file changed, 56 insertions(+), 43 deletions(-) diff --git a/src/locker/plugin/fingerprint.cpp b/src/locker/plugin/fingerprint.cpp index 41bbf6c3..3bd69072 100644 --- a/src/locker/plugin/fingerprint.cpp +++ b/src/locker/plugin/fingerprint.cpp @@ -3,7 +3,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -29,7 +31,7 @@ WayfireLockerFingerprintPlugin::~WayfireLockerFingerprintPlugin() { if (device_proxy) { - device_proxy->call_sync("Release"); + device_proxy->call("Release"); } } @@ -62,14 +64,17 @@ void WayfireLockerFingerprintPlugin::get_device() } try { - auto default_device = manager_proxy->call_sync("GetDefaultDevice"); - Glib::Variant item_path; - default_device.get_child(item_path, 0); - Gio::DBus::Proxy::create(connection, - "net.reactivated.Fprint", - item_path.get(), - "net.reactivated.Fprint.Device", - sigc::mem_fun(*this, &WayfireLockerFingerprintPlugin::on_device_acquired)); + manager_proxy->call("GetDefaultDevice", [=] (Glib::RefPtr& result) + { + auto default_device = manager_proxy->call_finish(result); + Glib::Variant item_path; + default_device.get_child(item_path, 0); + Gio::DBus::Proxy::create(connection, + "net.reactivated.Fprint", + item_path.get(), + "net.reactivated.Fprint.Device", + sigc::mem_fun(*this, &WayfireLockerFingerprintPlugin::on_device_acquired)); + }); } catch (Glib::Error & e) /* TODO : Narrow down? */ { hide(); @@ -82,26 +87,29 @@ void WayfireLockerFingerprintPlugin::on_device_acquired(const Glib::RefPtrcall_sync("ListEnrolledFingers", nullptr, - Glib::Variant>::create(username)); - Glib::Variant> array; - reply.get_child(array, 0); - - if (array.get_n_children() == 0) + device_proxy->call("ListEnrolledFingers", [=] (Glib::RefPtr& result) { - // Zero fingers for this user. - show(); - update("No fingerprints enrolled", "dialog-error-symbolic", "bad"); - // Don't hide entirely, allow the user to see this specific fail - return; - } + auto reply = device_proxy->call_finish(result); + Glib::Variant> array; + reply.get_child(array, 0); - show(); - update("Fingerprint Device Ready", "system-search-symbolic", "info"); - Glib::Variant finger; - reply.get_child(finger, 0); + if (array.get_n_children() == 0) + { + // Zero fingers for this user. + show(); + update("No fingerprints enrolled", "dialog-error-symbolic", "bad"); + // Don't hide entirely, allow the user to see this specific fail + return; + } - start_fingerprint_scanning(); + show(); + update("Fingerprint Device Ready", "system-search-symbolic", "info"); + Glib::Variant finger; + reply.get_child(finger, 0); + + start_fingerprint_scanning(); + }, + Glib::Variant>::create(username)); } void WayfireLockerFingerprintPlugin::start_fingerprint_scanning() @@ -218,7 +226,13 @@ void WayfireLockerFingerprintPlugin::start_fingerprint_scanning() try { char *username = getlogin(); - device_proxy->call_sync("Claim", nullptr, + device_proxy->call("Claim", [=] (Glib::RefPtr& result) + { + show(); + update("Use fingerprint to unlock", "process-completed-symbolic", "good"); + device_proxy->call("VerifyStart", + Glib::Variant>::create({""})); + }, Glib::Variant>::create({username})); } catch (Glib::Error & e) /* TODO : Narrow down? */ { @@ -233,12 +247,6 @@ void WayfireLockerFingerprintPlugin::start_fingerprint_scanning() }, 3); return; } - - show(); - update("Use fingerprint to unlock", "process-completed-symbolic", "good"); - device_proxy->call_sync("VerifyStart", - nullptr, - Glib::Variant>::create({""})); } else { update("Unable to start fingerprint scan", "dialog-error-symbolic", "bad"); @@ -266,8 +274,10 @@ void WayfireLockerFingerprintPlugin::stop_fingerprint_scanning() /* Stop if running. Eventually log or respond to errors * but for now, avoid crashing lockscreen on close-down */ try { - device_proxy->call_sync("VerifyStop"); - device_proxy->call_sync("Release"); + device_proxy->call("VerifyStop", [=] (Glib::RefPtr& result) + { + device_proxy->call("Release"); + }); } catch (Glib::Error & e) {} } @@ -291,14 +301,17 @@ void WayfireLockerFingerprintPlugin::init() { auto manager_proxy = Gio::DBus::Proxy::create_finish(result); try { - auto default_device = manager_proxy->call_sync("GetDefaultDevice"); - Glib::Variant item_path; - default_device.get_child(item_path, 0); - Gio::DBus::Proxy::create(connection, - "net.reactivated.Fprint", - item_path.get(), - "net.reactivated.Fprint.Device", - sigc::mem_fun(*this, &WayfireLockerFingerprintPlugin::on_device_acquired)); + manager_proxy->call("GetDefaultDevice", [=] (Glib::RefPtr & result) + { + auto default_device = manager_proxy->call_finish(result); + Glib::Variant item_path; + default_device.get_child(item_path, 0); + Gio::DBus::Proxy::create(connection, + "net.reactivated.Fprint", + item_path.get(), + "net.reactivated.Fprint.Device", + sigc::mem_fun(*this, &WayfireLockerFingerprintPlugin::on_device_acquired)); + }); } catch (Glib::Error & e) /* TODO : Narrow down? */ { hide();