From ee3cf74104b3e3fa9d96b58d1d6e6d945da0dec6 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 16 Jan 2023 10:24:20 -0300 Subject: [PATCH] do not expose mouse_event method --- .changes/linux-mouse.md | 3 +-- core/tauri-runtime-wry/src/lib.rs | 8 +------- core/tauri-runtime/src/webview.rs | 5 ----- core/tauri/src/test/mock_runtime.rs | 5 ----- 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/.changes/linux-mouse.md b/.changes/linux-mouse.md index a8674b1aba5e..d1713a326c71 100644 --- a/.changes/linux-mouse.md +++ b/.changes/linux-mouse.md @@ -2,5 +2,4 @@ "tauri-runtime-wry": patch --- -On Linux, disable mouse event when creating windows with `with_config`. - +Disable cursor mouse events on Linux. diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 70ec035d82f9..2525746eed5e 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -753,7 +753,7 @@ impl WindowBuilder for WindowBuilderWrapper { #[cfg(target_os = "linux")] { // Mouse event is disabled on Linux since sudden event bursts could block event loop. - window = window.mouse_event(false); + window.inner = window.inner.with_cursor_moved_event(false); } if let (Some(min_width), Some(min_height)) = (config.min_width, config.min_height) { @@ -956,12 +956,6 @@ impl WindowBuilder for WindowBuilderWrapper { fn get_menu(&self) -> Option<&Menu> { self.menu.as_ref() } - - #[cfg(target_os = "linux")] - fn mouse_event(mut self, enable: bool) -> Self { - self.inner = self.inner.with_cursor_moved_event(enable); - self - } } pub struct FileDropEventWrapper(WryFileDropEvent); diff --git a/core/tauri-runtime/src/webview.rs b/core/tauri-runtime/src/webview.rs index 1cb130f776d5..d3d06a4a6bcc 100644 --- a/core/tauri-runtime/src/webview.rs +++ b/core/tauri-runtime/src/webview.rs @@ -250,11 +250,6 @@ pub trait WindowBuilder: WindowBuilderBase { /// Gets the window menu. fn get_menu(&self) -> Option<&Menu>; - - /// Disables mouse events on Linux. - #[cfg(target_os = "linux")] - #[must_use] - fn mouse_event(self, enable: bool) -> Self; } /// IPC handler. diff --git a/core/tauri/src/test/mock_runtime.rs b/core/tauri/src/test/mock_runtime.rs index 19cb2d52e556..e9ce754ec8e2 100644 --- a/core/tauri/src/test/mock_runtime.rs +++ b/core/tauri/src/test/mock_runtime.rs @@ -303,11 +303,6 @@ impl WindowBuilder for MockWindowBuilder { fn get_menu(&self) -> Option<&Menu> { None } - - #[cfg(target_os = "linux")] - fn mouse_event(self, enable: bool) -> Self { - self - } } impl Dispatch for MockDispatcher {