diff --git a/linux/Cargo.toml b/linux/Cargo.toml index 1c7d515..a0f2671 100644 --- a/linux/Cargo.toml +++ b/linux/Cargo.toml @@ -14,14 +14,12 @@ path = "src/main.rs" [features] default = ["x11", "wayland"] x11 = ["winit/x11"] -wayland = ["winit/wayland"] +wayland = ["winit/wayland", "winit/wayland-dlopen", "winit/wayland-csd-adwaita"] [dependencies] acord-core = { path = "../core" } acord-viewport = { path = "../viewport" } -# rwh_06 = raw-window-handle 0.6 trait impls (HasWindowHandle/HasDisplayHandle). -# Required because we lift the surface handle out of the winit Window before -# handing it to wgpu via viewport_create. +# rwh_06 enables raw-window-handle 0.6 trait impls. winit = { version = "0.30", default-features = false, features = ["rwh_06"] } arboard = "3" rfd = "0.15" diff --git a/linux/src/shortcuts.rs b/linux/src/shortcuts.rs index 8960325..bab8d6d 100644 --- a/linux/src/shortcuts.rs +++ b/linux/src/shortcuts.rs @@ -1,4 +1,4 @@ -use winit::keyboard::{Key, ModifiersState, NamedKey, SmolStr}; +use winit::keyboard::{Key, ModifiersState, SmolStr}; #[derive(Clone, Copy)] #[allow(dead_code)] @@ -47,6 +47,7 @@ pub fn match_shortcut(modifiers: ModifiersState, key: &Key) -> Option Some(MenuAction::Italic), (false, 't') => Some(MenuAction::InsertTable), (false, 'f') => Some(MenuAction::Find), + (false, 'e') => Some(MenuAction::Evaluate), (true, 'e') => Some(MenuAction::ExportCrate), (false, ',') => Some(MenuAction::Settings), (false, '=') | (false, '+') => Some(MenuAction::ZoomIn), @@ -54,7 +55,6 @@ pub fn match_shortcut(modifiers: ModifiersState, key: &Key) -> Option Some(MenuAction::ZoomReset), _ => None, }, - Key::Named(NamedKey::Enter) => Some(MenuAction::Evaluate), _ => None, } } diff --git a/scripts/macos/package.sh b/scripts/macos/package.sh index 26fa1e6..a5f7c8e 100755 --- a/scripts/macos/package.sh +++ b/scripts/macos/package.sh @@ -25,6 +25,9 @@ case "$(uname -s)" in *) echo "package.sh: macOS host only (need swiftc + codesign)" >&2; exit 1;; esac +# raises the per-process file descriptor limit for the linker +ulimit -n 65536 2>/dev/null || ulimit -n 8192 2>/dev/null || true + ALL_TARGETS=( macos-aarch64 macos-x86_64 @@ -170,8 +173,8 @@ build_macos() { build_windows() { local arch="$1" rust_target case "$arch" in - aarch64) rust_target=aarch64-pc-windows-msvc ;; - x86_64) rust_target=x86_64-pc-windows-msvc ;; + aarch64) rust_target=aarch64-pc-windows-gnullvm ;; + x86_64) rust_target=x86_64-pc-windows-gnu ;; esac rustup target add "$rust_target" >/dev/null 2>&1 || true diff --git a/viewport/src/handle.rs b/viewport/src/handle.rs index 9f04350..f9fc131 100644 --- a/viewport/src/handle.rs +++ b/viewport/src/handle.rs @@ -1,19 +1,31 @@ use std::ffi::c_void; -use std::ptr::NonNull; -use iced_graphics::{Shell, Viewport}; -use iced_runtime::user_interface::{self, UserInterface}; +use iced_graphics::Viewport; +use iced_runtime::user_interface::UserInterface; use iced_wgpu::core::renderer::Style; use iced_wgpu::core::time::Instant; -use iced_wgpu::core::{clipboard, keyboard, mouse, window, Color, Event, Font, Pixels, Point, Size, Theme}; +use iced_wgpu::core::{clipboard, keyboard, mouse, window, Color, Event, Size, Theme}; + +#[cfg(any(target_os = "macos", target_os = "windows"))] +use std::ptr::NonNull; +#[cfg(any(target_os = "macos", target_os = "windows"))] +use iced_graphics::Shell; +#[cfg(any(target_os = "macos", target_os = "windows"))] +use iced_runtime::user_interface; +#[cfg(any(target_os = "macos", target_os = "windows"))] +use iced_wgpu::core::{Font, Pixels, Point}; +#[cfg(any(target_os = "macos", target_os = "windows"))] use iced_wgpu::Engine; +#[cfg(any(target_os = "macos", target_os = "windows"))] use raw_window_handle::{RawDisplayHandle, RawWindowHandle}; #[cfg(target_os = "macos")] use raw_window_handle::{AppKitDisplayHandle, AppKitWindowHandle}; #[cfg(target_os = "windows")] use raw_window_handle::{Win32WindowHandle, WindowsDisplayHandle}; -use crate::editor::{EditorState, Message, RenderMode}; +#[cfg(any(target_os = "macos", target_os = "windows"))] +use crate::editor::EditorState; +use crate::editor::{Message, RenderMode}; use crate::palette; use crate::table_block::TableMessage; use crate::ViewportHandle; @@ -48,6 +60,17 @@ impl clipboard::Clipboard for AcordClipboard { } } +#[cfg(not(any(target_os = "macos", target_os = "windows")))] +pub fn create( + _native_handle: *mut c_void, + _width: f32, + _height: f32, + _scale: f32, +) -> Option { + None +} + +#[cfg(any(target_os = "macos", target_os = "windows"))] pub fn create( native_handle: *mut c_void, width: f32, @@ -60,8 +83,6 @@ pub fn create( let backends = wgpu::Backends::METAL; #[cfg(target_os = "windows")] let backends = wgpu::Backends::DX12; - #[cfg(not(any(target_os = "macos", target_os = "windows")))] - let backends = wgpu::Backends::VULKAN; let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { backends, @@ -81,12 +102,6 @@ pub fn create( RawDisplayHandle::Windows(WindowsDisplayHandle::new()), ) }; - // Linux embedders (e.g. Layers) build their own surface; this entry is unused. - #[cfg(not(any(target_os = "macos", target_os = "windows")))] - let (raw_window, raw_display): (RawWindowHandle, RawDisplayHandle) = { - let _ = (ptr, width, height, scale, instance); - return None; - }; let target = wgpu::SurfaceTargetUnsafe::RawHandle { raw_display_handle: raw_display,