Bug 1373581 - OSX: send fullscreen event on WillEnter/WillExit. r=mstange
MozReview-Commit-ID: 5HViEaCw15l
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -2618,24 +2618,29 @@ nsCocoaWindow::GetEditCommands(NativeKey
}
mGeckoWindow->ReportMoveEvent();
}
// Lion's full screen mode will bypass our internal fullscreen tracking, so
// we need to catch it when we transition and call our own methods, which in
// turn will fire "fullscreen" events.
-- (void)windowDidEnterFullScreen:(NSNotification *)notification
+// We send the event slightly early (on WillEnter instead of DidEnter),
+// to render resulting UI changes during the fullscreen transition.
+- (void)windowWillEnterFullScreen:(NSNotification *)notification
{
if (!mGeckoWindow) {
return;
}
mGeckoWindow->EnteredFullScreen(true);
-
+}
+
+- (void)windowDidEnterFullScreen:(NSNotification *)notification
+{
// On Yosemite, the NSThemeFrame class has two new properties --
// titlebarView (an NSTitlebarView object) and titlebarContainerView (an
// NSTitlebarContainerView object). These are used to display the titlebar
// in fullscreen mode. In Safari they're not transparent. But in Firefox
// for some reason they are, which causes bug 1069658. The following code
// works around this Apple bug or design flaw.
NSWindow *window = (NSWindow *) [notification object];
NSView *frameView = [[window contentView] superview];
@@ -2650,17 +2655,19 @@ nsCocoaWindow::GetEditCommands(NativeKey
if ([titlebarView respondsToSelector:@selector(setTransparent:)]) {
[titlebarView setTransparent:NO];
}
if ([titlebarContainerView respondsToSelector:@selector(setTransparent:)]) {
[titlebarContainerView setTransparent:NO];
}
}
-- (void)windowDidExitFullScreen:(NSNotification *)notification
+// We send the "fullscreen" event slightly early (on WillExit instead of DidExit),
+// to render resulting UI changes during the fullscreen transition.
+- (void)windowWillExitFullScreen:(NSNotification *)notification
{
if (!mGeckoWindow) {
return;
}
mGeckoWindow->EnteredFullScreen(false);
}