macOS: Fix NSWindowLevel values (#2545)

* Fix NSWindowLevel values

* Fix formatting
This commit is contained in:
Mads Marquart 2022-11-22 11:08:56 +01:00 committed by GitHub
parent 05484c5888
commit bdcbd7d1f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 40 deletions

View file

@ -36,7 +36,8 @@ use crate::{
use core_graphics::display::{CGDisplay, CGPoint};
use objc2::declare::{Ivar, IvarDrop};
use objc2::foundation::{
is_main_thread, CGFloat, NSArray, NSCopying, NSObject, NSPoint, NSRect, NSSize, NSString,
is_main_thread, CGFloat, NSArray, NSCopying, NSInteger, NSObject, NSPoint, NSRect, NSSize,
NSString,
};
use objc2::rc::{autoreleasepool, Id, Owned, Shared};
use objc2::{declare_class, msg_send, msg_send_id, sel, ClassType};
@ -944,10 +945,9 @@ impl WinitWindow {
| NSApplicationPresentationOptions::NSApplicationPresentationHideMenuBar;
app.setPresentationOptions(presentation_options);
#[allow(clippy::let_unit_value)]
unsafe {
let _: () = msg_send![self, setLevel: ffi::CGShieldingWindowLevel() + 1];
}
let window_level =
NSWindowLevel(unsafe { ffi::CGShieldingWindowLevel() } as NSInteger + 1);
self.setLevel(window_level);
}
(&Some(Fullscreen::Exclusive(ref video_mode)), &Some(Fullscreen::Borderless(_))) => {
let presentation_options =