git.lucas.co / cce-cloud
cloud storage client
git clone https://git.lucas.co/cce-cloud.git

commitc4106544126ff39c4b8ba747d78129767c6f8529
parent2b720be7bd
authorLucas Galante <[email protected]>
date2026-07-13 09:29
refactor: dispatch roots go by WidgetId (cce-ui plumbing retype)

propagate_event takes a WidgetId resolved through the registry; dispatch
sites name roots by id instead of minting raw pointers, and roots the
render path never registered are registered explicitly.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N4ajhvVZtyEEEus9bodsj3

 src/main.rs | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 130b158..6c1e924 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1726,8 +1726,9 @@ impl PointerHandler for AppState {
                                     local_x: event.position.0 as f32,
                                     local_y: event.position.1 as f32,
                                 };
-                                let ptr = jl.as_ptr_mut();
-                                if st.ui_context.propagate_event(&mv, ptr) {
+                                let root = jl.id();
+                                st.ui_context.register_widget(root, jl.as_ptr_mut());
+                                if st.ui_context.propagate_event(&mv, root) {
                                     changed = true;
                                 }
                             }
@@ -1752,8 +1753,9 @@ impl PointerHandler for AppState {
                                         local_x: event.position.0 as f32,
                                         local_y: event.position.1 as f32,
                                     };
-                                    let ptr = jl.as_ptr_mut();
-                                    if st.ui_context.propagate_event(&ev, ptr) {
+                                    let root = jl.id();
+                                    st.ui_context.register_widget(root, jl.as_ptr_mut());
+                                    if st.ui_context.propagate_event(&ev, root) {
                                         changed = true;
                                     }
                                 }
@@ -1772,8 +1774,9 @@ impl PointerHandler for AppState {
                                         local_x: event.position.0 as f32,
                                         local_y: event.position.1 as f32,
                                     };
-                                    let ptr = st.fuzzel.as_ptr_mut();
-                                    st.ui_context.propagate_event(&ev, ptr)
+                                    let root = st.fuzzel.id();
+                                    st.ui_context.register_widget(root, st.fuzzel.as_ptr_mut());
+                                    st.ui_context.propagate_event(&ev, root)
                                 };
                                 if changed {
                                     if st.fuzzel.selected == prev_selected || st.switcher_mode || st.mode == LauncherMode::Dmenu {
@@ -1816,8 +1819,9 @@ impl PointerHandler for AppState {
                                         local_x: event.position.0 as f32,
                                         local_y: event.position.1 as f32,
                                     };
-                                    let ptr = jl.as_ptr_mut();
-                                    if st.ui_context.propagate_event(&ev, ptr) {
+                                    let root = jl.id();
+                                    st.ui_context.register_widget(root, jl.as_ptr_mut());
+                                    if st.ui_context.propagate_event(&ev, root) {
                                         changed = true;
                                     }
                                     for w in &mut jl.widgets {
@@ -2154,8 +2158,9 @@ impl AppState {
                 };
                 if let Some(jl) = &mut st.json_layout {
                     let kev = cce_ui::widget::Event::KeyInput(key_event.clone());
-                    let ptr = jl.as_ptr_mut();
-                    if st.ui_context.propagate_event(&kev, ptr) {
+                    let root = jl.id();
+                    st.ui_context.register_widget(root, jl.as_ptr_mut());
+                    if st.ui_context.propagate_event(&kev, root) {
                         widget_handled = true;
                         st.upload_vertices();
                         self.redraw = true;