Browse Source

feature: disable mouse event when building windows on Linux, closes #5913 (#6025)

Co-authored-by: Wu Yu Wei <wusyong9104@gmail.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Fixes https://github.com/tauri-apps/tauri/issues/5913
Shogo Hida 2 years ago
parent
commit
8c842a54a6
2 changed files with 11 additions and 0 deletions
  1. 5 0
      .changes/linux-mouse.md
  2. 6 0
      core/tauri-runtime-wry/src/lib.rs

+ 5 - 0
.changes/linux-mouse.md

@@ -0,0 +1,5 @@
+---
+"tauri-runtime-wry": patch
+---
+
+Disable cursor mouse events on Linux.

+ 6 - 0
core/tauri-runtime-wry/src/lib.rs

@@ -750,6 +750,12 @@ impl WindowBuilder for WindowBuilderWrapper {
       ");
     }
 
+    #[cfg(target_os = "linux")]
+    {
+      // Mouse event is disabled on Linux since sudden event bursts could block event loop.
+      window.inner = window.inner.with_cursor_moved_event(false);
+    }
+
     if let (Some(min_width), Some(min_height)) = (config.min_width, config.min_height) {
       window = window.min_inner_size(min_width, min_height);
     }