From 5194a35d74924400d077fe26d56168634c98370f Mon Sep 17 00:00:00 2001 From: yuanzhuang-svg <273899003+yuanzhuang-svg@users.noreply.github.com> Date: Tue, 13 Oct 2026 15:23:13 +0800 Subject: [PATCH] Bump gpui-pre to 0.3.9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Match gpui-kit's 0.3.9 snapshot so downstreams (ai-chat) can move to gpui-pre 0.3.9 and pull the touch release-velocity fling fix from gpui-fast. - Bump gpui-pre / gpui-pre-wgpu pins =0.3.8 → =0.3.9. - Re-vendor gpui-pre-wgpu at 0.3.9, re-applying the `offscreen` headless renderer patch (feature gates + new_headless_with_instance / with_instance / from_headless_context) on top of the 0.3.9 source. - Implement the three platform trait methods gpui-pre 0.3.9 adds, for iOS and Android: PlatformDisplay::refresh_interval (iOS queries UIScreen maximumFramesPerSecond; Android None), Platform::on_displays_changed and PlatformWindow::on_display_changed (no-op on mobile). iOS (aarch64-apple-ios) cargo check passes. Android not built locally (no NDK); the additions are no-ops / None — please confirm in CI. --- Cargo.toml | 8 ++-- example/Cargo.toml | 6 +-- src/android/display.rs | 6 +++ src/android/platform.rs | 7 ++++ src/android/window.rs | 4 ++ src/ios/display.rs | 11 ++++- src/ios/platform.rs | 5 +++ src/ios/window.rs | 5 +++ vendor/gpui-pre-wgpu/Cargo.toml | 42 ++++++++++++------- vendor/gpui-pre-wgpu/Cargo.toml.orig | 19 +++++---- .../gpui-pre-wgpu/src/cosmic_text_system.rs | 9 +++- 11 files changed, 92 insertions(+), 30 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fc93b0a6..61db974e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ raw-window-handle = "0.6" image = { version = "0.25", default-features = false, optional = true } # ── GPUI core crate (provides Platform trait, event types, geometry, etc.) ─── -gpui = { package = "gpui-pre", version = "=0.3.8", default-features = false } +gpui = { package = "gpui-pre", version = "=0.3.9", default-features = false } # ── iOS ────────────────────────────────────────────────────────────────────── @@ -91,7 +91,7 @@ block2 = "0.6" libc = "=0.2.189" # wgpu renderer (Metal backend on iOS/Android) -gpui_wgpu = { package = "gpui-pre-wgpu", version = "=0.3.8", features = ["font-kit"] } +gpui_wgpu = { package = "gpui-pre-wgpu", version = "=0.3.9", features = ["font-kit"] } wgpu = "29.0.4" # Text / font stack @@ -122,7 +122,7 @@ android_logger = "0.15" # wgpu renderer (Vulkan backend on Android) # Android uses Cosmic Text and system fonts; font-kit pulls in desktop Fontconfig. -gpui_wgpu = { package = "gpui-pre-wgpu", version = "=0.3.8" } +gpui_wgpu = { package = "gpui-pre-wgpu", version = "=0.3.9" } # rustc-hash is required by the PlatformKeyboardMapper trait signature rustc-hash = "2" @@ -131,7 +131,7 @@ uuid = { version = "1", features = ["v5"] } # ── dev ────────────────────────────────────────────────────────────────────── [dev-dependencies] -gpui = { package = "gpui-pre", version = "=0.3.8", default-features = false, features = ["test-support"] } +gpui = { package = "gpui-pre", version = "=0.3.9", default-features = false, features = ["test-support"] } # ── profiles ───────────────────────────────────────────────────────────────── diff --git a/example/Cargo.toml b/example/Cargo.toml index 61d73194..5c6f1933 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -16,10 +16,10 @@ path = "src/main.rs" [dependencies] # Pin the mobile facade support without requiring a published crate. -gpui-kit = { git = "https://github.com/longbridge/gpui-kit", rev = "288767cc730ca4977852a7860f52a8465a61876f", default-features = false, features = ["component"] } +gpui-kit = { git = "https://github.com/longbridge/gpui-kit", rev = "efd2e672d22d3ea6b2c7061ef03c891c65bbaa4b", default-features = false, features = ["component"] } gpui-mobile = { package = "gpui-pre-mobile", path = "..", version = "0.1.0" } -gpui = { package = "gpui-pre", version = "=0.3.8", default-features = false } -reqwest_client = { package = "gpui-pre-reqwest-client", version = "=0.3.8" } +gpui = { package = "gpui-pre", version = "=0.3.9", default-features = false } +reqwest_client = { package = "gpui-pre-reqwest-client", version = "=0.3.9" } reqwest = { package = "gpui-pre-reqwest", version = "0.12.15", default-features = false, features = ["rustls-tls"] } log = "0.4" diff --git a/src/android/display.rs b/src/android/display.rs index 9a227a19..688c68fd 100644 --- a/src/android/display.rs +++ b/src/android/display.rs @@ -229,6 +229,12 @@ impl PlatformDisplay for AndroidDisplay { DisplayId::new(self.id as u64) } + fn refresh_interval(&self) -> Option { + // Android frame pacing is driven by Choreographer, not a queried refresh + // interval; report unknown and let the caller fall back to its default. + None + } + fn uuid(&self) -> Result { // Android NDK does not provide a stable UUID for displays. // Synthesise a deterministic v5 UUID from the display id so that diff --git a/src/android/platform.rs b/src/android/platform.rs index c30a247d..86375fb5 100644 --- a/src/android/platform.rs +++ b/src/android/platform.rs @@ -1265,6 +1265,10 @@ impl Platform for AndroidPlatform { }); } + fn on_displays_changed(&self, _callback: Box) { + // Android reports no display hot-plug configuration callback here; no-op. + } + fn set_menus(&self, _menus: Vec, _keymap: &Keymap) { // No-op: Android doesn't have macOS-style menus. } @@ -1530,6 +1534,9 @@ impl Platform for SharedPlatform { fn on_reopen(&self, callback: Box) { ::on_reopen(&self.0, callback) } + fn on_displays_changed(&self, callback: Box) { + ::on_displays_changed(&self.0, callback) + } fn set_menus(&self, menus: Vec, keymap: &Keymap) { ::set_menus(&self.0, menus, keymap) } diff --git a/src/android/window.rs b/src/android/window.rs index efdcee02..c2f026f1 100644 --- a/src/android/window.rs +++ b/src/android/window.rs @@ -1855,6 +1855,10 @@ impl PlatformWindow for AndroidPlatformWindow { // Android windows don't move — they're always fullscreen. } + fn on_display_changed(&self, _callback: Box) { + // An Android window stays on its single display for its lifetime; no-op. + } + fn on_should_close(&self, _callback: Box bool>) { // Android app lifecycle is managed by the system. } diff --git a/src/ios/display.rs b/src/ios/display.rs index 26e8442c..15b33fb4 100644 --- a/src/ios/display.rs +++ b/src/ios/display.rs @@ -4,8 +4,9 @@ //! and possibly an external display via AirPlay or USB-C. use anyhow::Result; -use gpui::{px, size, Bounds, DisplayId, Pixels, PlatformDisplay}; +use gpui::{px, refresh_interval_from_hz, size, Bounds, DisplayId, Pixels, PlatformDisplay}; use objc2::{class, msg_send}; +use std::time::Duration; use super::cg_types::ObjcCGRect; use uuid::Uuid; @@ -95,4 +96,12 @@ impl PlatformDisplay for IosDisplay { size: size(px(bounds.width as f32), px(bounds.height as f32)), } } + + fn refresh_interval(&self) -> Option { + // `UIScreen.maximumFramesPerSecond` is the panel's max refresh (60, or 120 + // on ProMotion). Available since iOS 10.3; returns 0 when unknown, in which + // case `refresh_interval_from_hz` yields `None`. + let frames_per_second: isize = unsafe { msg_send![self.screen, maximumFramesPerSecond] }; + refresh_interval_from_hz(frames_per_second as f64) + } } diff --git a/src/ios/platform.rs b/src/ios/platform.rs index ac7b2233..0be13634 100644 --- a/src/ios/platform.rs +++ b/src/ios/platform.rs @@ -263,6 +263,11 @@ impl Platform for IosPlatform { // iOS handles app reopening through scene lifecycle } + fn on_displays_changed(&self, _callback: Box) { + // iOS has no display hot-plug configuration callback like macOS; the + // single UIScreen is managed by the scene lifecycle, so this is a no-op. + } + fn set_menus(&self, _menus: Vec, _keymap: &Keymap) { // iOS doesn't have a menu bar // Could potentially integrate with UIMenuBuilder for context menus diff --git a/src/ios/window.rs b/src/ios/window.rs index 2d9c7095..9070e1c6 100644 --- a/src/ios/window.rs +++ b/src/ios/window.rs @@ -1547,6 +1547,11 @@ impl PlatformWindow for IosWindow { *self.moved_callback.borrow_mut() = Some(callback); } + fn on_display_changed(&self, _callback: Box) { + // An iOS window stays on the single UIScreen for its lifetime, so there is + // no display-change event to report; no-op. + } + fn on_should_close(&self, callback: Box bool>) { *self.should_close_callback.borrow_mut() = Some(callback); } diff --git a/vendor/gpui-pre-wgpu/Cargo.toml b/vendor/gpui-pre-wgpu/Cargo.toml index f2900468..b5fd9b56 100644 --- a/vendor/gpui-pre-wgpu/Cargo.toml +++ b/vendor/gpui-pre-wgpu/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2024" name = "gpui-pre-wgpu" -version = "0.3.8" +version = "0.3.9" build = false publish = true autolib = false @@ -20,7 +20,7 @@ autobins = false autoexamples = false autotests = false autobenches = false -description = "Zed's `gpui_wgpu` crate (gpui-pre snapshot of zed@279fe07)" +description = "Zed's `gpui_wgpu` crate (gpui-pre snapshot of zed@93d7456)" readme = false license = "Apache-2.0" repository = "https://github.com/zed-industries/zed" @@ -29,7 +29,7 @@ resolver = "2" [package.metadata.gpui-pre] zed-crate = "gpui_wgpu" zed-version = "0.1.0" -zed-rev = "279fe070bb389b79652e52065b2f001edcc0b11b" +zed-rev = "93d745668805029476e6d7fbb19652116fed51de" [features] bench-support = [ @@ -61,7 +61,7 @@ version = "1.0.86" version = "1" [dependencies.collections] -version = "=0.3.8" +version = "=0.3.9" package = "gpui-pre-collections" [dependencies.cosmic-text] @@ -73,15 +73,16 @@ version = "0.2" [dependencies.font-kit] version = "0.14.1-zed" optional = true +default-features = false package = "zed-font-kit" [dependencies.gpui] -version = "=0.3.8" +version = "=0.3.9" default-features = false package = "gpui-pre" [dependencies.gpui_util] -version = "=0.3.8" +version = "=0.3.9" package = "gpui-pre-util" [dependencies.image] @@ -110,11 +111,9 @@ default-features = false version = "0.14.0" [dependencies.log] -version = "0.4.16" -features = [ - "kv_unstable_serde", - "serde", -] +version = "0.4" +features = ["std"] +default-features = false [dependencies.parking_lot] version = "0.12.1" @@ -143,16 +142,31 @@ default-features = false [dependencies.unicode-segmentation] version = "1.10" -[dependencies.wgpu] -version = "29.0.4" +[target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dependencies.wgpu] +version = "29.0" +features = [ + "std", + "parking_lot", + "metal", + "gles", + "vulkan", + "wgsl", + "webgpu", +] +default-features = false + +[target.'cfg(not(any(target_os = "linux", target_os = "freebsd")))'.dependencies.wgpu] +version = "29.0" +default-features = true [target.'cfg(target_family = "wasm")'.dependencies.web-sys] version = "0.3" features = ["HtmlCanvasElement"] [target.'cfg(target_family = "wasm")'.dependencies.wgpu] -version = "29.0.4" +version = "29.0" features = ["webgl"] +default-features = false [lints.clippy] dbg_macro = "deny" diff --git a/vendor/gpui-pre-wgpu/Cargo.toml.orig b/vendor/gpui-pre-wgpu/Cargo.toml.orig index e2af01c8..f0750903 100644 --- a/vendor/gpui-pre-wgpu/Cargo.toml.orig +++ b/vendor/gpui-pre-wgpu/Cargo.toml.orig @@ -1,16 +1,16 @@ [package] name = "gpui-pre-wgpu" -version = "0.3.8" +version = "0.3.9" edition = { workspace = true } publish = true license = "Apache-2.0" -description = "Zed's `gpui_wgpu` crate (gpui-pre snapshot of zed@279fe07)" +description = "Zed's `gpui_wgpu` crate (gpui-pre snapshot of zed@93d7456)" repository = "https://github.com/zed-industries/zed" [package.metadata.gpui-pre] zed-crate = "gpui_wgpu" zed-version = "0.1.0" -zed-rev = "279fe070bb389b79652e52065b2f001edcc0b11b" +zed-rev = "93d745668805029476e6d7fbb19652116fed51de" [lib] path = "src/gpui_wgpu.rs" @@ -26,7 +26,7 @@ test-support = ["gpui/test-support", "dep:image"] [dependencies] gpui = { workspace = true } anyhow = { workspace = true } -bytemuck = "1" +bytemuck = { workspace = true } collections = { workspace = true } cosmic-text = "0.19.0" etagere = { workspace = true } @@ -41,11 +41,16 @@ swash = { workspace = true } unicode-bidi = { workspace = true } unicode-segmentation = { workspace = true } gpui_util = { workspace = true } -wgpu = { workspace = true } -font-kit = { git = "https://github.com/zed-industries/font-kit", rev = "94b0f28166665e8fd2f53ff6d268a14955c82269", package = "zed-font-kit", version = "0.14.1-zed", optional = true } +font-kit = { workspace = true, optional = true } + +[target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dependencies] +wgpu = { workspace = true, features = ["std", "parking_lot", "metal", "gles", "vulkan", "wgsl", "webgpu"] } + +[target.'cfg(not(any(target_os = "linux", target_os = "freebsd")))'.dependencies] +wgpu = { workspace = true, default-features = true } [target.'cfg(target_family = "wasm")'.dependencies] -web-sys = { version = "0.3", features = ["HtmlCanvasElement"] } +web-sys = { workspace = true, features = ["HtmlCanvasElement"] } wgpu = { workspace = true, features = ["webgl"] } [lints] diff --git a/vendor/gpui-pre-wgpu/src/cosmic_text_system.rs b/vendor/gpui-pre-wgpu/src/cosmic_text_system.rs index 0e4e3b11..b7c38bb1 100644 --- a/vendor/gpui-pre-wgpu/src/cosmic_text_system.rs +++ b/vendor/gpui-pre-wgpu/src/cosmic_text_system.rs @@ -418,10 +418,17 @@ impl CosmicTextSystemState { "Segoe Fluent Icons", ]; + // This only decides whether a face can be a primary font. The + // editor measures layout with the width of 'm' and would panic + // without it. + // + // Don't remove the face from the font database. Arabic, Devanagari + // and emoji fonts often have no Latin glyphs, and they are exactly + // what cosmic-text falls back to when the primary font lacks a + // glyph. if font.as_swash().charmap().map('m') == 0 && !allowed_bad_font_names.contains(&postscript_name.as_str()) { - self.font_system.db_mut().remove_face(font.id()); continue; };