From d5f0e91faa28bd2ea9b6680c7b5a919276ae0fde Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 2 Nov 2023 09:56:45 +0100 Subject: [PATCH] Remove stray todo --- crates/gpui2/src/app/async_context.rs | 5 ++--- crates/gpui2/src/platform.rs | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/crates/gpui2/src/app/async_context.rs b/crates/gpui2/src/app/async_context.rs index 01af7ae194328beaf5a49657e92028ff05464702..f08c7ed0a96410ba3a867b1851ca001fd50ada2f 100644 --- a/crates/gpui2/src/app/async_context.rs +++ b/crates/gpui2/src/app/async_context.rs @@ -184,13 +184,12 @@ impl AsyncWindowContext { self.window.update(self, |_, cx| cx.update_global(update)) } - pub fn spawn(&self, f: impl FnOnce(AsyncWindowContext) -> Fut + 'static) -> Task + pub fn spawn(&self, f: impl FnOnce(AsyncWindowContext) -> Fut) -> Task where Fut: Future + 'static, R: 'static, { - let this = self.clone(); - self.foreground_executor.spawn(async move { f(this).await }) + self.foreground_executor.spawn(f(self.clone())) } } diff --git a/crates/gpui2/src/platform.rs b/crates/gpui2/src/platform.rs index 2dd4d8b666a42496ddb49be442ea535d0209629f..9a6768342f78198ebc8a5b721277fbdc1ec39851 100644 --- a/crates/gpui2/src/platform.rs +++ b/crates/gpui2/src/platform.rs @@ -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"), };