Skip to content

Commit cfb3ec0

Browse files
authored
fix(window-state): Ignore is_maximized state in resize events on macos (#2007)
1 parent b8bf4ad commit cfb3ec0

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
window-state: patch
3+
---
4+
5+
On macOS the plugin now (temporarily) ignores the maximized state for undecorated windows on resize events to fix app freezes.

plugins/window-state/src/lib.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,23 @@ impl Builder {
471471
.0
472472
.try_lock()
473473
.is_ok()
474-
&& !window_clone.is_minimized().unwrap_or_default()
475-
&& !window_clone.is_maximized().unwrap_or_default()
476474
{
477-
let mut c = cache.lock().unwrap();
478-
if let Some(state) = c.get_mut(&label) {
479-
state.width = size.width;
480-
state.height = size.height;
475+
// TODO: Remove once https://github.com/tauri-apps/tauri/issues/5812 is resolved.
476+
let is_maximized = if cfg!(target_os = "macos")
477+
&& (!window_clone.is_decorated().unwrap_or_default()
478+
|| !window_clone.is_resizable().unwrap_or_default())
479+
{
480+
false
481+
} else {
482+
window_clone.is_maximized().unwrap_or_default()
483+
};
484+
485+
if !window_clone.is_minimized().unwrap_or_default() && !is_maximized {
486+
let mut c = cache.lock().unwrap();
487+
if let Some(state) = c.get_mut(&label) {
488+
state.width = size.width;
489+
state.height = size.height;
490+
}
481491
}
482492
}
483493
}

0 commit comments

Comments
 (0)