macos platform attributes regression (#488)

* macOS: fix regression in 03c3e794097676888234b3cc82c01228dcbe48c8

fixed !decorations case and refactored logic to be a little easier to
read

* fix default case to inlude closable mask

* add comment to default case of macos platform attrs
This commit is contained in:
Joe Moon 2018-04-29 15:51:57 -07:00 committed by Francesca Frangipane
parent ea28791da6
commit eba888207e
2 changed files with 12 additions and 18 deletions

View file

@ -1,5 +1,6 @@
# Unreleased
- Fix `.with_decorations(false)` in macOS
- On Mac, `NSWindow` and supporting objects might be alive long after they were `closed` which resulted in apps consuming more heap then needed. Mainly it was affecting multi window applications. Not expecting any user visible change of behaviour after the fix.
- Fix regression of Window platform extensions for macOS where `NSFullSizeContentViewWindowMask` was not being correctly applied to `.fullsize_content_view`.
- Corrected `get_position` on Windows to be relative to the screen rather than to the taskbar.

View file

@ -719,33 +719,26 @@ impl Window2 {
}
};
let masks = if pl_attrs.titlebar_hidden {
let mut masks = if !attrs.decorations && !screen.is_some() {
// unresizable Window2 without a titlebar or borders
// if decorations is set to false, ignore pl_attrs
NSWindowStyleMask::NSBorderlessWindowMask
} else if pl_attrs.titlebar_hidden {
// if the titlebar is hidden, ignore other pl_attrs
NSWindowStyleMask::NSBorderlessWindowMask |
NSWindowStyleMask::NSResizableWindowMask
} else if !pl_attrs.titlebar_transparent {
// Window2 with a titlebar
NSWindowStyleMask::NSClosableWindowMask |
NSWindowStyleMask::NSMiniaturizableWindowMask |
NSWindowStyleMask::NSResizableWindowMask |
NSWindowStyleMask::NSTitledWindowMask
} else if pl_attrs.fullsize_content_view {
// Window2 with a transparent titlebar and fullsize content view
NSWindowStyleMask::NSClosableWindowMask |
NSWindowStyleMask::NSMiniaturizableWindowMask |
NSWindowStyleMask::NSResizableWindowMask |
NSWindowStyleMask::NSTitledWindowMask |
NSWindowStyleMask::NSFullSizeContentViewWindowMask
} else if !attrs.decorations && !screen.is_some() {
// Window2 without a titlebar
NSWindowStyleMask::NSBorderlessWindowMask
} else {
// Window2 with a transparent titlebar and regular content view
// default case, resizable window with titlebar and titlebar buttons
NSWindowStyleMask::NSClosableWindowMask |
NSWindowStyleMask::NSMiniaturizableWindowMask |
NSWindowStyleMask::NSResizableWindowMask |
NSWindowStyleMask::NSTitledWindowMask
};
if pl_attrs.fullsize_content_view {
masks = masks | NSWindowStyleMask::NSFullSizeContentViewWindowMask;
}
let winit_window = Window2::class();
let window: id = msg_send![winit_window, alloc];