login greeter
git clone https://git.lucas.co/cce-display-manager.git
refactor: register widgets by reference (UiContext::register_host)
register_widget(id, ptr) took a raw pointer in a safe function; cce-ui is
making it an unsafe fn now that every app registers through
register_host(&mut w), which takes the widget's own id and a live borrow.
Registration loops that existed only to hand the registry raw pointers
(and the unsafe blocks and self_ptr casts around them) are gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/main.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index d638274..8df41eb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -413,9 +413,9 @@ impl State {
// Root Container DISSOLVED (Phase 6ax): the card and the session list are the two
// dispatch/walk roots; register them directly (link_parent_child used to do it as a
// side effect of the root links).
- ctx.register_widget(self.bg.id(), self.bg.as_ptr_mut());
- ctx.register_widget(self.card.id(), self.card.as_ptr_mut());
- ctx.register_widget(self.session_list.id(), self.session_list.as_ptr_mut());
+ ctx.register_host(&mut self.bg);
+ ctx.register_host(&mut self.card);
+ ctx.register_host(&mut self.session_list);
focus::link_parent_child(&mut self.card, &mut self.username_box, ctx);
focus::link_parent_child(&mut self.card, &mut self.password_box, ctx);
focus::link_parent_child(&mut self.card, &mut self.login_btn, ctx);