Merge branch 'main' into fix-notification-positioning

This commit is contained in:
Conrad Irwin 2024-01-19 12:55:52 -07:00
commit cb84043400
59 changed files with 1753 additions and 631 deletions

View file

@ -514,25 +514,6 @@ impl MacWindow {
NSArray::arrayWithObject(nil, NSFilenamesPboardType)
];
let screen = native_window.screen();
match options.bounds {
WindowBounds::Fullscreen => {
native_window.toggleFullScreen_(nil);
}
WindowBounds::Maximized => {
native_window.setFrame_display_(screen.visibleFrame(), YES);
}
WindowBounds::Fixed(bounds) => {
let display_bounds = display.bounds();
let frame = if bounds.intersects(&display_bounds) {
global_bounds_to_ns_rect(bounds)
} else {
global_bounds_to_ns_rect(display_bounds)
};
native_window.setFrame_display_(frame, YES);
}
}
let native_view: id = msg_send![VIEW_CLASS, alloc];
let native_view = NSView::init(native_view);
@ -654,6 +635,27 @@ impl MacWindow {
native_window.orderFront_(nil);
}
let screen = native_window.screen();
match options.bounds {
WindowBounds::Fullscreen => {
// We need to toggle full screen asynchronously as doing so may
// call back into the platform handlers.
window.toggle_full_screen()
}
WindowBounds::Maximized => {
native_window.setFrame_display_(screen.visibleFrame(), YES);
}
WindowBounds::Fixed(bounds) => {
let display_bounds = display.bounds();
let frame = if bounds.intersects(&display_bounds) {
global_bounds_to_ns_rect(bounds)
} else {
global_bounds_to_ns_rect(display_bounds)
};
native_window.setFrame_display_(frame, YES);
}
}
window.0.lock().move_traffic_light();
pool.drain();