From 338680fab54e6b84fcde45f962d9548ea865ca73 Mon Sep 17 00:00:00 2001
From: Maximiliano Sandoval <msandova@gnome.org>
Date: Sat, 17 Feb 2024 15:28:07 +0100
Subject: [PATCH] window: Add timeout to get focus
---
src/widgets/window.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/widgets/window.rs b/src/widgets/window.rs
index 558bf31..62ba9b6 100644
--- a/src/widgets/window.rs
+++ b/src/widgets/window.rs
@@ -173,6 +173,10 @@ mod imp {
self.parent_map();
let camera = self.camera.get();
glib::spawn_future_local(glib::clone!(@weak camera => async move {
+ // HACK we add a small timeout to give the shell time to get the
+ // windows focus, otherwise the Shell won't ask for camera
+ // permission.
+ glib::timeout_future(std::time::Duration::from_millis(50)).await;
camera.start().await;
}));
}
--
2.43.2