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
6 changes: 6 additions & 0 deletions core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,9 @@ pub struct WindowConfig {
pub skip_taskbar: bool,
/// The initial window theme. Defaults to the system theme. Only implemented on Windows and macOS 10.14+.
pub theme: Option<crate::Theme>,
/// Whether a mouse event is disabled or not on Linux.
#[serde(default, alias = "disable-mouse-event")]
pub disable_mouse_event: bool,
/// The style of the macOS title bar.
#[serde(default, alias = "title-bar-style")]
pub title_bar_style: TitleBarStyle,
Expand Down Expand Up @@ -977,6 +980,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 +3136,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 +3171,7 @@ mod build {
content_protected,
skip_taskbar,
theme,
disable_mouse_event,
title_bar_style,
hidden_title,
accept_first_mouse,
Expand Down