@@ -232,9 +232,11 @@ export class WindowsStateHandler extends Disposable {
232
232
const windowConfig = this . configurationService . getValue < IWindowSettings | undefined > ( 'window' ) ;
233
233
234
234
// Window state is not from a previous session: only allow fullscreen if we inherit it or user wants fullscreen
235
+ // or to address a Electron issue on macOS (https://github.com/microsoft/vscode/issues/125122)
235
236
let allowFullscreen : boolean ;
236
237
if ( state . hasDefaultState ) {
237
- allowFullscreen = ! ! ( windowConfig ?. newWindowDimensions && [ 'fullscreen' , 'inherit' , 'offset' ] . indexOf ( windowConfig . newWindowDimensions ) >= 0 ) ;
238
+ const configAllowsFullScreen = ! ! ( windowConfig ?. newWindowDimensions && [ 'fullscreen' , 'inherit' , 'offset' ] . indexOf ( windowConfig . newWindowDimensions ) >= 0 ) ;
239
+ allowFullscreen = configAllowsFullScreen || ( isMacintosh && windowConfig ?. nativeFullScreen !== false ) ;
238
240
}
239
241
240
242
// Window state is from a previous session: only allow fullscreen when we got updated or user wants to restore
@@ -337,14 +339,22 @@ export class WindowsStateHandler extends Disposable {
337
339
// Compute x/y based on display bounds
338
340
// Note: important to use Math.round() because Electron does not seem to be too happy about
339
341
// display coordinates that are not absolute numbers.
340
- let state = defaultWindowState ( ) ;
342
+ let state : INewWindowState = defaultWindowState ( ) ;
341
343
state . x = Math . round ( displayToUse . bounds . x + ( displayToUse . bounds . width / 2 ) - ( state . width ! / 2 ) ) ;
342
344
state . y = Math . round ( displayToUse . bounds . y + ( displayToUse . bounds . height / 2 ) - ( state . height ! / 2 ) ) ;
343
345
344
- // Check for newWindowDimensions setting and adjust accordingly
345
346
const windowConfig = this . configurationService . getValue < IWindowSettings | undefined > ( 'window' ) ;
346
347
let ensureNoOverlap = true ;
347
- if ( windowConfig ?. newWindowDimensions ) {
348
+
349
+ // TODO@electron macOS: if the current window is fullscreen and native fullscreen
350
+ // is not disabled, always open a new window in fullscreen. This is a workaround
351
+ // for regression https://github.com/microsoft/vscode/issues/125122
352
+ if ( isMacintosh && windowConfig ?. nativeFullScreen !== false && lastActive ?. isFullScreen ) {
353
+ state . mode = WindowMode . Fullscreen ;
354
+ }
355
+
356
+ // Adjust according to `newWindowDimensions` user setting
357
+ else if ( windowConfig ?. newWindowDimensions ) {
348
358
if ( windowConfig . newWindowDimensions === 'maximized' ) {
349
359
state . mode = WindowMode . Maximized ;
350
360
ensureNoOverlap = false ;
@@ -367,7 +377,7 @@ export class WindowsStateHandler extends Disposable {
367
377
state = this . ensureNoOverlap ( state ) ;
368
378
}
369
379
370
- ( state as INewWindowState ) . hasDefaultState = true ; // flag as default state
380
+ state . hasDefaultState = true ; // flag as default state
371
381
372
382
return state ;
373
383
}
0 commit comments