Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 10 commits into from
Jan 16, 2023
9 changes: 8 additions & 1 deletion core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,8 @@ impl WindowBuilder for WindowBuilderWrapper {
.always_on_top(config.always_on_top)
.content_protected(config.content_protected)
.skip_taskbar(config.skip_taskbar)
.theme(config.theme);
.theme(config.theme)
.disable_mouse_event(config.disable_mouse_event);
wusyong marked this conversation as resolved.
Show resolved Hide resolved

#[cfg(target_os = "macos")]
{
Expand Down Expand Up @@ -950,6 +951,12 @@ impl WindowBuilder for WindowBuilderWrapper {
fn get_menu(&self) -> Option<&Menu> {
self.menu.as_ref()
}

#[cfg(target_os = "linux")]
fn disable_mouse_event(mut self, disable: bool) -> Self {
wusyong marked this conversation as resolved.
Show resolved Hide resolved
self.inner = self.inner.disable_mouse_event(disable);
self
}
}

pub struct FileDropEventWrapper(WryFileDropEvent);
Expand Down
5 changes: 5 additions & 0 deletions core/tauri-runtime/src/webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ 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 disable_mouse_event(self, disable: bool) -> Self;
}

/// IPC handler.
Expand Down
3 changes: 3 additions & 0 deletions core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ impl Default for WindowConfig {
content_protected: false,
skip_taskbar: false,
theme: None,
disable_mouse_event: false,
title_bar_style: Default::default(),
hidden_title: false,
accept_first_mouse: false,
Expand Down Expand Up @@ -3132,6 +3133,7 @@ mod build {
let content_protected = self.content_protected;
let skip_taskbar = self.skip_taskbar;
let theme = opt_lit(self.theme.as_ref());
let disable_mouse_event = self.disable_mouse_event;
let title_bar_style = &self.title_bar_style;
let hidden_title = self.hidden_title;
let accept_first_mouse = self.accept_first_mouse;
Expand Down Expand Up @@ -3166,6 +3168,7 @@ mod build {
content_protected,
skip_taskbar,
theme,
disable_mouse_event,
title_bar_style,
hidden_title,
accept_first_mouse,
Expand Down