mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-15 04:40:40 -07:00
fix(linux): skip click-through toggle on dictate pill to prevent startup crash (#906)
The dictate pill window is built hidden at setup and the frontend emits dictate:hide as soon as it mounts. The handler calls set_ignore_cursor_events(true) on a window GTK has never realized, and tao's CursorIgnoreEvents path unwraps the missing GdkWindow (tao-0.34.5 event_loop.rs:449), panicking inside a glib dispatch that cannot unwind — the process aborts within seconds of launch on Linux. The click-through toggle exists as a macOS workaround for transparent always-on-top NSWindows lingering as invisible click targets; it was never needed on Linux. Gate all three call sites so Linux never toggles it: the true/false pair stays balanced (never set, never unset), and macOS/Windows builds are unchanged. Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
committed by
Jamie Pine
co-authored by
Claude Fable 5
parent
f7c08477a0
commit
89d489f711
@@ -264,6 +264,9 @@ fn apply_effect(app: &AppHandle, effect: Effect) {
|
||||
let _ = window.set_position(tauri::PhysicalPosition::new(x, y));
|
||||
}
|
||||
}
|
||||
// Skip on Linux: aborts if the window was never realized
|
||||
// (see show_dictate_window in main.rs).
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let _ = window.set_ignore_cursor_events(false);
|
||||
// Deliberately no set_focus() — taking key focus would yank
|
||||
// it out of whatever app the user was typing in, which is
|
||||
|
||||
@@ -244,6 +244,10 @@ pub fn show_dictate_window(app: &tauri::AppHandle) {
|
||||
let _ = window.set_position(PhysicalPosition::new(x, y));
|
||||
}
|
||||
}
|
||||
// Skip on Linux: tao's CursorIgnoreEvents handler unwraps the GdkWindow,
|
||||
// which is None until the window is first shown, aborting the process.
|
||||
// The click-through toggle is a macOS workaround and is never set on Linux.
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let _ = window.set_ignore_cursor_events(false);
|
||||
let _ = window.show();
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -1597,6 +1601,9 @@ pub fn run() {
|
||||
let handle_for_hide = app.handle().clone();
|
||||
app.handle().listen("dictate:hide", move |_event| {
|
||||
if let Some(window) = handle_for_hide.get_webview_window(DICTATE_WINDOW_LABEL) {
|
||||
// Skip on Linux: aborts if the window was never realized
|
||||
// (see show_dictate_window).
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let _ = window.set_ignore_cursor_events(true);
|
||||
let _ = window.set_position(PhysicalPosition::new(-10_000, -10_000));
|
||||
let _ = window.hide();
|
||||
|
||||
Reference in New Issue
Block a user