diff --git a/crates/collab_ui/src/incoming_call_notification.rs b/crates/collab_ui/src/incoming_call_notification.rs index ff359b9d9e..32b97274b3 100644 --- a/crates/collab_ui/src/incoming_call_notification.rs +++ b/crates/collab_ui/src/incoming_call_notification.rs @@ -18,34 +18,37 @@ pub fn init(cx: &mut MutableAppContext) { let mut incoming_call = ActiveCall::global(cx).read(cx).incoming(); cx.spawn(|mut cx| async move { - let mut notification_window = None; + let mut notification_windows = Vec::new(); while let Some(incoming_call) = incoming_call.next().await { - if let Some(window_id) = notification_window.take() { + for window_id in notification_windows.drain(..) { cx.remove_window(window_id); } if let Some(incoming_call) = incoming_call { const PADDING: f32 = 16.; - let screen_size = cx.platform().screen_size(); - let window_size = cx.read(|cx| { let theme = &cx.global::().theme.incoming_call_notification; vec2f(theme.window_width, theme.window_height) }); - let (window_id, _) = cx.add_window( - WindowOptions { - bounds: WindowBounds::Fixed(RectF::new( - vec2f(screen_size.x() - window_size.x() - PADDING, PADDING), - window_size, - )), - titlebar: None, - center: false, - kind: WindowKind::PopUp, - is_movable: false, - }, - |_| IncomingCallNotification::new(incoming_call), - ); - notification_window = Some(window_id); + + for screen in cx.platform().screens() { + let screen_size = screen.size(); + let (window_id, _) = cx.add_window( + WindowOptions { + bounds: WindowBounds::Fixed(RectF::new( + vec2f(screen_size.x() - window_size.x() - PADDING, PADDING), + window_size, + )), + titlebar: None, + center: false, + kind: WindowKind::PopUp, + is_movable: false, + screen: Some(screen), + }, + |_| IncomingCallNotification::new(incoming_call.clone()), + ); + notification_windows.push(window_id); + } } } }) diff --git a/crates/collab_ui/src/project_shared_notification.rs b/crates/collab_ui/src/project_shared_notification.rs index e5ded819af..e814ae2720 100644 --- a/crates/collab_ui/src/project_shared_notification.rs +++ b/crates/collab_ui/src/project_shared_notification.rs @@ -27,39 +27,49 @@ pub fn init(cx: &mut MutableAppContext) { worktree_root_names, } => { const PADDING: f32 = 16.; - let screen_size = cx.platform().screen_size(); - let theme = &cx.global::().theme.project_shared_notification; let window_size = vec2f(theme.window_width, theme.window_height); - let (window_id, _) = cx.add_window( - WindowOptions { - bounds: WindowBounds::Fixed(RectF::new( - vec2f(screen_size.x() - window_size.x() - PADDING, PADDING), - window_size, - )), - titlebar: None, - center: false, - kind: WindowKind::PopUp, - is_movable: false, - }, - |_| { - ProjectSharedNotification::new( - owner.clone(), - *project_id, - worktree_root_names.clone(), - ) - }, - ); - notification_windows.insert(*project_id, window_id); + + for screen in cx.platform().screens() { + let screen_size = screen.size(); + let (window_id, _) = cx.add_window( + WindowOptions { + bounds: WindowBounds::Fixed(RectF::new( + vec2f(screen_size.x() - window_size.x() - PADDING, PADDING), + window_size, + )), + titlebar: None, + center: false, + kind: WindowKind::PopUp, + is_movable: false, + screen: Some(screen), + }, + |_| { + ProjectSharedNotification::new( + owner.clone(), + *project_id, + worktree_root_names.clone(), + ) + }, + ); + notification_windows + .entry(*project_id) + .or_insert(Vec::new()) + .push(window_id); + } } room::Event::RemoteProjectUnshared { project_id } => { - if let Some(window_id) = notification_windows.remove(&project_id) { - cx.remove_window(window_id); + if let Some(window_ids) = notification_windows.remove(&project_id) { + for window_id in window_ids { + cx.remove_window(window_id); + } } } room::Event::Left => { - for (_, window_id) in notification_windows.drain() { - cx.remove_window(window_id); + for (_, window_ids) in notification_windows.drain() { + for window_id in window_ids { + cx.remove_window(window_id); + } } } _ => {} diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index ef504026d5..d343e213d9 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -344,6 +344,7 @@ pub fn build_window_options() -> WindowOptions<'static> { center: false, kind: WindowKind::Normal, is_movable: true, + screen: None, } }