🍎 Fix an issue where alwaysOnTop window disappears when restored from the application icon
This commit is contained in:
parent
dfab1043d9
commit
f001377493
2 changed files with 26 additions and 0 deletions
|
@ -75,6 +75,7 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
@private
|
@private
|
||||||
atom::NativeWindowMac* shell_;
|
atom::NativeWindowMac* shell_;
|
||||||
bool is_zooming_;
|
bool is_zooming_;
|
||||||
|
int level_;
|
||||||
}
|
}
|
||||||
- (id)initWithShell:(atom::NativeWindowMac*)shell;
|
- (id)initWithShell:(atom::NativeWindowMac*)shell;
|
||||||
@end
|
@end
|
||||||
|
@ -204,11 +205,20 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
shell_->NotifyWindowMoved();
|
shell_->NotifyWindowMoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)windowWillMiniaturize:(NSNotification*)notification {
|
||||||
|
NSWindow* window = shell_->GetNativeWindow();
|
||||||
|
// store the current level to be restored in windowDidDeminiaturize
|
||||||
|
level_ = NSStatusWindowLevel;
|
||||||
|
[window setLevel:NSNormalWindowLevel];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)windowDidMiniaturize:(NSNotification*)notification {
|
- (void)windowDidMiniaturize:(NSNotification*)notification {
|
||||||
shell_->NotifyWindowMinimize();
|
shell_->NotifyWindowMinimize();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidDeminiaturize:(NSNotification*)notification {
|
- (void)windowDidDeminiaturize:(NSNotification*)notification {
|
||||||
|
NSWindow* window = shell_->GetNativeWindow();
|
||||||
|
[window setLevel:level_];
|
||||||
shell_->NotifyWindowRestore();
|
shell_->NotifyWindowRestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -620,6 +620,22 @@ describe('BrowserWindow module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe.only('BrowserWindow.alwaysOnTop() resets level on minimize', function () {
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
it('resets the windows level on minimize', function () {
|
||||||
|
assert.equal(w.isAlwaysOnTop(), false)
|
||||||
|
w.setAlwaysOnTop(true, 'screen-saver')
|
||||||
|
assert.equal(w.isAlwaysOnTop(), true)
|
||||||
|
w.minimize()
|
||||||
|
assert.equal(w.isAlwaysOnTop(), false)
|
||||||
|
w.restore()
|
||||||
|
assert.equal(w.isAlwaysOnTop(), true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('BrowserWindow.setAutoHideCursor(autoHide)', () => {
|
describe('BrowserWindow.setAutoHideCursor(autoHide)', () => {
|
||||||
if (process.platform !== 'darwin') {
|
if (process.platform !== 'darwin') {
|
||||||
it('is not available on non-macOS platforms', () => {
|
it('is not available on non-macOS platforms', () => {
|
||||||
|
|
Loading…
Reference in a new issue