mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
fix(titlebar): re-focus window after re-enabling native decorations on GTK
GTK re-stacks the window when set_decorations(true) is called, causing it to lose focus and sink behind other windows. Call set_focus() immediately after to bring it back to the front. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,11 @@ fn exit_app(app_handle: tauri::AppHandle) {
|
|||||||
fn set_window_decorations(enabled: bool, app_handle: tauri::AppHandle) {
|
fn set_window_decorations(enabled: bool, app_handle: tauri::AppHandle) {
|
||||||
if let Some(win) = app_handle.get_webview_window("main") {
|
if let Some(win) = app_handle.get_webview_window("main") {
|
||||||
let _ = win.set_decorations(enabled);
|
let _ = win.set_decorations(enabled);
|
||||||
|
// Re-enabling native decorations on GTK causes the window manager to
|
||||||
|
// re-stack the window, which drops focus. Bring it back immediately.
|
||||||
|
if enabled {
|
||||||
|
let _ = win.set_focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user