Bug 1280546 - Disable automatic NSWindow tabbing on 10.12. r?spohl
MozReview-Commit-ID: AnDmvWDMgsg
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -63,16 +63,25 @@ int32_t gXULModalLevel = 0;
nsCocoaWindowList *gGeckoAppModalWindowList = NULL;
// defined in nsMenuBarX.mm
extern NSMenu* sApplicationMenu; // Application menu shared by all menubars
// defined in nsChildView.mm
extern BOOL gSomeMenuBarPainted;
+#if !defined(MAC_OS_X_VERSION_10_12) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
+
+@interface NSWindow(AutomaticWindowTabbing)
++ (void)setAllowsAutomaticWindowTabbing:(BOOL)allow;
+@end
+
+#endif
+
extern "C" {
// CGSPrivate.h
typedef NSInteger CGSConnection;
typedef NSInteger CGSWindow;
typedef NSUInteger CGSWindowFilterRef;
extern CGSConnection _CGSDefaultConnection(void);
extern CGError CGSSetWindowShadowAndRimParameters(const CGSConnection cid, CGSWindow wid, float standardDeviation, float density, int offsetX, int offsetY, unsigned int flags);
extern CGError CGSSetWindowBackgroundBlurRadius(CGSConnection cid, CGSWindow wid, NSUInteger blur);
@@ -116,17 +125,21 @@ nsCocoaWindow::nsCocoaWindow()
, mFakeModal(false)
, mSupportsNativeFullScreen(false)
, mInNativeFullScreenMode(false)
, mIsAnimationSuppressed(false)
, mInReportMoveEvent(false)
, mInResize(false)
, mNumModalDescendents(0)
{
-
+ if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)]) {
+ // Disable automatic tabbing on 10.12. We need to do this before we
+ // orderFront any of our windows.
+ [NSWindow setAllowsAutomaticWindowTabbing:NO];
+ }
}
void nsCocoaWindow::DestroyNativeWindow()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if (!mWindow)
return;