Bug 1554761 - Notify with a 'mac_app_activate' topic when the App has been activated, capturing Command-Tabbing behavior. OSX only. r=spohl

Differential Revision: https://phabricator.services.mozilla.com/D39936
This commit is contained in:
Mike de Boer
2019-11-05 12:37:02 +00:00
parent 135508b77e
commit 10f0dacdb9
2 changed files with 14 additions and 0 deletions

View File

@@ -46,6 +46,9 @@
#include "nsIDOMWakeLockListener.h"
#include "nsIPowerManagerService.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
using namespace mozilla;
using namespace mozilla::widget;
@@ -881,6 +884,11 @@ nsAppShell::AfterProcessNextEvent(nsIThreadInternal* aThread, bool aEventWasProc
[currentEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask;
}
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
if (observerService) {
observerService->NotifyObservers(nullptr, NS_WIDGET_MAC_APP_ACTIVATE_OBSERVER_TOPIC, nullptr);
}
NS_OBJC_END_TRY_ABORT_BLOCK;
}

View File

@@ -261,6 +261,12 @@ enum nsTopLevelWidgetZPlacement { // for PlaceBehind()
*/
#define NS_WIDGET_RESUME_PROCESS_OBSERVER_TOPIC "resume_process_notification"
/**
* When an app(-shell) is activated by the OS, this topic is notified.
* Currently, this only happens on Mac OSX.
*/
#define NS_WIDGET_MAC_APP_ACTIVATE_OBSERVER_TOPIC "mac_app_activate"
namespace mozilla {
namespace widget {