mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-06-16 13:34:04 +08:00
64c068415e
Linux users reported the window UI (including native title bar buttons) couldn't receive clicks until manually maximizing and restoring the window. Root causes: (1) Tauri webview did not acquire focus on startup so first clicks were consumed by X11/Wayland click-to-activate (Tauri #10746, wry #637); (2) GTK surface input region failed to renegotiate on the visible:false + show() path under some WebKitGTK/compositor combinations. - Add linux_fix::nudge_main_window helper that performs set_focus plus a ±1px no-op resize after window show, with a 500ms reconciliation readback to compensate for dropped resize requests on slow compositors. - Wire the helper into every window re-show path: normal startup, deeplink, single_instance, tray show_main, and lightweight exit. - Set WEBKIT_DISABLE_COMPOSITING_MODE=1 at startup to avoid resize crashes and Wayland surface negotiation issues. - Remove data-tauri-drag-region on Linux from App.tsx header and the shared FullScreenPanel (used by all provider/MCP/workspace forms) to avoid Tauri #13440 in Wayland sessions. Extract drag-region constants to src/lib/platform.ts for reuse. All Rust changes are gated by #[cfg(target_os = "linux")]; frontend changes preserve macOS/Windows behavior via runtime isLinux() checks. Known limitation: tiling Wayland compositors ignore set_size, so GDK_BACKEND=x11 remains the user-side workaround.
23 lines
1.0 KiB
Rust
23 lines
1.0 KiB
Rust
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
fn main() {
|
|
// 在 Linux 上设置 WebKit 环境变量以解决 DMA-BUF 渲染问题
|
|
// 某些 Linux 系统(如 Debian 13.2、Nvidia GPU)上 WebKitGTK 的 DMA-BUF 渲染器可能导致白屏/黑屏
|
|
// 参考: https://github.com/tauri-apps/tauri/issues/9394
|
|
#[cfg(target_os = "linux")]
|
|
{
|
|
if std::env::var("WEBKIT_DISABLE_DMABUF_RENDERER").is_err() {
|
|
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
|
}
|
|
// 禁用 WebKitGTK 合成模式,规避 resize 时 webview 崩溃以及部分 Wayland
|
|
// 合成器下的 surface 协商问题(整窗 UI 点击无响应、必须最大化-还原才能恢复)。
|
|
// 参考: https://github.com/tauri-apps/tauri/issues/9394
|
|
if std::env::var("WEBKIT_DISABLE_COMPOSITING_MODE").is_err() {
|
|
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
|
|
}
|
|
}
|
|
|
|
cc_switch_lib::run();
|
|
}
|