зеркало из https://github.com/electron/electron.git
fix: update deprecated NSWindow masks (#14760)
This commit is contained in:
Родитель
be2c27d5b8
Коммит
985d35fc1c
|
@ -55,7 +55,7 @@ const NSAutoresizingMaskOptions kDefaultAutoResizingMask =
|
|||
return;
|
||||
}
|
||||
|
||||
if (self.window.styleMask & NSFullScreenWindowMask) {
|
||||
if (self.window.styleMask & NSWindowStyleMaskFullScreen) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ const NSAutoresizingMaskOptions kDefaultAutoResizingMask =
|
|||
return;
|
||||
}
|
||||
|
||||
if (self.window.styleMask & NSFullScreenWindowMask) {
|
||||
if (self.window.styleMask & NSWindowStyleMaskFullScreen) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,13 +70,15 @@
|
|||
- (id)initWithFrame:(NSRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
|
||||
NSButton* close_button = [NSWindow standardWindowButton:NSWindowCloseButton
|
||||
forStyleMask:NSTitledWindowMask];
|
||||
NSButton* close_button =
|
||||
[NSWindow standardWindowButton:NSWindowCloseButton
|
||||
forStyleMask:NSWindowStyleMaskTitled];
|
||||
NSButton* miniaturize_button =
|
||||
[NSWindow standardWindowButton:NSWindowMiniaturizeButton
|
||||
forStyleMask:NSTitledWindowMask];
|
||||
NSButton* zoom_button = [NSWindow standardWindowButton:NSWindowZoomButton
|
||||
forStyleMask:NSTitledWindowMask];
|
||||
forStyleMask:NSWindowStyleMaskTitled];
|
||||
NSButton* zoom_button =
|
||||
[NSWindow standardWindowButton:NSWindowZoomButton
|
||||
forStyleMask:NSWindowStyleMaskTitled];
|
||||
|
||||
CGFloat x = 0;
|
||||
const CGFloat space_between = 20;
|
||||
|
@ -319,18 +321,18 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
|||
useStandardWindow = false;
|
||||
}
|
||||
|
||||
NSUInteger styleMask = NSTitledWindowMask;
|
||||
NSUInteger styleMask = NSWindowStyleMaskTitled;
|
||||
if (@available(macOS 10.10, *)) {
|
||||
if (title_bar_style_ == CUSTOM_BUTTONS_ON_HOVER &&
|
||||
(!useStandardWindow || transparent() || !has_frame())) {
|
||||
styleMask = NSFullSizeContentViewWindowMask;
|
||||
styleMask = NSWindowStyleMaskFullSizeContentView;
|
||||
}
|
||||
}
|
||||
if (minimizable) {
|
||||
styleMask |= NSMiniaturizableWindowMask;
|
||||
}
|
||||
if (closable) {
|
||||
styleMask |= NSClosableWindowMask;
|
||||
styleMask |= NSWindowStyleMaskClosable;
|
||||
}
|
||||
if (title_bar_style_ != NORMAL) {
|
||||
// The window without titlebar is treated the same with frameless window.
|
||||
|
@ -610,7 +612,7 @@ void NativeWindowMac::Unmaximize() {
|
|||
}
|
||||
|
||||
bool NativeWindowMac::IsMaximized() {
|
||||
if (([window_ styleMask] & NSResizableWindowMask) != 0) {
|
||||
if (([window_ styleMask] & NSWindowStyleMaskResizable) != 0) {
|
||||
return [window_ isZoomed];
|
||||
} else {
|
||||
NSRect rectScreen = [[NSScreen mainScreen] visibleFrame];
|
||||
|
@ -651,7 +653,7 @@ void NativeWindowMac::SetFullScreen(bool fullscreen) {
|
|||
}
|
||||
|
||||
bool NativeWindowMac::IsFullscreen() const {
|
||||
return [window_ styleMask] & NSFullScreenWindowMask;
|
||||
return [window_ styleMask] & NSWindowStyleMaskFullScreen;
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetBounds(const gfx::Rect& bounds, bool animate) {
|
||||
|
@ -688,7 +690,7 @@ bool NativeWindowMac::IsNormal() {
|
|||
|
||||
gfx::Rect NativeWindowMac::GetNormalBounds() {
|
||||
if (IsNormal()) {
|
||||
return GetBounds();
|
||||
return GetBounds();
|
||||
}
|
||||
NSRect frame = original_frame_;
|
||||
gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame));
|
||||
|
@ -730,11 +732,11 @@ void NativeWindowMac::MoveTop() {
|
|||
}
|
||||
|
||||
void NativeWindowMac::SetResizable(bool resizable) {
|
||||
SetStyleMask(resizable, NSResizableWindowMask);
|
||||
SetStyleMask(resizable, NSWindowStyleMaskResizable);
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsResizable() {
|
||||
return [window_ styleMask] & NSResizableWindowMask;
|
||||
return [window_ styleMask] & NSWindowStyleMaskResizable;
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetAspectRatio(double aspect_ratio,
|
||||
|
@ -800,11 +802,11 @@ bool NativeWindowMac::IsFullScreenable() {
|
|||
}
|
||||
|
||||
void NativeWindowMac::SetClosable(bool closable) {
|
||||
SetStyleMask(closable, NSClosableWindowMask);
|
||||
SetStyleMask(closable, NSWindowStyleMaskClosable);
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsClosable() {
|
||||
return [window_ styleMask] & NSClosableWindowMask;
|
||||
return [window_ styleMask] & NSWindowStyleMaskClosable;
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetAlwaysOnTop(bool top,
|
||||
|
@ -911,7 +913,7 @@ void NativeWindowMac::SetSimpleFullScreen(bool simple_fullscreen) {
|
|||
|
||||
if (!fullscreen_window_title()) {
|
||||
// Hide the titlebar
|
||||
SetStyleMask(false, NSTitledWindowMask);
|
||||
SetStyleMask(false, NSWindowStyleMaskTitled);
|
||||
|
||||
// Resize the window to accomodate the _entire_ screen size
|
||||
fullscreenFrame.size.height -=
|
||||
|
@ -936,7 +938,7 @@ void NativeWindowMac::SetSimpleFullScreen(bool simple_fullscreen) {
|
|||
|
||||
if (!fullscreen_window_title()) {
|
||||
// Restore the titlebar
|
||||
SetStyleMask(true, NSTitledWindowMask);
|
||||
SetStyleMask(true, NSWindowStyleMaskTitled);
|
||||
}
|
||||
|
||||
// Restore window controls visibility state
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
// Set window style to hide the toolbar, otherwise the toolbar will show
|
||||
// in fullscreen mode.
|
||||
[window setTitlebarAppearsTransparent:NO];
|
||||
shell_->SetStyleMask(true, NSFullSizeContentViewWindowMask);
|
||||
shell_->SetStyleMask(true, NSWindowStyleMaskFullSizeContentView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -230,8 +230,7 @@
|
|||
|
||||
// Turn off the style for toolbar.
|
||||
if (shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
||||
shell_->SetStyleMask(false, NSFullSizeContentViewWindowMask);
|
||||
[window setTitlebarAppearsTransparent:YES];
|
||||
shell_->SetStyleMask(false, NSWindowStyleMaskFullSizeContentView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,10 +136,10 @@
|
|||
inspectable_web_contents->GetDevToolsWebContents();
|
||||
auto devToolsView = devToolsWebContents->GetNativeView();
|
||||
|
||||
auto styleMask = NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask | NSResizableWindowMask |
|
||||
auto styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
|
||||
NSMiniaturizableWindowMask | NSWindowStyleMaskResizable |
|
||||
NSTexturedBackgroundWindowMask |
|
||||
NSUnifiedTitleAndToolbarWindowMask;
|
||||
NSWindowStyleMaskUnifiedTitleAndToolbar;
|
||||
devtools_window_.reset([[EventDispatchingWindow alloc]
|
||||
initWithContentRect:NSMakeRect(0, 0, 800, 600)
|
||||
styleMask:styleMask
|
||||
|
|
Загрузка…
Ссылка в новой задаче