diff --git a/Cargo.toml b/Cargo.toml index 26cd9ab039..a4e51e6aae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -185,7 +185,7 @@ wasmtime = { git = "https://github.com/bytecodealliance/wasmtime", rev = "v16.0. split-debuginfo = "unpacked" debug = "limited" -# TODO - Remove this +# todo!(linux) - Remove this [profile.dev.package.blade-graphics] split-debuginfo = "off" debug = "full" diff --git a/crates/gpui/screenshot.png b/crates/gpui/screenshot.png deleted file mode 100644 index 50597680f0..0000000000 Binary files a/crates/gpui/screenshot.png and /dev/null differ diff --git a/crates/gpui/src/platform/linux/blade_belt.rs b/crates/gpui/src/platform/linux/blade_belt.rs index b0e4be5893..2562097cbb 100644 --- a/crates/gpui/src/platform/linux/blade_belt.rs +++ b/crates/gpui/src/platform/linux/blade_belt.rs @@ -75,11 +75,11 @@ impl BladeBelt { chunk.into() } - //Note: assuming T: bytemuck::Zeroable + //todo!(linux): enforce T: bytemuck::Zeroable pub fn alloc_data(&mut self, data: &[T], gpu: &gpu::Context) -> gpu::BufferPiece { assert!(!data.is_empty()); let type_alignment = mem::align_of::() as u64; - assert_eq!( + debug_assert_eq!( self.desc.alignment % type_alignment, 0, "Type alignment {} is too big", diff --git a/crates/gpui/src/platform/linux/blade_renderer.rs b/crates/gpui/src/platform/linux/blade_renderer.rs index 492b135cde..128b918ef7 100644 --- a/crates/gpui/src/platform/linux/blade_renderer.rs +++ b/crates/gpui/src/platform/linux/blade_renderer.rs @@ -411,7 +411,7 @@ impl BladeRenderer { } PrimitiveBatch::Paths(paths) => { let mut encoder = pass.with(&self.pipelines.paths); - //TODO: group by texture ID + //todo!(linux): group by texture ID for path in paths { let tile = &self.path_tiles[&path.id]; let tex_info = self.atlas.get_texture_info(tile.texture_id); diff --git a/crates/gpui/src/platform/linux/dispatcher.rs b/crates/gpui/src/platform/linux/dispatcher.rs index 28526d360a..108b8ed354 100644 --- a/crates/gpui/src/platform/linux/dispatcher.rs +++ b/crates/gpui/src/platform/linux/dispatcher.rs @@ -90,7 +90,7 @@ impl PlatformDispatcher for LinuxDispatcher { fn dispatch_on_main_thread(&self, runnable: Runnable) { self.main_sender.send(runnable).unwrap(); // Send a message to the invisible window, forcing - // tha main loop to wake up and dispatch the runnable. + // the main loop to wake up and dispatch the runnable. self.xcb_connection.send_request(&x::SendEvent { propagate: false, destination: x::SendEventDest::Window(self.x_listener_window), diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index eae7893054..30d2b66bf0 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -170,14 +170,19 @@ impl Platform for LinuxPlatform { self.state.lock().quit_requested = true; } + //todo!(linux) fn restart(&self) {} + //todo!(linux) fn activate(&self, ignoring_other_apps: bool) {} + //todo!(linux) fn hide(&self) {} + //todo!(linux) fn hide_other_apps(&self) {} + //todo!(linux) fn unhide_other_apps(&self) {} fn displays(&self) -> Vec> { @@ -199,6 +204,7 @@ impl Platform for LinuxPlatform { ))) } + //todo!(linux) fn active_window(&self) -> Option { None } @@ -324,6 +330,7 @@ impl Platform for LinuxPlatform { unimplemented!() } + //todo!(linux) fn set_menus(&self, menus: Vec, keymap: &Keymap) {} fn local_timezone(&self) -> UtcOffset { @@ -334,14 +341,16 @@ impl Platform for LinuxPlatform { unimplemented!() } + //todo!(linux) fn set_cursor_style(&self, style: CursorStyle) {} - fn should_auto_hide_scrollbars(&self) -> bool { - false - } + //todo!(linux) + fn should_auto_hide_scrollbars(&self) -> bool {} + //todo!(linux) fn write_to_clipboard(&self, item: ClipboardItem) {} + //todo!(linux) fn read_from_clipboard(&self) -> Option { None } diff --git a/crates/gpui/src/platform/linux/text_system.rs b/crates/gpui/src/platform/linux/text_system.rs index 187ffb526a..53faa936bc 100644 --- a/crates/gpui/src/platform/linux/text_system.rs +++ b/crates/gpui/src/platform/linux/text_system.rs @@ -29,6 +29,7 @@ struct LinuxTextSystemState { postscript_names_by_font_id: HashMap, } +// todo!(linux): Double check this unsafe impl Send for LinuxTextSystemState {} unsafe impl Sync for LinuxTextSystemState {} @@ -54,33 +55,52 @@ impl Default for LinuxTextSystem { #[allow(unused)] impl PlatformTextSystem for LinuxTextSystem { + // todo!(linux) fn add_fonts(&self, fonts: Vec>) -> Result<()> { - Ok(()) //TODO + Ok(()) } + + // todo!(linux) fn all_font_names(&self) -> Vec { Vec::new() } + + // todo!(linux) fn all_font_families(&self) -> Vec { Vec::new() } + + // todo!(linux) fn font_id(&self, descriptor: &Font) -> Result { - Ok(FontId(0)) //TODO + Ok(FontId(0)) } + + // todo!(linux) fn font_metrics(&self, font_id: FontId) -> FontMetrics { unimplemented!() } + + // todo!(linux) fn typographic_bounds(&self, font_id: FontId, glyph_id: GlyphId) -> Result> { unimplemented!() } + + // todo!(linux) fn advance(&self, font_id: FontId, glyph_id: GlyphId) -> Result> { unimplemented!() } + + // todo!(linux) fn glyph_for_char(&self, font_id: FontId, ch: char) -> Option { None } + + // todo!(linux) fn glyph_raster_bounds(&self, params: &RenderGlyphParams) -> Result> { unimplemented!() } + + // todo!(linux) fn rasterize_glyph( &self, params: &RenderGlyphParams, @@ -88,9 +108,13 @@ impl PlatformTextSystem for LinuxTextSystem { ) -> Result<(Size, Vec)> { unimplemented!() } + + // todo!(linux) fn layout_line(&self, text: &str, font_size: Pixels, runs: &[FontRun]) -> LineLayout { LineLayout::default() //TODO } + + // todo!(linux) fn wrap_line( &self, text: &str, diff --git a/crates/gpui/src/platform/linux/window.rs b/crates/gpui/src/platform/linux/window.rs index 7ac7ebf9b4..9ad02039e8 100644 --- a/crates/gpui/src/platform/linux/window.rs +++ b/crates/gpui/src/platform/linux/window.rs @@ -77,6 +77,7 @@ pub(crate) struct LinuxWindowState { #[derive(Clone)] pub(crate) struct LinuxWindow(pub(crate) Arc); +//todo!(linux): Remove other RawWindowHandle implementation unsafe impl blade_rwh::HasRawWindowHandle for RawWindow { fn raw_window_handle(&self) -> blade_rwh::RawWindowHandle { let mut wh = blade_rwh::XcbWindowHandle::empty(); @@ -287,10 +288,12 @@ impl PlatformWindow for LinuxWindow { self.0.inner.lock().scale_factor } + //todo!(linux) fn titlebar_height(&self) -> Pixels { unimplemented!() } + //todo!(linux) fn appearance(&self) -> WindowAppearance { unimplemented!() } @@ -299,10 +302,12 @@ impl PlatformWindow for LinuxWindow { Rc::clone(&self.0.display) } + //todo!(linux) fn mouse_position(&self) -> Point { Point::default() } + //todo!(linux) fn modifiers(&self) -> crate::Modifiers { crate::Modifiers::default() } @@ -311,12 +316,15 @@ impl PlatformWindow for LinuxWindow { self } + //todo!(linux) fn set_input_handler(&mut self, input_handler: PlatformInputHandler) {} + //todo!(linux) fn take_input_handler(&mut self) -> Option { None } + //todo!(linux) fn prompt( &self, _level: crate::PromptLevel, @@ -327,24 +335,36 @@ impl PlatformWindow for LinuxWindow { unimplemented!() } + //todo!(linux) fn activate(&self) {} + //todo!(linux) fn set_title(&mut self, title: &str) {} + //todo!(linux) fn set_edited(&mut self, edited: bool) {} + //todo!(linux), this corresponds to `orderFrontCharacterPalette` on macOS, + // but it looks like the equivalent for Linux is GTK specific: + // + // https://docs.gtk.org/gtk3/signal.Entry.insert-emoji.html + // + // This API might need to change, or we might need to build an emoji picker into GPUI fn show_character_palette(&self) { unimplemented!() } + //todo!(linux) fn minimize(&self) { unimplemented!() } + //todo!(linux) fn zoom(&self) { unimplemented!() } + //todo!(linux) fn toggle_full_screen(&self) { unimplemented!() } @@ -385,10 +405,12 @@ impl PlatformWindow for LinuxWindow { self.0.callbacks.lock().appearance_changed = Some(callback); } + //todo!(linux) fn is_topmost_for_position(&self, _position: crate::Point) -> bool { unimplemented!() } + //todo!(linux) fn invalidate(&self) {} fn draw(&self, scene: &crate::Scene) { diff --git a/crates/gpui/src/platform/test/platform.rs b/crates/gpui/src/platform/test/platform.rs index 464e38b0c4..7052377a00 100644 --- a/crates/gpui/src/platform/test/platform.rs +++ b/crates/gpui/src/platform/test/platform.rs @@ -118,7 +118,11 @@ impl Platform for TestPlatform { } fn text_system(&self) -> Arc { - Arc::new(TestTextSystem {}) + #[cfg(target_os = "linux")] + return Arc::new(TestTextSystem {}); + + #[cfg(target_os = "macos")] + return Arc::new(crate::platform::mac::MacTextSystem::new()); } fn run(&self, _on_finish_launching: Box) { diff --git a/crates/gpui/src/platform/test/text_system.rs b/crates/gpui/src/platform/test/text_system.rs index d7847f1012..0e877aabbd 100644 --- a/crates/gpui/src/platform/test/text_system.rs +++ b/crates/gpui/src/platform/test/text_system.rs @@ -7,6 +7,7 @@ use std::borrow::Cow; pub(crate) struct TestTextSystem {} +//todo!(linux) #[allow(unused)] impl PlatformTextSystem for TestTextSystem { fn add_fonts(&self, fonts: Vec>) -> Result<()> { diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rs index 8c5156f3cb..e125af052d 100644 --- a/crates/project/src/terminals.rs +++ b/crates/project/src/terminals.rs @@ -7,8 +7,8 @@ use terminal::{ Terminal, TerminalBuilder, }; -#[cfg(target_os = "macos")] -use std::os::unix::ffi::OsStrExt; +// #[cfg(target_os = "macos")] +// use std::os::unix::ffi::OsStrExt; pub struct Terminals { pub(crate) local_handles: Vec>, diff --git a/crates/zed/src/languages.rs b/crates/zed/src/languages.rs index 0448cb8ec6..e191ff1b66 100644 --- a/crates/zed/src/languages.rs +++ b/crates/zed/src/languages.rs @@ -280,7 +280,8 @@ pub fn init( ], ); - /// Produces a link error on linux due to duplicated `state_new` symbol + // Produces a link error on linux due to duplicated `state_new` symbol + // todo!(linux): Restore purescript #[cfg(not(target_os = "linux"))] language( "purescript", diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 73acfdef34..c291773e4a 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -257,7 +257,7 @@ fn main() { initialize_workspace(app_state.clone(), cx); if stdout_is_a_pty() { - //TODO: unblock this + //todo!(linux): unblock this #[cfg(not(target_os = "linux"))] upload_panics_and_crashes(http.clone(), cx); cx.activate(true); @@ -919,6 +919,7 @@ fn load_user_themes_in_background(fs: Arc, cx: &mut AppContext) { .detach(); } +//todo!(linux): Port fsevents to linux /// Spawns a background task to watch the themes directory for changes. #[cfg(target_os = "macos")] fn watch_themes(fs: Arc, cx: &mut AppContext) {