mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Use NSFullSizeContentViewWindowMask for decoration-less windows
This commit is contained in:
parent
0f9693bde4
commit
67a31c6221
|
@ -399,14 +399,24 @@ impl Window {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let masks = if screen.is_some() || !attrs.decorations {
|
let masks = match (attrs.decorations, attrs.transparent) {
|
||||||
NSBorderlessWindowMask as NSUInteger |
|
(true, false) =>
|
||||||
NSResizableWindowMask as NSUInteger
|
// Classic opaque window with titlebar
|
||||||
} else {
|
NSClosableWindowMask as NSUInteger |
|
||||||
NSTitledWindowMask as NSUInteger |
|
NSMiniaturizableWindowMask as NSUInteger |
|
||||||
NSClosableWindowMask as NSUInteger |
|
NSResizableWindowMask as NSUInteger |
|
||||||
NSMiniaturizableWindowMask as NSUInteger |
|
NSTitledWindowMask as NSUInteger,
|
||||||
NSResizableWindowMask as NSUInteger
|
(false, false) =>
|
||||||
|
// Opaque window without a titlebar
|
||||||
|
NSClosableWindowMask as NSUInteger |
|
||||||
|
NSMiniaturizableWindowMask as NSUInteger |
|
||||||
|
NSResizableWindowMask as NSUInteger |
|
||||||
|
NSTitledWindowMask as NSUInteger |
|
||||||
|
NSFullSizeContentViewWindowMask as NSUInteger,
|
||||||
|
(_, true) =>
|
||||||
|
// Fully transparent window.
|
||||||
|
// No shadow, decorations or borders.
|
||||||
|
NSBorderlessWindowMask as NSUInteger
|
||||||
};
|
};
|
||||||
|
|
||||||
let window = IdRef::new(NSWindow::alloc(nil).initWithContentRect_styleMask_backing_defer_(
|
let window = IdRef::new(NSWindow::alloc(nil).initWithContentRect_styleMask_backing_defer_(
|
||||||
|
@ -419,6 +429,12 @@ impl Window {
|
||||||
let title = IdRef::new(NSString::alloc(nil).init_str(&attrs.title));
|
let title = IdRef::new(NSString::alloc(nil).init_str(&attrs.title));
|
||||||
window.setTitle_(*title);
|
window.setTitle_(*title);
|
||||||
window.setAcceptsMouseMovedEvents_(YES);
|
window.setAcceptsMouseMovedEvents_(YES);
|
||||||
|
|
||||||
|
if !attrs.decorations {
|
||||||
|
window.setTitleVisibility_(NSWindowTitleVisibility::NSWindowTitleHidden);
|
||||||
|
window.setTitlebarAppearsTransparent_(YES);
|
||||||
|
}
|
||||||
|
|
||||||
if screen.is_some() {
|
if screen.is_some() {
|
||||||
window.setLevel_(NSMainMenuWindowLevel as i64 + 1);
|
window.setLevel_(NSMainMenuWindowLevel as i64 + 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue