Skip to content
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