Skip to content

Commit

Permalink
do not expose mouse_event method
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Jan 16, 2023
1 parent ec69900 commit ee3cf74
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .changes/linux-mouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 1 addition & 7 deletions core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 0 additions & 5 deletions core/tauri-runtime/src/webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions core/tauri/src/test/mock_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: UserEvent> Dispatch<T> for MockDispatcher {
Expand Down

0 comments on commit ee3cf74

Please sign in to comment.