aboutsummaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
authorPaul Rouget <me@paulrouget.com>2015-09-21 12:58:23 +0200
committerPaul Rouget <me@paulrouget.com>2015-09-23 10:53:35 +0200
commit67a31c622140a27830f5b5c1bd4eabfc6c44a0a0 (patch)
tree913a5902af036540d46b20e9a48b3d9f8bc239d3 /src/api
parent0f9693bde4d67e77fa3691a2c9d3ed0151abec71 (diff)
downloadglutin-67a31c622140a27830f5b5c1bd4eabfc6c44a0a0.tar.gz
glutin-67a31c622140a27830f5b5c1bd4eabfc6c44a0a0.zip
Use NSFullSizeContentViewWindowMask for decoration-less windows
Diffstat (limited to 'src/api')
-rw-r--r--src/api/cocoa/mod.rs32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index 539545c..f602f1f 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);
}