Sfoglia il codice sorgente

app/schema: fix some broken paths

darkfi 3 settimane fa
parent
commit
4344d9ba36

+ 0 - 1
bin/app/src/app/schema/chat.rs

@@ -681,7 +681,6 @@ pub async fn make(
                 window_scale.clone(),
                 renderer.clone(),
                 redraw.clone(),
-                sg_root.clone(),
                 ex.clone(),
             )
         })

+ 3 - 4
bin/app/src/app/schema/menu/channel.rs

@@ -1617,7 +1617,6 @@ pub async fn make(
     let sg_root = app.sg_root.clone();
     let renderer = app.renderer.clone();
     let ex = app.ex.clone();
-    let content2 = content.clone();
     let channel_vis = channel_is_visible.clone();
     let window_scale2 = window_scale.clone();
     let kv_db2 = kv_db.clone();
@@ -1629,7 +1628,7 @@ pub async fn make(
         while let Ok(data) = recvr.recv().await {
             let channel: String = deserialize(&data).unwrap();
             i!("Selected channel: {channel}");
-            let path = format!("/window/content/{}_chat_layer", &channel);
+            let path = format!("/window/content/chat/{}_chat_layer", &channel);
 
             let atom = &mut redraw2.make_guard(gfxtag!("channel_selected"));
 
@@ -1640,7 +1639,7 @@ pub async fn make(
                 continue;
             }
 
-            let content = sg_root.lookup_node("/window/content").unwrap();
+            let content = sg_root.lookup_node("/window/content/chat").unwrap();
             // Create the chat layer and get the node
             let node = chat::make(
                 &sg_root,
@@ -1664,7 +1663,7 @@ pub async fn make(
             node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
 
             // Add to main_menu items (check if not already there)
-            let main_menu = sg_root.lookup_node("/window/content/menu_layer/main_menu").unwrap();
+            let main_menu = sg_root.lookup_node("/window/content/chat/menu_layer/main_menu").unwrap();
             let items_prop = main_menu.get_property("items").unwrap();
 
             if !items_prop.contains_str(&channel) {

+ 3 - 3
bin/app/src/app/schema/menu/contact.rs

@@ -1530,7 +1530,7 @@ pub async fn make(
         while let Ok(data) = recvr.recv().await {
             let contact: String = deserialize(&data).unwrap();
             i!("Selected contact: {contact}");
-            let path = format!("/window/content/{}_chat_layer", &contact);
+            let path = format!("/window/content/chat/{}_chat_layer", &contact);
             let atom = &mut redraw2.make_guard(gfxtag!("contact_selected"));
 
             if let Some(node) = sg_root.lookup_node(&path) {
@@ -1539,7 +1539,7 @@ pub async fn make(
                 continue;
             }
 
-            let content = sg_root.lookup_node("/window/content").unwrap();
+            let content = sg_root.lookup_node("/window/content/chat").unwrap();
             let node = chat::make(
                 &sg_root,
                 &renderer,
@@ -1558,7 +1558,7 @@ pub async fn make(
             }
             node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
 
-            let main_menu = sg_root.lookup_node("/window/content/menu_layer/main_menu").unwrap();
+            let main_menu = sg_root.lookup_node("/window/content/chat/menu_layer/main_menu").unwrap();
             let items_prop = main_menu.get_property("items").unwrap();
             if !items_prop.contains_str(&contact) {
                 items_prop.push_str(atom, Role::App, &contact).unwrap();

+ 11 - 0
bin/app/src/app/schema/menu/mod.rs

@@ -490,6 +490,17 @@ pub async fn make(
                     debug!(target: "app::menu", "deleted item: {item}");
                     node.unlink();
                 }
+
+                // The selection overlay is a sibling of the chat layer, not
+                // a child: it needs z_index/priority above netstatus_layer,
+                // which it can only get in the shared parent. Remove it
+                // alongside so it does not leak.
+                let path = format!("/window/content/chat/{}_select_layer", item);
+                if let Some(node) = sg_root.lookup_node(&path) {
+                    node.clear_tasks();
+                    debug!(target: "app::menu", "deleted select overlay: {item}");
+                    node.unlink();
+                }
             }
 
             // Unlinking changes no property, so request a pass explicitly:

+ 0 - 1
bin/app/src/app/schema/test.rs

@@ -385,7 +385,6 @@ pub async fn make(app: &App, window: SceneNodePtr, i18n_fish: &I18nBabelFish) {
                 window_scale.clone(),
                 app.renderer.clone(),
                 app.redraw_trigger.clone(),
-                app.sg_root.clone(),
                 app.ex.clone(),
             )
         })