Skip to content

Commit

Permalink
fix(window-state): Ignore is_maximized state in resize events on macos (
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars authored Nov 5, 2024
1 parent b8bf4ad commit cfb3ec0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changes/window-state-disable-maximize-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
window-state: patch
---

On macOS the plugin now (temporarily) ignores the maximized state for undecorated windows on resize events to fix app freezes.
22 changes: 16 additions & 6 deletions plugins/window-state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,13 +471,23 @@ impl Builder {
.0
.try_lock()
.is_ok()
&& !window_clone.is_minimized().unwrap_or_default()
&& !window_clone.is_maximized().unwrap_or_default()
{
let mut c = cache.lock().unwrap();
if let Some(state) = c.get_mut(&label) {
state.width = size.width;
state.height = size.height;
// TODO: Remove once https://github.com/tauri-apps/tauri/issues/5812 is resolved.
let is_maximized = if cfg!(target_os = "macos")
&& (!window_clone.is_decorated().unwrap_or_default()
|| !window_clone.is_resizable().unwrap_or_default())
{
false
} else {
window_clone.is_maximized().unwrap_or_default()
};

if !window_clone.is_minimized().unwrap_or_default() && !is_maximized {
let mut c = cache.lock().unwrap();
if let Some(state) = c.get_mut(&label) {
state.width = size.width;
state.height = size.height;
}
}
}
}
Expand Down

0 comments on commit cfb3ec0

Please sign in to comment.