File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,10 @@ void Window::Call(const std::string& method,
203
203
shell_->window ()->Minimize ();
204
204
} else if (method == " Restore" ) {
205
205
shell_->window ()->Restore ();
206
+ } else if (method == " Focus" ) {
207
+ shell_->window ()->Focus (true );
208
+ } else if (method == " Blur" ) {
209
+ shell_->window ()->Focus (false );
206
210
} else if (method == " EnterFullscreen" ) {
207
211
shell_->window ()->SetFullscreen (true );
208
212
} else if (method == " LeaveFullscreen" ) {
Original file line number Diff line number Diff line change @@ -266,15 +266,21 @@ Window.prototype.resizeBy = function(width, height) {
266
266
}
267
267
268
268
Window . prototype . focus = function ( flag ) {
269
- if ( typeof flag == 'undefined' || Boolean ( flag ) )
270
- this . window . focus ( ) ;
271
- else
269
+ if ( typeof flag == 'undefined' || Boolean ( flag ) ) {
270
+ if ( this . __nw_is_devtools )
271
+ CallObjectMethod ( this , 'Focus' , [ ] ) ;
272
+ else
273
+ this . window . focus ( ) ;
274
+ } else
272
275
this . blur ( ) ;
273
- }
276
+ } ;
274
277
275
278
Window . prototype . blur = function ( ) {
276
- this . window . blur ( ) ;
277
- }
279
+ if ( this . __nw_is_devtools )
280
+ CallObjectMethod ( this , 'Blur' , [ ] ) ;
281
+ else
282
+ this . window . blur ( ) ;
283
+ } ;
278
284
279
285
Window . prototype . show = function ( flag ) {
280
286
if ( typeof flag == 'undefined' || Boolean ( flag ) )
@@ -351,8 +357,10 @@ Window.prototype.showDevTools = function(frm, headless) {
351
357
var ret ;
352
358
if ( typeof win_id == 'number' && win_id > 0 ) {
353
359
ret = global . __nwWindowsStore [ win_id ] ;
354
- if ( ! ret )
360
+ if ( ! ret ) {
355
361
ret = new global . Window ( this . window . nwDispatcher . getRoutingIDForCurrentContext ( ) , true , win_id ) ;
362
+ ret . __nw_is_devtools = true ;
363
+ }
356
364
return ret ;
357
365
}
358
366
}
You can’t perform that action at this time.
0 commit comments