Merge remote-tracking branch 'origin/main' into zed2-workspace

This commit is contained in:
Antonio Scandurra 2023-11-02 10:06:05 +01:00
commit bda43ca1fe
3 changed files with 16 additions and 14 deletions

View file

@ -184,13 +184,12 @@ impl AsyncWindowContext {
self.window.update(self, |_, cx| cx.update_global(update))
}
pub fn spawn<Fut, R>(&self, f: impl FnOnce(AsyncWindowContext) -> Fut + 'static) -> Task<R>
pub fn spawn<Fut, R>(&self, f: impl FnOnce(AsyncWindowContext) -> Fut) -> Task<R>
where
Fut: Future<Output = R> + 'static,
R: 'static,
{
let this = self.clone();
self.foreground_executor.spawn(async move { f(this).await })
self.foreground_executor.spawn(f(self.clone()))
}
}

View file

@ -169,8 +169,7 @@ impl AnyModel {
self.entity_id
}
// todo!() added for populating `ProjectItemBuilders` in `load_path` method
pub fn type_id(&self) -> TypeId {
pub fn entity_type(&self) -> TypeId {
self.entity_type
}

View file

@ -5,9 +5,10 @@ mod mac;
mod test;
use crate::{
AnyWindowHandle, BackgroundExecutor, Bounds, DevicePixels, Font, FontId, FontMetrics, FontRun,
ForegroundExecutor, GlobalPixels, GlyphId, InputEvent, LineLayout, Pixels, Point,
RenderGlyphParams, RenderImageParams, RenderSvgParams, Result, Scene, SharedString, Size,
point, size, AnyWindowHandle, BackgroundExecutor, Bounds, DevicePixels, Font, FontId,
FontMetrics, FontRun, ForegroundExecutor, GlobalPixels, GlyphId, InputEvent, LineLayout,
Pixels, Point, RenderGlyphParams, RenderImageParams, RenderSvgParams, Result, Scene,
SharedString, Size,
};
use anyhow::{anyhow, bail};
use async_task::Runnable;
@ -422,12 +423,15 @@ impl Column for WindowBounds {
"Fullscreen" => WindowBounds::Fullscreen,
"Maximized" => WindowBounds::Maximized,
"Fixed" => {
// let ((x, y, width, height), _) = Column::column(statement, next_index)?;
// WindowBounds::Fixed(RectF::new(
// Vector2F::new(x, y),
// Vector2F::new(width, height),
// ))
todo!()
let ((x, y, width, height), _) = Column::column(statement, next_index)?;
let x: f64 = x;
let y: f64 = y;
let width: f64 = width;
let height: f64 = height;
WindowBounds::Fixed(Bounds {
origin: point(x.into(), y.into()),
size: size(width.into(), height.into()),
})
}
_ => bail!("Window State did not have a valid string"),
};