mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
Add transparency support for cocoa. Closes #472
This commit is contained in:
parent
eb73c2514e
commit
bbaa129842
|
@ -357,6 +357,21 @@ impl Window {
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
if builder.transparent {
|
||||||
|
let clear_col = {
|
||||||
|
let cls = Class::get("NSColor").unwrap();
|
||||||
|
|
||||||
|
msg_send![cls, clearColor]
|
||||||
|
};
|
||||||
|
window.setOpaque_(NO);
|
||||||
|
window.setBackgroundColor_(clear_col);
|
||||||
|
|
||||||
|
let obj = context.CGLContextObj();
|
||||||
|
|
||||||
|
let mut opacity = 0;
|
||||||
|
CGLSetParameter(obj, kCGLCPSurfaceOpacity, &mut opacity);
|
||||||
|
}
|
||||||
|
|
||||||
app.activateIgnoringOtherApps_(YES);
|
app.activateIgnoringOtherApps_(YES);
|
||||||
if builder.visible {
|
if builder.visible {
|
||||||
window.makeKeyAndOrderFront_(nil);
|
window.makeKeyAndOrderFront_(nil);
|
||||||
|
@ -437,7 +452,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let masks = if screen.is_some() {
|
let masks = if screen.is_some() || !builder.decorations {
|
||||||
NSBorderlessWindowMask as NSUInteger
|
NSBorderlessWindowMask as NSUInteger
|
||||||
} else {
|
} else {
|
||||||
NSTitledWindowMask as NSUInteger |
|
NSTitledWindowMask as NSUInteger |
|
||||||
|
|
Loading…
Reference in a new issue