Bug 1531226 - Add support for alwaysontop windows for macOS. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D50275

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Conley 2019-10-23 18:25:10 +00:00
Родитель e63ea2e660
Коммит 6d2e7437f0
2 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -389,6 +389,7 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
bool mInReportMoveEvent; // true if in a call to ReportMoveEvent().
bool mInResize; // true if in a call to DoResize().
bool mWindowTransformIsIdentity;
bool mAlwaysOnTop;
int32_t mNumModalDescendents;
InputContext mInputContext;

Просмотреть файл

@ -154,6 +154,7 @@ nsCocoaWindow::nsCocoaWindow()
mInReportMoveEvent(false),
mInResize(false),
mWindowTransformIsIdentity(true),
mAlwaysOnTop(false),
mNumModalDescendents(0),
mWindowAnimationBehavior(NSWindowAnimationBehaviorDefault) {
if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)]) {
@ -302,6 +303,7 @@ nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
mParent = aParent;
mAncestorLink = aParent;
mAlwaysOnTop = aInitData->mAlwaysOnTop;
// Applications that use native popups don't want us to create popup windows.
if ((mWindowType == eWindowType_popup) && UseNativePopupWindows()) return NS_OK;
@ -482,6 +484,10 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, nsBorderStyle aB
[mWindow setOpaque:YES];
}
if (mAlwaysOnTop) {
[mWindow setLevel:NSFloatingWindowLevel];
}
[mWindow setContentMinSize:NSMakeSize(60, 60)];
[mWindow disableCursorRects];