Defer drawing the scene until macOS's display_layer callback

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2023-12-11 19:55:55 +01:00
parent b9bbc4a698
commit f1ebad22db
7 changed files with 46 additions and 46 deletions

View file

@ -3,7 +3,8 @@ use crate::{
Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId,
ForegroundExecutor, InputEvent, Keymap, MacDispatcher, MacDisplay, MacDisplayLinker,
MacTextSystem, MacWindow, Menu, MenuItem, PathPromptOptions, Platform, PlatformDisplay,
PlatformTextSystem, PlatformWindow, Result, SemanticVersion, VideoTimestamp, WindowOptions,
PlatformTextSystem, PlatformWindow, Result, Scene, SemanticVersion, VideoTimestamp,
WindowOptions,
};
use anyhow::anyhow;
use block::ConcreteBlock;
@ -490,8 +491,14 @@ impl Platform for MacPlatform {
&self,
handle: AnyWindowHandle,
options: WindowOptions,
draw: Box<dyn FnMut() -> Result<Scene>>,
) -> Box<dyn PlatformWindow> {
Box::new(MacWindow::open(handle, options, self.foreground_executor()))
Box::new(MacWindow::open(
handle,
options,
draw,
self.foreground_executor(),
))
}
fn set_display_link_output_callback(