Skip to content

fix: maximization for non decoration window, closes #464 #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/fix-non-decoration-maximizing-macos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": patch
---

Fixed maximization for non decoration window.
16 changes: 14 additions & 2 deletions src/platform_impl/macos/util/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{
use cocoa::{
appkit::{CGFloat, NSScreen, NSWindow, NSWindowStyleMask},
base::{id, nil},
foundation::{NSPoint, NSSize, NSString},
foundation::{NSPoint, NSRect, NSSize, NSString},
};
use dispatch::Queue;
use objc::{
Expand Down Expand Up @@ -179,8 +179,20 @@ pub unsafe fn set_maximized_async(
} else {
// if it's not resizable, we set the frame directly
let new_rect = if maximized {
let max_size = ns_window.maxSize();
let screen = NSScreen::mainScreen(nil);
NSScreen::visibleFrame(screen)
let screen_rect = NSScreen::visibleFrame(screen);
let width = if max_size.width < screen_rect.size.width {
max_size.width
} else {
screen_rect.size.width
};
let height = if max_size.height < screen_rect.size.height {
max_size.height
} else {
screen_rect.size.height
};
NSRect::new(screen_rect.origin, NSSize::new(width, height))
} else {
shared_state_lock.saved_standard_frame()
};
Expand Down