Merge pull request #487 from fkaa/cocoa-transparency

Add transparency support for cocoa.
This commit is contained in:
tomaka 2015-06-16 14:37:15 +02:00
commit 4589e4a723

View file

@ -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 |