forked from mirrors/gecko-dev
Bug 1912338 - Fix titlebar separator hiding workaround on macOS 11. a=diannaS
On macOS 11, MOZTitlebarAccessoryView's viewWillMoveToWindow: is called both when transitioning to full screen, and when transitioning out of full screen. In the case of transitioning into full screen, the window passed to viewWillMoveToWindow: has titlebarAppearsTransparent=false, meaning that the condition added to this function in bug 1906034 caused the title bar separator to always be enabled when in full screen on macOS 11. This patch fixes the logic to instead check if the passed NSWindow is our ToolbarWindow or something else. On later macOS releases, MOZTitlebarAccessoryView's viewWillMoveToWindow: is called when transitioning out of from full screen, but not when transitioning to full screen. This is why disabling the title bar separator in windowDidEnterFullScreen: is also necessary. Original Revision: https://phabricator.services.mozilla.com/D221909 Differential Revision: https://phabricator.services.mozilla.com/D222136
This commit is contained in:
parent
e909065765
commit
55131acd3b
2 changed files with 16 additions and 34 deletions
|
|
@ -177,7 +177,6 @@ enum class NativeKeyBindingsType : uint8_t;
|
|||
NSRect mWindowButtonsRect;
|
||||
}
|
||||
- (void)setDrawsContentsIntoWindowFrame:(BOOL)aState;
|
||||
- (void)setTitlebarAppearsTransparent:(BOOL)aState;
|
||||
- (void)placeWindowButtons:(NSRect)aRect;
|
||||
- (NSRect)windowButtonsRect;
|
||||
- (void)windowMainStateChanged;
|
||||
|
|
|
|||
|
|
@ -2839,12 +2839,14 @@ void nsCocoaWindow::CocoaWindowDidResize() {
|
|||
}
|
||||
|
||||
if (@available(macOS 11.0, *)) {
|
||||
// In order to work around a drawing bug with titlebarAppearsTransparent
|
||||
// windows in full screen mode, disable titlebar separators for full
|
||||
// screen windows. The drawing bug was filed as FB9056136. See bug 1700211
|
||||
// and bug 1912338 for more details.
|
||||
if ([window isKindOfClass:[ToolbarWindow class]]) {
|
||||
// In order to work around a drawing bug with windows in full screen
|
||||
// mode, disable titlebar separators for full screen windows of the
|
||||
// ToolbarWindow class. The drawing bug was filed as FB9056136. See bug
|
||||
// 1700211 and bug 1912338 for more details.
|
||||
window.titlebarSeparatorStyle = NSTitlebarSeparatorStyleNone;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mGeckoWindow) {
|
||||
return;
|
||||
|
|
@ -3527,15 +3529,16 @@ static const NSString* kStateWantsTitleDrawn = @"wantsTitleDrawn";
|
|||
if (aWindow) {
|
||||
// When entering full screen mode, titlebar accessory views are inserted
|
||||
// into a floating NSWindow which houses the window titlebar and toolbars.
|
||||
// In order to work around a drawing bug with titlebarAppearsTransparent
|
||||
// windows in full screen mode, disable titlebar separators for all
|
||||
// NSWindows that this view is used in, including the floating full screen
|
||||
// toolbar window. The drawing bug was filed as FB9056136. See bug 1700211
|
||||
// for more details.
|
||||
// In order to work around a drawing bug with windows in full screen mode,
|
||||
// disable titlebar separators for all NSWindows that this view is used in
|
||||
// that are not of the ToolbarWindow class, such as the floating full
|
||||
// screen toolbar window. The drawing bug was filed as FB9056136. See bug
|
||||
// 1700211 and bug 1912338 for more details.
|
||||
if (@available(macOS 11.0, *)) {
|
||||
aWindow.titlebarSeparatorStyle = aWindow.titlebarAppearsTransparent
|
||||
? NSTitlebarSeparatorStyleNone
|
||||
: NSTitlebarSeparatorStyleAutomatic;
|
||||
aWindow.titlebarSeparatorStyle =
|
||||
[aWindow isKindOfClass:[ToolbarWindow class]]
|
||||
? NSTitlebarSeparatorStyleAutomatic
|
||||
: NSTitlebarSeparatorStyleNone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3776,26 +3779,6 @@ static bool ShouldShiftByMenubarHeightInFullscreen(nsCocoaWindow* aWindow) {
|
|||
}
|
||||
}
|
||||
|
||||
// When entering full screen mode, titlebar accessory views are inserted
|
||||
// into a floating NSWindow which houses the window titlebar and toolbars.
|
||||
// In order to work around a drawing bug with titlebarAppearsTransparent
|
||||
// windows in full screen mode, disable titlebar separators for all
|
||||
// NSWindows that this view is used in, including the floating full screen
|
||||
// toolbar window. The drawing bug was filed as FB9056136. See bug 1700211
|
||||
// for more details.
|
||||
- (void)setTitlebarAppearsTransparent:(BOOL)aState {
|
||||
BOOL stateChanged = self.titlebarAppearsTransparent != aState;
|
||||
[super setTitlebarAppearsTransparent:aState];
|
||||
|
||||
if (stateChanged) {
|
||||
if (@available(macOS 11.0, *)) {
|
||||
self.titlebarSeparatorStyle = self.titlebarAppearsTransparent
|
||||
? NSTitlebarSeparatorStyleNone
|
||||
: NSTitlebarSeparatorStyleAutomatic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)placeWindowButtons:(NSRect)aRect {
|
||||
if (!NSEqualRects(mWindowButtonsRect, aRect)) {
|
||||
mWindowButtonsRect = aRect;
|
||||
|
|
|
|||
Loading…
Reference in a new issue