Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ──────────────────────────────────────────────────────────────────────

Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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 ─────────────────────────────────────────────────────────────────

Expand Down
6 changes: 3 additions & 3 deletions example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 6 additions & 0 deletions src/android/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ impl PlatformDisplay for AndroidDisplay {
DisplayId::new(self.id as u64)
}

fn refresh_interval(&self) -> Option<std::time::Duration> {
// 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<uuid::Uuid> {
// Android NDK does not provide a stable UUID for displays.
// Synthesise a deterministic v5 UUID from the display id so that
Expand Down
7 changes: 7 additions & 0 deletions src/android/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,10 @@ impl Platform for AndroidPlatform {
});
}

fn on_displays_changed(&self, _callback: Box<dyn FnMut()>) {
// Android reports no display hot-plug configuration callback here; no-op.
}

fn set_menus(&self, _menus: Vec<Menu>, _keymap: &Keymap) {
// No-op: Android doesn't have macOS-style menus.
}
Expand Down Expand Up @@ -1530,6 +1534,9 @@ impl Platform for SharedPlatform {
fn on_reopen(&self, callback: Box<dyn FnMut()>) {
<AndroidPlatform as Platform>::on_reopen(&self.0, callback)
}
fn on_displays_changed(&self, callback: Box<dyn FnMut()>) {
<AndroidPlatform as Platform>::on_displays_changed(&self.0, callback)
}
fn set_menus(&self, menus: Vec<Menu>, keymap: &Keymap) {
<AndroidPlatform as Platform>::set_menus(&self.0, menus, keymap)
}
Expand Down
4 changes: 4 additions & 0 deletions src/android/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,10 @@ impl PlatformWindow for AndroidPlatformWindow {
// Android windows don't move — they're always fullscreen.
}

fn on_display_changed(&self, _callback: Box<dyn FnMut()>) {
// An Android window stays on its single display for its lifetime; no-op.
}

fn on_should_close(&self, _callback: Box<dyn FnMut() -> bool>) {
// Android app lifecycle is managed by the system.
}
Expand Down
11 changes: 10 additions & 1 deletion src/ios/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Duration> {
// `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)
}
}
5 changes: 5 additions & 0 deletions src/ios/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ impl Platform for IosPlatform {
// iOS handles app reopening through scene lifecycle
}

fn on_displays_changed(&self, _callback: Box<dyn FnMut()>) {
// 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<Menu>, _keymap: &Keymap) {
// iOS doesn't have a menu bar
// Could potentially integrate with UIMenuBuilder for context menus
Expand Down
5 changes: 5 additions & 0 deletions src/ios/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,11 @@ impl PlatformWindow for IosWindow {
*self.moved_callback.borrow_mut() = Some(callback);
}

fn on_display_changed(&self, _callback: Box<dyn FnMut()>) {
// 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<dyn FnMut() -> bool>) {
*self.should_close_callback.borrow_mut() = Some(callback);
}
Expand Down
42 changes: 28 additions & 14 deletions vendor/gpui-pre-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
[package]
edition = "2024"
name = "gpui-pre-wgpu"
version = "0.3.8"
version = "0.3.9"
build = false
publish = true
autolib = false
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"
Expand All @@ -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 = [
Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
19 changes: 12 additions & 7 deletions vendor/gpui-pre-wgpu/Cargo.toml.orig

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion vendor/gpui-pre-wgpu/src/cosmic_text_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
Loading