BrowserWindow.focus() should not make window become visible, fixed #106.
This commit is contained in:
parent
88ce2a5390
commit
bbb9c37f70
2 changed files with 12 additions and 1 deletions
|
@ -209,7 +209,10 @@ void NativeWindowMac::Move(const gfx::Rect& pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::Focus(bool focus) {
|
void NativeWindowMac::Focus(bool focus) {
|
||||||
if (focus && [window() isVisible]) {
|
if (!IsVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (focus) {
|
||||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||||
[window() makeKeyAndOrderFront:nil];
|
[window() makeKeyAndOrderFront:nil];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -67,6 +67,14 @@ describe 'window module', ->
|
||||||
++count
|
++count
|
||||||
w.loadUrl 'about:blank'
|
w.loadUrl 'about:blank'
|
||||||
|
|
||||||
|
describe 'BrowserWindow.focus()', ->
|
||||||
|
it 'does not make the window become visible', ->
|
||||||
|
w = new BrowserWindow(show: false)
|
||||||
|
assert.equal w.isVisible(), false
|
||||||
|
w.focus()
|
||||||
|
assert.equal w.isVisible(), false
|
||||||
|
w.close()
|
||||||
|
|
||||||
describe 'beforeunload handler', ->
|
describe 'beforeunload handler', ->
|
||||||
it 'returning true would not prevent close', (done) ->
|
it 'returning true would not prevent close', (done) ->
|
||||||
w = new BrowserWindow(show: false)
|
w = new BrowserWindow(show: false)
|
||||||
|
|
Loading…
Reference in a new issue