aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Kaaman <trundmatu@gmail.com>2015-06-16 11:29:17 +0200
committerFelix Kaaman <trundmatu@gmail.com>2015-06-16 11:29:17 +0200
commitbbaa129842d38d3182771da1d4baf399304a4f5f (patch)
tree7b40e75b0d80ccf59fef81ad6d7339c401f29f3f
parenteb73c2514eefae08a5f1850ce7ee7178b903c4cf (diff)
downloadglutin-bbaa129842d38d3182771da1d4baf399304a4f5f.tar.gz
glutin-bbaa129842d38d3182771da1d4baf399304a4f5f.zip
Add transparency support for cocoa. Closes #472
-rw-r--r--src/api/cocoa/mod.rs17
1 files changed, 16 insertions, 1 deletions
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 |