From bbaa129842d38d3182771da1d4baf399304a4f5f Mon Sep 17 00:00:00 2001 From: Felix Kaaman Date: Tue, 16 Jun 2015 11:29:17 +0200 Subject: Add transparency support for cocoa. Closes #472 --- src/api/cocoa/mod.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/api') diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index ba5710d..d080d06 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -357,6 +357,21 @@ impl Window { }; 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); if builder.visible { 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 } else { NSTitledWindowMask as NSUInteger | -- cgit v1.2.3