Bug 1959023 Part 2: Prevent macOS menubar from flickering when quitting Firefox. r=spohl a=RyanVM
This also prevents the momentary appearance of a gray, disabled-looking menubar when quitting. Differential Revision: https://phabricator.services.mozilla.com/D255244
This commit is contained in:
committed by
rvandermeulen@mozilla.com
parent
a27e723b0b
commit
1142ca05c0
@@ -621,6 +621,12 @@ nsAppStartup::GetShuttingDown(bool* aResult) {
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsAppStartup::GetAttemptingQuit(bool* aResult) {
|
||||||
|
*aResult = mAttemptingQuit;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsAppStartup::GetStartingUp(bool* aResult) {
|
nsAppStartup::GetStartingUp(bool* aResult) {
|
||||||
*aResult = mStartingUp;
|
*aResult = mStartingUp;
|
||||||
|
|||||||
@@ -202,6 +202,13 @@ interface nsIAppStartup : nsISupports
|
|||||||
*/
|
*/
|
||||||
[infallible] readonly attribute boolean shuttingDown;
|
[infallible] readonly attribute boolean shuttingDown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if the application is attempting to quit (Quit has been called). This
|
||||||
|
* is an early signal that we are headed to shutdown. It becomes true just
|
||||||
|
* before we start closing windows.
|
||||||
|
*/
|
||||||
|
[infallible] readonly attribute boolean attemptingQuit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the application is in the process of starting up.
|
* True if the application is in the process of starting up.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -8,12 +8,14 @@
|
|||||||
|
|
||||||
#include "nsArrayUtils.h"
|
#include "nsArrayUtils.h"
|
||||||
#include "nsCursorManager.h"
|
#include "nsCursorManager.h"
|
||||||
|
#include "nsIAppStartup.h"
|
||||||
#include "nsIDOMWindowUtils.h"
|
#include "nsIDOMWindowUtils.h"
|
||||||
#include "nsILocalFileMac.h"
|
#include "nsILocalFileMac.h"
|
||||||
#include "GLContextCGL.h"
|
#include "GLContextCGL.h"
|
||||||
#include "MacThemeGeometryType.h"
|
#include "MacThemeGeometryType.h"
|
||||||
#include "NativeMenuSupport.h"
|
#include "NativeMenuSupport.h"
|
||||||
#include "WindowRenderer.h"
|
#include "WindowRenderer.h"
|
||||||
|
#include "mozilla/Components.h"
|
||||||
#include "mozilla/MiscEvents.h"
|
#include "mozilla/MiscEvents.h"
|
||||||
#include "mozilla/SwipeTracker.h"
|
#include "mozilla/SwipeTracker.h"
|
||||||
#include "mozilla/layers/APZInputBridge.h"
|
#include "mozilla/layers/APZInputBridge.h"
|
||||||
@@ -7109,9 +7111,17 @@ void nsCocoaWindow::CocoaWindowDidResize() {
|
|||||||
RefPtr<nsMenuBarX> hiddenWindowMenuBar =
|
RefPtr<nsMenuBarX> hiddenWindowMenuBar =
|
||||||
nsMenuUtilsX::GetHiddenWindowMenuBar();
|
nsMenuUtilsX::GetHiddenWindowMenuBar();
|
||||||
if (hiddenWindowMenuBar) {
|
if (hiddenWindowMenuBar) {
|
||||||
// We do an async paint in order to prevent crashes when macOS is actively
|
bool isTerminating = false;
|
||||||
// enumerating the menu items in `NSApp.mainMenu`.
|
nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service());
|
||||||
hiddenWindowMenuBar->PaintAsyncIfNeeded();
|
if (appStartup) {
|
||||||
|
appStartup->GetAttemptingQuit(&isTerminating);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isTerminating) {
|
||||||
|
// We do an async paint in order to prevent crashes when macOS is actively
|
||||||
|
// enumerating the menu items in `NSApp.mainMenu`.
|
||||||
|
hiddenWindowMenuBar->PaintAsyncIfNeeded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSWindow* window = [aNotification object];
|
NSWindow* window = [aNotification object];
|
||||||
|
|||||||
Reference in New Issue
Block a user