Fix or promote leftover TODOs and GPUI APIs (#12514)

fixes https://github.com/zed-industries/zed/issues/11966

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2024-05-31 18:36:15 -07:00 committed by GitHub
parent a6e0c8aca1
commit 94c3101fb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 581 additions and 441 deletions

View file

@ -38,9 +38,9 @@ use crate::platform::linux::xdg_desktop_portal::{should_auto_hide_scrollbars, wi
use crate::{
px, Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CosmicTextSystem, CursorStyle,
DisplayId, ForegroundExecutor, Keymap, Keystroke, LinuxDispatcher, Menu, MenuItem, Modifiers,
PathPromptOptions, Pixels, Platform, PlatformDisplay, PlatformInputHandler, PlatformTextSystem,
PlatformWindow, Point, PromptLevel, Result, SemanticVersion, Size, Task, WindowAppearance,
WindowOptions, WindowParams,
OwnedMenu, PathPromptOptions, Pixels, Platform, PlatformDisplay, PlatformInputHandler,
PlatformTextSystem, PlatformWindow, Point, PromptLevel, Result, SemanticVersion, Size, Task,
WindowAppearance, WindowOptions, WindowParams,
};
use super::x11::X11Client;
@ -72,6 +72,7 @@ pub trait LinuxClient {
fn write_to_clipboard(&self, item: ClipboardItem);
fn read_from_primary(&self) -> Option<ClipboardItem>;
fn read_from_clipboard(&self) -> Option<ClipboardItem>;
fn active_window(&self) -> Option<AnyWindowHandle>;
fn run(&self);
}
@ -93,6 +94,7 @@ pub(crate) struct LinuxCommon {
pub(crate) auto_hide_scrollbars: bool,
pub(crate) callbacks: PlatformHandlers,
pub(crate) signal: LoopSignal,
pub(crate) menus: Vec<OwnedMenu>,
}
impl LinuxCommon {
@ -118,6 +120,7 @@ impl LinuxCommon {
auto_hide_scrollbars,
callbacks,
signal,
menus: Vec::new(),
};
(common, main_receiver)
@ -210,18 +213,21 @@ impl<P: LinuxClient + 'static> Platform for P {
}
}
// todo(linux)
fn activate(&self, ignoring_other_apps: bool) {}
// todo(linux)
fn hide(&self) {}
fn hide_other_apps(&self) {
log::warn!("hide_other_apps is not implemented on Linux, ignoring the call")
fn activate(&self, ignoring_other_apps: bool) {
log::info!("activate is not implemented on Linux, ignoring the call")
}
// todo(linux)
fn unhide_other_apps(&self) {}
fn hide(&self) {
log::info!("hide is not implemented on Linux, ignoring the call")
}
fn hide_other_apps(&self) {
log::info!("hide_other_apps is not implemented on Linux, ignoring the call")
}
fn unhide_other_apps(&self) {
log::info!("unhide_other_apps is not implemented on Linux, ignoring the call")
}
fn primary_display(&self) -> Option<Rc<dyn PlatformDisplay>> {
self.primary_display()
@ -231,9 +237,8 @@ impl<P: LinuxClient + 'static> Platform for P {
self.displays()
}
// todo(linux)
fn active_window(&self) -> Option<AnyWindowHandle> {
None
self.active_window()
}
fn open_window(
@ -387,15 +392,22 @@ impl<P: LinuxClient + 'static> Platform for P {
Ok(exe_path)
}
// todo(linux)
fn set_menus(&self, menus: Vec<Menu>, keymap: &Keymap) {}
fn set_menus(&self, menus: Vec<Menu>, _keymap: &Keymap) {
self.with_common(|common| {
common.menus = menus.into_iter().map(|menu| menu.owned()).collect();
})
}
fn get_menus(&self) -> Option<Vec<OwnedMenu>> {
self.with_common(|common| Some(common.menus.clone()))
}
fn set_dock_menu(&self, menu: Vec<MenuItem>, keymap: &Keymap) {}
fn local_timezone(&self) -> UtcOffset {
UtcOffset::UTC
}
//todo(linux)
fn path_for_auxiliary_executable(&self, name: &str) -> Result<PathBuf> {
Err(anyhow::Error::msg(
"Platform<LinuxPlatform>::path_for_auxiliary_executable is not implemented yet",
@ -549,7 +561,6 @@ impl CursorStyle {
CursorStyle::ResizeUpDown => Shape::NsResize,
CursorStyle::ResizeColumn => Shape::ColResize,
CursorStyle::ResizeRow => Shape::RowResize,
CursorStyle::DisappearingItem => Shape::Grabbing, // todo(linux) - couldn't find equivalent icon in linux
CursorStyle::IBeamCursorForVerticalLayout => Shape::VerticalText,
CursorStyle::OperationNotAllowed => Shape::NotAllowed,
CursorStyle::DragLink => Shape::Alias,
@ -577,7 +588,6 @@ impl CursorStyle {
CursorStyle::ResizeUpDown => "ns-resize",
CursorStyle::ResizeColumn => "col-resize",
CursorStyle::ResizeRow => "row-resize",
CursorStyle::DisappearingItem => "grabbing", // todo(linux) - couldn't find equivalent icon in linux
CursorStyle::IBeamCursorForVerticalLayout => "vertical-text",
CursorStyle::OperationNotAllowed => "not-allowed",
CursorStyle::DragLink => "alias",