Skip to content

Comments

fix(macos): update is_maximized method to use ns_window's isZoomed#1181

Open
Tunglies wants to merge 1 commit intotauri-apps:devfrom
Tunglies:fix/macos
Open

fix(macos): update is_maximized method to use ns_window's isZoomed#1181
Tunglies wants to merge 1 commit intotauri-apps:devfrom
Tunglies:fix/macos

Conversation

@Tunglies
Copy link
Contributor

@Tunglies Tunglies commented Feb 2, 2026

It calls set_style_mask_sync twice, forces synchronous IPC. Temporarily adding and removing that triggers unnecessary window layout recalculations and repaints. In multi-thread, modifing the styleMask while view is till initializing leads to the first responder errors and precondition failure crashes. Or lead to unexpected resize behavior.

pub(crate) fn is_zoomed(&self) -> bool {
// because `isZoomed` doesn't work if the window's borderless,
// we make it resizable temporalily.
let curr_mask = unsafe { self.ns_window.styleMask() };
let required = NSWindowStyleMask::Titled | NSWindowStyleMask::Resizable;
let needs_temp_mask = !curr_mask.contains(required);
if needs_temp_mask {
self.set_style_mask_sync(required);
}
let is_zoomed: bool = unsafe { self.ns_window.isZoomed() };
// Roll back temp styles
if needs_temp_mask {
self.set_style_mask_sync(curr_mask);
}
is_zoomed
}

This PR related to:
tauri-apps/plugins-workspace#3242
tauri-apps/tauri#5812
agmmnn/tauri-controls#10
tauri-apps/tauri#10261
#641

The is_zoomed is setting a temporary, then reading. Leads to

This seems to trigger an infinite loop of sorts tauri-apps/tauri#5812

I will give another PR to change is_zoomed latter.

CC @Legend-Master, @amrbashir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant