Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Lock down mac os platform type visibility in the rest of GPUI Add documentation to all platform types
Mikayla9da6b8c7f632
diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rsindex cbf5908b067..50cfce5aae4 100644--- a/crates/gpui/src/platform.rs+++ b/crates/gpui/src/platform.rs@@ -1,3 +1,5 @@+#![deny(missing_docs)]+mod app_menu;mod keystroke;#[cfg(target_os = "macos")]@@ -34,7 +36,7 @@ use uuid::Uuid;pub use app_menu::*;pub use keystroke::*;#[cfg(target_os = "macos")]-pub use mac::*;+pub(crate) use mac::*;#[cfg(any(test, feature = "test-support"))]pub use test::*;use time::UtcOffset;@@ -69,11 +71,10 @@ pub(crate) trait Platform: 'static {fn set_display_link_output_callback(&self,display_id: DisplayId,- callback: Box<dyn FnMut(&VideoTimestamp, &VideoTimestamp) + Send>,+ callback: Box<dyn FnMut() + Send>,);fn start_display_link(&self, display_id: DisplayId);fn stop_display_link(&self, display_id: DisplayId);- // fn add_status_item(&self, _handle: AnyWindowHandle) -> Box<dyn PlatformWindow>;fn open_url(&self, url: &str);fn on_open_urls(&self, callback: Box<dyn FnMut(Vec<String>)>);@@ -395,20 +396,50 @@ impl PlatformInputHandler {}}+/// Zed's interface for handling text input from the platform's IME system+/// This is currently a 1:1 exposure of the NSTextInputClient API:+///+/// <https://developer.apple.com/documentation/appkit/nstextinputclient>pub trait InputHandler: 'static {+ /// Get the range of the user's currently selected text, if any+ /// Corresponds to [selectedRange()](https://developer.apple.com/documentation/appkit/nstextinputclient/1438242-selectedrange)+ ///+ /// Return value is in terms of UTF-16 characters, from 0 to the length of the documentfn selected_text_range(&mut self, cx: &mut WindowContext) -> Option<Range<usize>>;++ /// Get the range of the currently marked text, if any+ /// Corresponds to [markedRange()](https://developer.apple.com/documentation/appkit/nstextinputclient/1438250-markedrange)+ ///+ /// Return value is in terms of UTF-16 characters, from 0 to the length of the documentfn marked_text_range(&mut self, cx: &mut WindowContext) -> Option<Range<usize>>;++ /// Get the text for the given document range in UTF-16 characters+ /// Corresponds to [attributedSubstring(forProposedRange: actualRange:)](https://developer.apple.com/documentation/appkit/nstextinputclient/1438238-attributedsubstring)+ ///+ /// range_utf16 is in terms of UTF-16 charactersfn text_for_range(&mut self,range_utf16: Range<usize>,cx: &mut WindowContext,) -> Option<String>;++ /// Replace the text in the given document range with the given text+ /// Corresponds to [insertText(_:replacementRange:)](https://developer.apple.com/documentation/appkit/nstextinputclient/1438258-inserttext)+ ///+ /// replacement_range is in terms of UTF-16 charactersfn replace_text_in_range(&mut self,replacement_range: Option<Range<usize>>,text: &str,cx: &mut WindowContext,);++ /// Replace the text in the given document range with the given text,+ /// and mark the given text as part of of an IME 'composing' state+ /// Corresponds to [setMarkedText(_:selectedRange:replacementRange:)](https://developer.apple.com/documentation/appkit/nstextinputclient/1438246-setmarkedtext)+ ///+ /// range_utf16 is in terms of UTF-16 characters+ /// new_selected_range is in terms of UTF-16 charactersfn replace_and_mark_text_in_range(&mut self,range_utf16: Option<Range<usize>>,@@ -416,7 +447,15 @@ pub trait InputHandler: 'static {new_selected_range: Option<Range<usize>>,cx: &mut WindowContext,);++ /// Remove the IME 'composing' state from the document+ /// Corresponds to [unmarkText()](https://developer.apple.com/documentation/appkit/nstextinputclient/1438239-unmarktext)fn unmark_text(&mut self, cx: &mut WindowContext);++ /// Get the bounds of the given document range in screen coordinates+ /// Corresponds to [firstRect(forCharacterRange:actualRange:)](https://developer.apple.com/documentation/appkit/nstextinputclient/1438240-firstrect)+ ///+ /// This is used for positioning the IME candidate windowfn bounds_for_range(&mut self,range_utf16: Range<usize>,@@ -424,15 +463,31 @@ pub trait InputHandler: 'static {) -> Option<Bounds<Pixels>>;}+/// The variables that can be configured when creating a new window#[derive(Debug)]pub struct WindowOptions {+ /// The initial bounds of the windowpub bounds: WindowBounds,++ /// The titlebar configuration of the windowpub titlebar: Option<TitlebarOptions>,++ /// Whether the window should be centered on the screenpub center: bool,++ /// Whether the window should be focused when createdpub focus: bool,++ /// Whether the window should be shown when createdpub show: bool,++ /// The kind of window to createpub kind: WindowKind,++ /// Whether the window should be movable by the userpub is_movable: bool,++ /// The display to create the window onpub display_id: Option<DisplayId>,}@@ -455,46 +510,67 @@ impl Default for WindowOptions {}}+/// The options that can be configured for a window's titlebar#[derive(Debug, Default)]pub struct TitlebarOptions {+ /// The initial title of the windowpub title: Option<SharedString>,- pub appears_transparent: bool,- pub traffic_light_position: Option<Point<Pixels>>,-}-#[derive(Copy, Clone, Debug)]-pub enum Appearance {- Light,- VibrantLight,- Dark,- VibrantDark,-}+ /// Whether the titlebar should appear transparent+ pub appears_transparent: bool,-impl Default for Appearance {- fn default() -> Self {- Self::Light- }+ /// The position of the macOS traffic light buttons+ pub traffic_light_position: Option<Point<Pixels>>,}+/// The kind of window to create#[derive(Copy, Clone, Debug, PartialEq, Eq)]pub enum WindowKind {+ /// A normal application windowNormal,++ /// A window that appears above all other windows, usually used for alerts or popups+ /// use sparingly!PopUp,}+/// Which bounds algorithm to use for the initial size a window#[derive(Copy, Clone, Debug, PartialEq, Default)]pub enum WindowBounds {+ /// The window should be full screen, on macOS this corresponds to the full screen featureFullscreen,++ /// Make the window as large as the current display's size.#[default]Maximized,++ /// Set the window to the given size in pixelsFixed(Bounds<GlobalPixels>),}+/// The appearance of the window, as defined by the operating system+/// On macOS, this corresponds to named [NSAppearance](https://developer.apple.com/documentation/appkit/nsappearance)+/// values#[derive(Copy, Clone, Debug)]pub enum WindowAppearance {+ /// A light appearance+ ///+ /// on macOS, this corresponds to the `aqua` appearanceLight,++ /// A light appearance with vibrant colors+ ///+ /// on macOS, this corresponds to the `NSAppearanceNameVibrantLight` appearanceVibrantLight,++ /// A dark appearance+ ///+ /// on macOS, this corresponds to the `darkAqua` appearanceDark,++ /// A dark appearance with vibrant colors+ ///+ /// on macOS, this corresponds to the `NSAppearanceNameVibrantDark` appearanceVibrantDark,}@@ -504,40 +580,102 @@ impl Default for WindowAppearance {}}+/// The options that can be configured for a file dialog prompt#[derive(Copy, Clone, Debug)]pub struct PathPromptOptions {+ /// Should the prompt allow files to be selected?pub files: bool,+ /// Should the prompt allow directories to be selected?pub directories: bool,+ /// Should the prompt allow multiple files to be selected?pub multiple: bool,}+/// What kind of prompt styling to show#[derive(Copy, Clone, Debug)]pub enum PromptLevel {+ /// A prompt that is shown when the user should be notified of somethingInfo,++ /// A prompt that is shown when the user needs to be warned of a potential problemWarning,++ /// A prompt that is shown when a critical problem has occurredCritical,}/// The style of the cursor (pointer)#[derive(Copy, Clone, Debug)]pub enum CursorStyle {+ /// The default cursorArrow,++ /// A text input cursor+ /// corresponds to the CSS cursor value `text`IBeam,++ /// A crosshair cursor+ /// corresponds to the CSS cursor value `crosshair`Crosshair,++ /// A closed hand cursor+ /// corresponds to the CSS cursor value `grabbing`ClosedHand,++ /// An open hand cursor+ /// corresponds to the CSS cursor value `grab`OpenHand,++ /// A pointing hand cursor+ /// corresponds to the CSS cursor value `pointer`PointingHand,++ /// A resize left cursor+ /// corresponds to the CSS cursor value `w-resize`ResizeLeft,++ /// A resize right cursor+ /// corresponds to the CSS cursor value `e-resize`ResizeRight,++ /// A resize cursor to the left and right+ /// corresponds to the CSS cursor value `col-resize`ResizeLeftRight,++ /// A resize up cursor+ /// corresponds to the CSS cursor value `n-resize`ResizeUp,++ /// A resize down cursor+ /// corresponds to the CSS cursor value `s-resize`ResizeDown,++ /// A resize cursor directing up and down+ /// corresponds to the CSS cursor value `row-resize`ResizeUpDown,++ /// A cursor indicating that something will dissappear if moved here+ /// Does not correspond to a CSS cursor valueDisappearingItem,++ /// A text input cursor for vertical layout+ /// corresponds to the CSS cursor value `vertical-text`IBeamCursorForVerticalLayout,++ /// A cursor indicating that the operation is not allowed+ /// corresponds to the CSS cursor value `not-allowed`OperationNotAllowed,++ /// A cursor indicating that the operation will result in a link+ /// corresponds to the CSS cursor value `alias`DragLink,++ /// A cursor indicating that the operation will result in a copy+ /// corresponds to the CSS cursor value `copy`DragCopy,++ /// A cursor indicating that the operation will result in a context menu+ /// corresponds to the CSS cursor value `context-menu`ContextualMenu,}@@ -547,6 +685,7 @@ impl Default for CursorStyle {}}+/// A datastructure representing a semantic version number#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd, Serialize)]pub struct SemanticVersion {major: usize,@@ -585,6 +724,7 @@ impl Display for SemanticVersion {}}+/// A clipboard item that should be copied to the clipboard#[derive(Clone, Debug, Eq, PartialEq)]pub struct ClipboardItem {pub(crate) text: String,@@ -592,6 +732,7 @@ pub struct ClipboardItem {}impl ClipboardItem {+ /// Create a new clipboard item with the given textpub fn new(text: String) -> Self {Self {text,@@ -599,15 +740,18 @@ impl ClipboardItem {}}+ /// Create a new clipboard item with the given text and metadatapub fn with_metadata<T: Serialize>(mut self, metadata: T) -> Self {self.metadata = Some(serde_json::to_string(&metadata).unwrap());self}+ /// Get the text of the clipboard itempub fn text(&self) -> &String {&self.text}+ /// Get the metadata of the clipboard itempub fn metadata<T>(&self) -> Option<T>whereT: for<'a> Deserialize<'a>,diff --git a/crates/gpui/src/platform/app_menu.rs b/crates/gpui/src/platform/app_menu.rsindex 10fe2cf33ae..91fe358931b 100644--- a/crates/gpui/src/platform/app_menu.rs+++ b/crates/gpui/src/platform/app_menu.rs@@ -1,30 +1,49 @@use crate::{Action, AppContext, Platform};use util::ResultExt;+/// A menu of the application, either a main menu or a submenupub struct Menu<'a> {+ /// The name of the menupub name: &'a str,++ /// The items in the menupub items: Vec<MenuItem<'a>>,}+/// The different kinds of items that can be in a menupub enum MenuItem<'a> {+ /// A separator between itemsSeparator,++ /// A submenuSubmenu(Menu<'a>),++ /// An action that can be performedAction {+ /// The name of this menu itemname: &'a str,++ /// the action to perform when this menu item is selectedaction: Box<dyn Action>,++ /// The OS Action that corresponds to this action, if any+ /// See [`OsAction`] for more informationos_action: Option<OsAction>,},}impl<'a> MenuItem<'a> {+ /// Creates a new menu item that is a separatorpub fn separator() -> Self {Self::Separator}+ /// Creates a new menu item that is a submenupub fn submenu(menu: Menu<'a>) -> Self {Self::Submenu(menu)}+ /// Creates a new menu item that invokes an actionpub fn action(name: &'a str, action: impl Action) -> Self {Self::Action {name,@@ -33,6 +52,7 @@ impl<'a> MenuItem<'a> {}}+ /// Creates a new menu item that invokes an action and has an OS actionpub fn os_action(name: &'a str, action: impl Action, os_action: OsAction) -> Self {Self::Action {name,@@ -42,13 +62,31 @@ impl<'a> MenuItem<'a> {}}+// TODO: As part of the global selections refactor, these should+// be moved to GPUI-provided actions that make this association+// without leaking the platform details to GPUI users++/// OS actions are actions that are recognized by the operating system+/// This allows the operating system to provide specialized behavior for+/// these actions#[derive(Copy, Clone, Eq, PartialEq)]pub enum OsAction {+ /// The 'cut' actionCut,++ /// The 'copy' actionCopy,++ /// The 'paste' actionPaste,++ /// The 'select all' actionSelectAll,++ /// The 'undo' actionUndo,++ /// The 'redo' actionRedo,}diff --git a/crates/gpui/src/platform/keystroke.rs b/crates/gpui/src/platform/keystroke.rsindex 64a901789ab..0db8d0744db 100644--- a/crates/gpui/src/platform/keystroke.rs+++ b/crates/gpui/src/platform/keystroke.rs@@ -3,24 +3,31 @@ use serde::Deserialize;use smallvec::SmallVec;use std::fmt::Write;+/// A keystroke and associated metadata generated by the platform#[derive(Clone, Debug, Eq, PartialEq, Default, Deserialize, Hash)]pub struct Keystroke {+ /// the state of the modifier keys at the time the keystroke was generatedpub modifiers: Modifiers,+/// key is the character printed on the key that was pressed/// e.g. for option-s, key is "s"pub key: String,+/// ime_key is the character inserted by the IME engine when that key was pressed./// e.g. for option-s, ime_key is "ß"pub ime_key: Option<String>,}impl Keystroke {- // When matching a key we cannot know whether the user intended to type- // the ime_key or the key. On some non-US keyboards keys we use in our- // bindings are behind option (for example `$` is typed `alt-ç` on a Czech keyboard),- // and on some keyboards the IME handler converts a sequence of keys into a- // specific character (for example `"` is typed as `" space` on a brazilian keyboard).- pub fn match_candidates(&self) -> SmallVec<[Keystroke; 2]> {+ /// When matching a key we cannot know whether the user intended to type+ /// the ime_key or the key itself. On some non-US keyboards keys we use in our+ /// bindings are behind option (for example `$` is typed `alt-ç` on a Czech keyboard),+ /// and on some keyboards the IME handler converts a sequence of keys into a+ /// specific character (for example `"` is typed as `" space` on a brazilian keyboard).+ ///+ /// This method generates a list of potential keystroke candidates that could be matched+ /// against when resolving a keybinding.+ pub(crate) fn match_candidates(&self) -> SmallVec<[Keystroke; 2]> {let mut possibilities = SmallVec::new();match self.ime_key.as_ref() {None => possibilities.push(self.clone()),@@ -47,7 +54,7 @@ impl Keystroke {/// key syntax is:/// [ctrl-][alt-][shift-][cmd-][fn-]key[->ime_key]- /// ime_key is only used for generating test events,+ /// ime_key syntax is only used for generating test events,/// when matching a key with an ime_key set will be matched without it.pub fn parse(source: &str) -> anyhow::Result<Self> {let mut control = false;@@ -135,16 +142,29 @@ impl std::fmt::Display for Keystroke {}}+/// The state of the modifier keys at some point in time#[derive(Copy, Clone, Debug, Eq, PartialEq, Default, Deserialize, Hash)]pub struct Modifiers {+ /// The control keypub control: bool,++ /// The alt key+ /// Sometimes also known as the 'meta' keypub alt: bool,++ /// The shift keypub shift: bool,++ /// The command key, on macos+ /// the windows key, on windowspub command: bool,++ /// The function keypub function: bool,}impl Modifiers {+ /// Returns true if any modifier key is pressedpub fn modified(&self) -> bool {self.control || self.alt || self.shift || self.command || self.function}diff --git a/crates/gpui/src/platform/mac.rs b/crates/gpui/src/platform/mac.rsindex 3cc74a96839..2194ae41e79 100644--- a/crates/gpui/src/platform/mac.rs+++ b/crates/gpui/src/platform/mac.rs@@ -21,13 +21,13 @@ use metal_renderer::*;use objc::runtime::{BOOL, NO, YES};use std::ops::Range;-pub use dispatcher::*;-pub use display::*;-pub use display_linker::*;-pub use metal_atlas::*;-pub use platform::*;-pub use text_system::*;-pub use window::*;+pub(crate) use dispatcher::*;+pub(crate) use display::*;+pub(crate) use display_linker::*;+pub(crate) use metal_atlas::*;+pub(crate) use platform::*;+pub(crate) use text_system::*;+pub(crate) use window::*;trait BoolExt {fn to_objc(self) -> BOOL;diff --git a/crates/gpui/src/platform/mac/dispatcher.rs b/crates/gpui/src/platform/mac/dispatcher.rsindex 18e361885e7..72daa8c4404 100644--- a/crates/gpui/src/platform/mac/dispatcher.rs+++ b/crates/gpui/src/platform/mac/dispatcher.rs@@ -24,7 +24,7 @@ pub(crate) fn dispatch_get_main_queue() -> dispatch_queue_t {unsafe { &_dispatch_main_q as *const _ as dispatch_queue_t }}-pub struct MacDispatcher {+pub(crate) struct MacDispatcher {parker: Arc<Mutex<Parker>>,}diff --git a/crates/gpui/src/platform/mac/display.rs b/crates/gpui/src/platform/mac/display.rsindex 1f6023ed147..d5eb089300c 100644--- a/crates/gpui/src/platform/mac/display.rs+++ b/crates/gpui/src/platform/mac/display.rs@@ -11,7 +11,7 @@ use objc::{msg_send, sel, sel_impl};use uuid::Uuid;#[derive(Debug)]-pub struct MacDisplay(pub(crate) CGDirectDisplayID);+pub(crate) struct MacDisplay(pub(crate) CGDirectDisplayID);unsafe impl Send for MacDisplay {}@@ -21,11 +21,6 @@ impl MacDisplay {Self::all().find(|screen| screen.id() == id)}- /// Get the screen with the given persistent [`Uuid`].- pub fn find_by_uuid(uuid: Uuid) -> Option<Self> {- Self::all().find(|screen| screen.uuid().ok() == Some(uuid))- }-/// Get the primary screen - the one with the menu bar, and whose bottom left/// corner is at the origin of the AppKit coordinate system.pub fn primary() -> Self {diff --git a/crates/gpui/src/platform/mac/display_linker.rs b/crates/gpui/src/platform/mac/display_linker.rsindex 8f1b233046f..e25487ec0bb 100644--- a/crates/gpui/src/platform/mac/display_linker.rs+++ b/crates/gpui/src/platform/mac/display_linker.rs@@ -7,8 +7,6 @@ use std::{use crate::DisplayId;use collections::HashMap;use parking_lot::Mutex;-pub use sys::CVSMPTETime as SmtpeTime;-pub use sys::CVTimeStamp as VideoTimestamp;pub(crate) struct MacDisplayLinker {links: HashMap<DisplayId, MacDisplayLink>,@@ -27,13 +25,13 @@ impl MacDisplayLinker {}}-type OutputCallback = Mutex<Box<dyn FnMut(&VideoTimestamp, &VideoTimestamp) + Send>>;+type OutputCallback = Mutex<Box<dyn FnMut() + Send>>;impl MacDisplayLinker {pub fn set_output_callback(&mut self,display_id: DisplayId,- output_callback: Box<dyn FnMut(&VideoTimestamp, &VideoTimestamp) + Send>,+ output_callback: Box<dyn FnMut() + Send>,) {if let Some(mut system_link) = unsafe { sys::DisplayLink::on_display(display_id.0) } {let callback = Arc::new(Mutex::new(output_callback));@@ -81,11 +79,11 @@ unsafe extern "C" fn trampoline(_flags_out: *mut i64,user_data: *mut c_void,) -> i32 {- if let Some((current_time, output_time)) = current_time.as_ref().zip(output_time.as_ref()) {+ if let Some((_current_time, _output_time)) = current_time.as_ref().zip(output_time.as_ref()) {let output_callback: Weak<OutputCallback> =Weak::from_raw(user_data as *mut OutputCallback);if let Some(output_callback) = output_callback.upgrade() {- (output_callback.lock())(current_time, output_time)+ (output_callback.lock())()}mem::forget(output_callback);}@@ -126,7 +124,7 @@ mod sys {#[repr(C)]#[derive(Clone, Copy)]- pub struct CVTimeStamp {+ pub(crate) struct CVTimeStamp {pub version: u32,pub video_time_scale: i32,pub video_time: i64,@@ -154,7 +152,7 @@ mod sys {#[repr(C)]#[derive(Clone, Copy, Default)]- pub struct CVSMPTETime {+ pub(crate) struct CVSMPTETime {pub subframes: i16,pub subframe_divisor: i16,pub counter: u32,diff --git a/crates/gpui/src/platform/mac/events.rs b/crates/gpui/src/platform/mac/events.rsindex f84833d3cbb..4653ce89b45 100644--- a/crates/gpui/src/platform/mac/events.rs+++ b/crates/gpui/src/platform/mac/events.rs@@ -83,7 +83,10 @@ unsafe fn read_modifiers(native_event: id) -> Modifiers {}impl PlatformInput {- pub unsafe fn from_native(native_event: id, window_height: Option<Pixels>) -> Option<Self> {+ pub(crate) unsafe fn from_native(+ native_event: id,+ window_height: Option<Pixels>,+ ) -> Option<Self> {let event_type = native_event.eventType();// Filter out event types that aren't in the NSEventType enum.diff --git a/crates/gpui/src/platform/mac/metal_atlas.rs b/crates/gpui/src/platform/mac/metal_atlas.rsindex d3caeba5222..95f78a44653 100644--- a/crates/gpui/src/platform/mac/metal_atlas.rs+++ b/crates/gpui/src/platform/mac/metal_atlas.rs@@ -10,10 +10,10 @@ use metal::Device;use parking_lot::Mutex;use std::borrow::Cow;-pub struct MetalAtlas(Mutex<MetalAtlasState>);+pub(crate) struct MetalAtlas(Mutex<MetalAtlasState>);impl MetalAtlas {- pub fn new(device: Device) -> Self {+ pub(crate) fn new(device: Device) -> Self {MetalAtlas(Mutex::new(MetalAtlasState {device: AssertSend(device),monochrome_textures: Default::default(),diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rsindex 499ac0b5910..e4a688c2fdb 100644--- a/crates/gpui/src/platform/mac/platform.rs+++ b/crates/gpui/src/platform/mac/platform.rs@@ -3,7 +3,7 @@ use crate::{Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId,ForegroundExecutor, Keymap, MacDispatcher, MacDisplay, MacDisplayLinker, MacTextSystem,MacWindow, Menu, MenuItem, PathPromptOptions, Platform, PlatformDisplay, PlatformInput,- PlatformTextSystem, PlatformWindow, Result, SemanticVersion, VideoTimestamp, WindowOptions,+ PlatformTextSystem, PlatformWindow, Result, SemanticVersion, WindowOptions,};use anyhow::anyhow;use block::ConcreteBlock;@@ -139,9 +139,9 @@ unsafe fn build_classes() {}}-pub struct MacPlatform(Mutex<MacPlatformState>);+pub(crate) struct MacPlatform(Mutex<MacPlatformState>);-pub struct MacPlatformState {+pub(crate) struct MacPlatformState {background_executor: BackgroundExecutor,foreground_executor: ForegroundExecutor,text_system: Arc<MacTextSystem>,@@ -169,7 +169,7 @@ impl Default for MacPlatform {}impl MacPlatform {- pub fn new() -> Self {+ pub(crate) fn new() -> Self {let dispatcher = Arc::new(MacDispatcher::new());Self(Mutex::new(MacPlatformState {background_executor: BackgroundExecutor::new(dispatcher.clone()),@@ -475,10 +475,6 @@ impl Platform for MacPlatform {}}- // fn add_status_item(&self, _handle: AnyWindowHandle) -> Box<dyn platform::Window> {- // Box::new(StatusItem::add(self.fonts()))- // }-fn displays(&self) -> Vec<Rc<dyn PlatformDisplay>> {MacDisplay::all().map(|screen| Rc::new(screen) as Rc<_>)@@ -504,7 +500,7 @@ impl Platform for MacPlatform {fn set_display_link_output_callback(&self,display_id: DisplayId,- callback: Box<dyn FnMut(&VideoTimestamp, &VideoTimestamp) + Send>,+ callback: Box<dyn FnMut() + Send>,) {self.0.lock()diff --git a/crates/gpui/src/platform/mac/text_system.rs b/crates/gpui/src/platform/mac/text_system.rsindex d11efa902ae..ba434026f65 100644--- a/crates/gpui/src/platform/mac/text_system.rs+++ b/crates/gpui/src/platform/mac/text_system.rs@@ -41,7 +41,7 @@ use super::open_type;#[allow(non_upper_case_globals)]const kCGImageAlphaOnly: u32 = 7;-pub struct MacTextSystem(RwLock<MacTextSystemState>);+pub(crate) struct MacTextSystem(RwLock<MacTextSystemState>);struct MacTextSystemState {memory_source: MemSource,@@ -54,7 +54,7 @@ struct MacTextSystemState {}impl MacTextSystem {- pub fn new() -> Self {+ pub(crate) fn new() -> Self {Self(RwLock::new(MacTextSystemState {memory_source: MemSource::empty(),system_source: SystemSource::new(),diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rsindex fcfd02aa411..1ef5d346cc3 100644--- a/crates/gpui/src/platform/mac/window.rs+++ b/crates/gpui/src/platform/mac/window.rs@@ -220,7 +220,7 @@ unsafe fn build_classes() {};}-pub fn convert_mouse_position(position: NSPoint, window_height: Pixels) -> Point<Pixels> {+pub(crate) fn convert_mouse_position(position: NSPoint, window_height: Pixels) -> Point<Pixels> {point(px(position.x as f32),// MacOS screen coordinates are relative to bottom left@@ -446,7 +446,7 @@ impl MacWindowState {unsafe impl Send for MacWindowState {}-pub struct MacWindow(Arc<Mutex<MacWindowState>>);+pub(crate) struct MacWindow(Arc<Mutex<MacWindowState>>);impl MacWindow {pub fn open(diff --git a/crates/gpui/src/platform/mac/window_appearance.rs b/crates/gpui/src/platform/mac/window_appearance.rsindex 2edc896289e..0a5df85a446 100644--- a/crates/gpui/src/platform/mac/window_appearance.rs+++ b/crates/gpui/src/platform/mac/window_appearance.rs@@ -8,7 +8,7 @@ use objc::{msg_send, sel, sel_impl};use std::ffi::CStr;impl WindowAppearance {- pub unsafe fn from_native(appearance: id) -> Self {+ pub(crate) unsafe fn from_native(appearance: id) -> Self {let name: id = msg_send![appearance, name];if name == NSAppearanceNameVibrantLight {Self::VibrantLightdiff --git a/crates/gpui/src/styled.rs b/crates/gpui/src/styled.rsindex 535cc3e0536..ee27741642b 100644--- a/crates/gpui/src/styled.rs+++ b/crates/gpui/src/styled.rs@@ -1,11 +1,11 @@use crate::{self as gpui, hsla, point, px, relative, rems, AbsoluteLength, AlignItems, CursorStyle,- DefiniteLength, Display, Fill, FlexDirection, FontWeight, Hsla, JustifyContent, Length,- Position, SharedString, StyleRefinement, Visibility, WhiteSpace,+ DefiniteLength, Fill, FlexDirection, FontWeight, Hsla, JustifyContent, Length, Position,+ SharedString, StyleRefinement, Visibility, WhiteSpace,};use crate::{BoxShadow, TextStyleRefinement};use smallvec::{smallvec, SmallVec};-use taffy::style::Overflow;+use taffy::style::{Display, Overflow};pub trait Styled: Sized {fn style(&mut self) -> &mut StyleRefinement;diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rsindex 81bd8b55b30..1a7a35bf57f 100644--- a/crates/gpui/src/window.rs+++ b/crates/gpui/src/window.rs@@ -737,7 +737,7 @@ impl<'a> WindowContext<'a> {let (tx, mut rx) = mpsc::unbounded::<()>();self.platform.set_display_link_output_callback(display_id,- Box::new(move |_current_time, _output_time| _ = tx.unbounded_send(())),+ Box::new(move || _ = tx.unbounded_send(())),);let consumer_task = self.app.spawn(|cx| async move {