Merge pull request #3509 from bengotow/macosx-desktop-window
Support the "desktop" window type on Mac OS X
This commit is contained in:
commit
c1d6d68783
2 changed files with 45 additions and 10 deletions
|
@ -211,6 +211,8 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
}
|
||||
@property BOOL acceptsFirstMouse;
|
||||
@property BOOL disableAutoHideCursor;
|
||||
@property BOOL disableKeyOrMainWindow;
|
||||
|
||||
- (void)setShell:(atom::NativeWindowMac*)shell;
|
||||
- (void)setEnableLargerThanScreen:(bool)enable;
|
||||
@end
|
||||
|
@ -257,6 +259,16 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
return [children filteredArrayUsingPredicate:predicate];
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeMainWindow
|
||||
{
|
||||
return !self.disableKeyOrMainWindow;
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeKeyWindow
|
||||
{
|
||||
return !self.disableKeyOrMainWindow;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface ControlRegionView : NSView
|
||||
|
@ -330,8 +342,6 @@ NativeWindowMac::NativeWindowMac(
|
|||
width,
|
||||
height);
|
||||
|
||||
bool useStandardWindow = true;
|
||||
options.Get(options::kStandardWindow, &useStandardWindow);
|
||||
bool resizable = true;
|
||||
options.Get(options::kResizable, &resizable);
|
||||
|
||||
|
@ -340,6 +350,17 @@ NativeWindowMac::NativeWindowMac(
|
|||
if (base::mac::IsOSYosemiteOrLater())
|
||||
options.Get(options::kTitleBarStyle, &titleBarStyle);
|
||||
|
||||
std::string windowType;
|
||||
options.Get(options::kType, &windowType);
|
||||
|
||||
bool useStandardWindow = true;
|
||||
// eventually deprecate separate "standardWindow" option in favor of
|
||||
// standard / textured window types
|
||||
options.Get(options::kStandardWindow, &useStandardWindow);
|
||||
if (windowType == "textured") {
|
||||
useStandardWindow = false;
|
||||
}
|
||||
|
||||
NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask;
|
||||
if (!useStandardWindow || transparent() || !has_frame()) {
|
||||
|
@ -371,6 +392,15 @@ NativeWindowMac::NativeWindowMac(
|
|||
[window_ setBackgroundColor:[NSColor clearColor]];
|
||||
}
|
||||
|
||||
if (windowType == "desktop") {
|
||||
[window_ setLevel:kCGDesktopWindowLevel - 1];
|
||||
[window_ setDisableKeyOrMainWindow: YES];
|
||||
[window_ setCollectionBehavior:
|
||||
(NSWindowCollectionBehaviorCanJoinAllSpaces |
|
||||
NSWindowCollectionBehaviorStationary |
|
||||
NSWindowCollectionBehaviorIgnoresCycle)];
|
||||
}
|
||||
|
||||
// Remove non-transparent corners, see http://git.io/vfonD.
|
||||
if (!has_frame())
|
||||
[window_ setOpaque:NO];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue