summaryrefslogtreecommitdiffhomepage
path: root/packages/tauri/src-tauri/src/window_customizer.rs
diff options
context:
space:
mode:
authorBrendan Allan <[email protected]>2025-12-18 19:13:09 +0800
committerGitHub <[email protected]>2025-12-18 05:13:09 -0600
commit0da901a18845adef20bca5011e0c001387c415d5 (patch)
tree25013ee618ac4e17e06dd77d9a15aa38e97212f2 /packages/tauri/src-tauri/src/window_customizer.rs
parent17221e6ffe6bd389522a7d705b1b9aa5bb7edec9 (diff)
downloadopencode-0da901a18845adef20bca5011e0c001387c415d5.tar.gz
opencode-0da901a18845adef20bca5011e0c001387c415d5.zip
tauri: disable pinch zoom on linux (#5735)
Diffstat (limited to 'packages/tauri/src-tauri/src/window_customizer.rs')
-rw-r--r--packages/tauri/src-tauri/src/window_customizer.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/packages/tauri/src-tauri/src/window_customizer.rs b/packages/tauri/src-tauri/src/window_customizer.rs
new file mode 100644
index 000000000..cd42fd029
--- /dev/null
+++ b/packages/tauri/src-tauri/src/window_customizer.rs
@@ -0,0 +1,34 @@
+use tauri::{plugin::Plugin, Manager, Runtime, Window};
+
+pub struct PinchZoomDisablePlugin;
+
+impl Default for PinchZoomDisablePlugin {
+ fn default() -> Self {
+ Self
+ }
+}
+
+impl<R: Runtime> Plugin<R> for PinchZoomDisablePlugin {
+ fn name(&self) -> &'static str {
+ "Does not matter here"
+ }
+
+ fn window_created(&mut self, window: Window<R>) {
+ let Some(webview_window) = window.get_webview_window(window.label()) else {
+ return;
+ };
+
+ let _ = webview_window.with_webview(|_webview| {
+ #[cfg(target_os = "linux")]
+ unsafe {
+ use gtk::glib::ObjectExt;
+ use gtk::GestureZoom;
+ use webkit2gtk::glib::gobject_ffi;
+
+ if let Some(data) = _webview.inner().data::<GestureZoom>("wk-view-zoom-gesture") {
+ gobject_ffi::g_signal_handlers_destroy(data.as_ptr().cast());
+ }
+ }
+ });
+ }
+}