diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-09-23 13:29:28 +0200 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-09-23 13:29:28 +0200 |
commit | a448043b16127be97be6c492be5831a5965d1145 (patch) | |
tree | 9849f133b129ff3450324ca94c39d536d62cfb28 /src/api/cocoa | |
parent | dc7c15b7d9572e5ad19f92cef101d1ca7d287261 (diff) | |
parent | 68230faeb0c239bbf3ce97a0094f9bfbfc4ea965 (diff) | |
download | glutin-a448043b16127be97be6c492be5831a5965d1145.tar.gz glutin-a448043b16127be97be6c492be5831a5965d1145.zip |
Merge pull request #606 from paulrouget/NSFullSizeContentViewWindowMask
Use NSFullSizeContentViewWindowMask for decoration-less windows
Diffstat (limited to 'src/api/cocoa')
-rw-r--r-- | src/api/cocoa/mod.rs | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index 9e9a001..78d0f52 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -399,14 +399,24 @@ impl Window { } }; - let masks = if screen.is_some() || !attrs.decorations { - NSBorderlessWindowMask as NSUInteger | - NSResizableWindowMask as NSUInteger - } else { - NSTitledWindowMask as NSUInteger | - NSClosableWindowMask as NSUInteger | - NSMiniaturizableWindowMask as NSUInteger | - NSResizableWindowMask as NSUInteger + let masks = match (attrs.decorations, attrs.transparent) { + (true, false) => + // Classic opaque window with titlebar + NSClosableWindowMask as NSUInteger | + NSMiniaturizableWindowMask as NSUInteger | + NSResizableWindowMask as NSUInteger | + NSTitledWindowMask 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_( @@ -419,6 +429,12 @@ impl Window { let title = IdRef::new(NSString::alloc(nil).init_str(&attrs.title)); window.setTitle_(*title); window.setAcceptsMouseMovedEvents_(YES); + + if !attrs.decorations { + window.setTitleVisibility_(NSWindowTitleVisibility::NSWindowTitleHidden); + window.setTitlebarAppearsTransparent_(YES); + } + if screen.is_some() { window.setLevel_(NSMainMenuWindowLevel as i64 + 1); } |