mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 02:37:21 +00:00
Remove window via handles
This commit is contained in:
parent
f0da6b05fd
commit
dba2facd23
1 changed files with 5 additions and 5 deletions
|
@ -7,7 +7,7 @@ use gpui::{
|
||||||
elements::*,
|
elements::*,
|
||||||
geometry::{rect::RectF, vector::vec2f},
|
geometry::{rect::RectF, vector::vec2f},
|
||||||
platform::{CursorStyle, MouseButton, WindowBounds, WindowKind, WindowOptions},
|
platform::{CursorStyle, MouseButton, WindowBounds, WindowKind, WindowOptions},
|
||||||
AnyElement, AppContext, Entity, View, ViewContext,
|
AnyElement, AppContext, Entity, View, ViewContext, WindowHandle,
|
||||||
};
|
};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
use workspace::AppState;
|
use workspace::AppState;
|
||||||
|
@ -16,10 +16,10 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
||||||
let app_state = Arc::downgrade(app_state);
|
let app_state = Arc::downgrade(app_state);
|
||||||
let mut incoming_call = ActiveCall::global(cx).read(cx).incoming();
|
let mut incoming_call = ActiveCall::global(cx).read(cx).incoming();
|
||||||
cx.spawn(|mut cx| async move {
|
cx.spawn(|mut cx| async move {
|
||||||
let mut notification_windows = Vec::new();
|
let mut notification_windows: Vec<WindowHandle<IncomingCallNotification>> = Vec::new();
|
||||||
while let Some(incoming_call) = incoming_call.next().await {
|
while let Some(incoming_call) = incoming_call.next().await {
|
||||||
for window_id in notification_windows.drain(..) {
|
for window in notification_windows.drain(..) {
|
||||||
cx.remove_window(window_id);
|
window.remove(&mut cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(incoming_call) = incoming_call {
|
if let Some(incoming_call) = incoming_call {
|
||||||
|
@ -49,7 +49,7 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
||||||
|_| IncomingCallNotification::new(incoming_call.clone(), app_state.clone()),
|
|_| IncomingCallNotification::new(incoming_call.clone(), app_state.clone()),
|
||||||
);
|
);
|
||||||
|
|
||||||
notification_windows.push(window.id());
|
notification_windows.push(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue