Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Replace unrendered frame with a frame counter

Piotr Osiewicz714b45157b74
diff --git a/Cargo.lock b/Cargo.lock
index 27ff88f68a4..90cc0460ff2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1206,6 +1206,7 @@ dependencies = [
"serde_json",
"settings2",
"smallvec",
+ "ui2",
"util",
"workspace2",
]
diff --git a/crates/call2/Cargo.toml b/crates/call2/Cargo.toml
index a258cbe2cf3..8dc37f68dd7 100644
--- a/crates/call2/Cargo.toml
+++ b/crates/call2/Cargo.toml
@@ -31,6 +31,7 @@ media = { path = "../media" }
project = { package = "project2", path = "../project2" }
settings = { package = "settings2", path = "../settings2" }
util = { path = "../util" }
+ui = {package = "ui2", path = "../ui2"}
workspace = {package = "workspace2", path = "../workspace2"}
async-trait.workspace = true
anyhow.workspace = true
diff --git a/crates/call2/src/call2.rs b/crates/call2/src/call2.rs
index f9a7e4bcfa8..1cffc44f93a 100644
--- a/crates/call2/src/call2.rs
+++ b/crates/call2/src/call2.rs
@@ -592,13 +592,9 @@ impl CallHandler for Call {
cx: &mut ViewContext<Workspace>,
) -> Option<Box<dyn ItemHandle>> {
let (call, _) = self.active_call.as_ref()?;
- dbg!("A");
let room = call.read(cx).room()?.read(cx);
- dbg!("B");
let participant = room.remote_participant_for_peer_id(peer_id)?;
- dbg!("C");
let track = participant.video_tracks.values().next()?.clone();
- dbg!("D");
let user = participant.user.clone();
for item in pane.read(cx).items_of_type::<SharedScreen>() {
if item.read(cx).peer_id == peer_id {
diff --git a/crates/call2/src/room.rs b/crates/call2/src/room.rs
index 1f299ff6cb9..b55d3348dcc 100644
--- a/crates/call2/src/room.rs
+++ b/crates/call2/src/room.rs
@@ -1342,8 +1342,6 @@ impl Room {
let display = displays
.first()
.ok_or_else(|| anyhow!("no display found"))?;
- dbg!("Been there");
- dbg!(displays.len());
let track = LocalVideoTrack::screen_share_for_display(&display);
this.upgrade()
.ok_or_else(|| anyhow!("room was dropped"))?
diff --git a/crates/call2/src/shared_screen.rs b/crates/call2/src/shared_screen.rs
index 6f0024b63da..7b7cd7d9df3 100644
--- a/crates/call2/src/shared_screen.rs
+++ b/crates/call2/src/shared_screen.rs
@@ -3,8 +3,8 @@ use anyhow::Result;
use client::{proto::PeerId, User};
use futures::StreamExt;
use gpui::{
- div, img, AppContext, Div, Element, EventEmitter, FocusHandle, FocusableView, ImageData,
- ParentElement, Render, SharedString, Task, View, ViewContext, VisualContext, WindowContext,
+ div, AppContext, Div, Element, EventEmitter, FocusHandle, FocusableView, ParentElement, Render,
+ SharedString, Task, View, ViewContext, VisualContext, WindowContext,
};
use std::sync::{Arc, Weak};
use workspace::{item::Item, ItemNavHistory, WorkspaceId};
@@ -16,6 +16,8 @@ pub enum Event {
pub struct SharedScreen {
track: Weak<RemoteVideoTrack>,
frame: Option<Frame>,
+ // temporary addition just to render something interactive.
+ current_frame_id: usize,
pub peer_id: PeerId,
user: Arc<User>,
nav_history: Option<ItemNavHistory>,
@@ -49,6 +51,7 @@ impl SharedScreen {
Ok(())
}),
focus: cx.focus_handle(),
+ current_frame_id: 0,
}
}
}
@@ -65,11 +68,14 @@ impl Render for SharedScreen {
type Element = Div;
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
let frame = self.frame.clone();
- div().children(frame.map(|frame| {
- img().data(Arc::new(ImageData::new(image::ImageBuffer::new(
- frame.width() as u32,
- frame.height() as u32,
- ))))
+ let frame_id = self.current_frame_id;
+ self.current_frame_id = self.current_frame_id.wrapping_add(1);
+ div().children(frame.map(|_| {
+ ui::Label::new(frame_id.to_string()).color(ui::Color::Error)
+ // img().data(Arc::new(ImageData::new(image::ImageBuffer::new(
+ // frame.width() as u32,
+ // frame.height() as u32,
+ // ))))
}))
}
}
diff --git a/crates/collab_ui2/src/collab_titlebar_item.rs b/crates/collab_ui2/src/collab_titlebar_item.rs
index 25a4db8c90f..67b7d8d1a28 100644
--- a/crates/collab_ui2/src/collab_titlebar_item.rs
+++ b/crates/collab_ui2/src/collab_titlebar_item.rs
@@ -203,6 +203,7 @@ impl Render for CollabTitlebarItem {
)
},
)
+ .child(div().flex_1())
.when(is_in_room, |this| {
this.child(
h_stack()