The open source coding agent.
TypeScript
fix(desktop): disable magnification gestures on macOS (#10605)
Chris Yangd9e8b2b65d9f
diff --git a/packages/desktop/src-tauri/Cargo.lock b/packages/desktop/src-tauri/Cargo.lockindex a41739a697b..294d7ad6ce5 100644--- a/packages/desktop/src-tauri/Cargo.lock+++ b/packages/desktop/src-tauri/Cargo.lock@@ -3028,6 +3028,8 @@ dependencies = ["futures","gtk","listeners",+ "objc2 0.6.3",+ "objc2-web-kit","reqwest","semver","serde",diff --git a/packages/desktop/src-tauri/Cargo.toml b/packages/desktop/src-tauri/Cargo.tomlindex 6296b8325fb..b875f928b0b 100644--- a/packages/desktop/src-tauri/Cargo.toml+++ b/packages/desktop/src-tauri/Cargo.toml@@ -47,6 +47,10 @@ comrak = { version = "0.50", default-features = false }gtk = "0.18.2"webkit2gtk = "=2.0.1"+[target.'cfg(target_os = "macos")'.dependencies]+objc2 = "0.6"+objc2-web-kit = "0.3"+[target.'cfg(windows)'.dependencies]windows = { version = "0.61", features = ["Win32_Foundation",diff --git a/packages/desktop/src-tauri/src/window_customizer.rs b/packages/desktop/src-tauri/src/window_customizer.rsindex cd42fd0299c..682f57f2471 100644--- a/packages/desktop/src-tauri/src/window_customizer.rs+++ b/packages/desktop/src-tauri/src/window_customizer.rs@@ -29,6 +29,18 @@ impl<R: Runtime> Plugin<R> for PinchZoomDisablePlugin {gobject_ffi::g_signal_handlers_destroy(data.as_ptr().cast());}}++ #[cfg(target_os = "macos")]+ unsafe {+ use objc2::rc::Retained;+ use objc2_web_kit::WKWebView;++ // Get the WKWebView pointer and disable magnification gestures+ // This prevents Cmd+Ctrl+scroll and pinch-to-zoom from changing the zoom level+ let wk_webview: Retained<WKWebView> =+ Retained::retain(_webview.inner().cast()).unwrap();+ wk_webview.setAllowsMagnification(false);+ }});}}