Skip to content

Commit e956457

Browse files
committed
fix: remove macOS frameless window 28px shift compensation
The tauri-plugin-window-state v2.4.1 has no macOS-specific offset for frameless windows - it correctly uses outer_position() for saving and set_position() for restoring. The 28px compensation was added for a bug in an older plugin version that no longer applies. On macOS frameless windows (decorations: false), outer_position() returns the window frame origin which equals the content origin since there is no titlebar. The compensation was causing the saved position to be offset by 28px, leading to the window appearing lower on restart when the correction failed to apply. This removes all +/-28 compensation from both save (quit_app) and restore (lib.rs setup thread, restore_window_state command) paths.
1 parent 949b62f commit e956457

2 files changed

Lines changed: 0 additions & 12 deletions

File tree

src-tauri/src/commands/system.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ pub fn restore_window_state(app: AppHandle) -> Result<(), String> {
5353
}
5454
}
5555
}
56-
#[cfg(target_os = "macos")]
57-
{
58-
if let Ok(mut pos) = window.outer_position() {
59-
pos.y = pos.y.saturating_sub(28);
60-
let _ = window.set_position(tauri::Position::Physical(pos));
61-
}
62-
}
6356
}
6457
Ok(())
6558
}

src-tauri/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,6 @@ pub fn run() {
131131
}
132132
}
133133
}
134-
#[cfg(target_os = "macos")]
135-
if let Ok(mut pos) = win.outer_position() {
136-
pos.y = pos.y.saturating_sub(28);
137-
let _ = win.set_position(tauri::Position::Physical(pos));
138-
}
139134
});
140135
});
141136
} else {

0 commit comments

Comments
 (0)