@@ -48,7 +48,7 @@ import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/b
48
48
import { AuxiliaryBarPart } from 'vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart' ;
49
49
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
50
50
import { IAuxiliaryWindowService } from 'vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService' ;
51
- import { $window , mainWindow } from 'vs/base/browser/window' ;
51
+ import { mainWindow } from 'vs/base/browser/window' ;
52
52
53
53
//#region Layout Implementation
54
54
@@ -57,7 +57,7 @@ interface ILayoutRuntimeState {
57
57
fullscreen : boolean ;
58
58
maximized : Set < number > ;
59
59
hasFocus : boolean ;
60
- windowBorder : boolean ;
60
+ mainWindowBorder : boolean ;
61
61
readonly menuBar : {
62
62
toggled : boolean ;
63
63
} ;
@@ -368,10 +368,10 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
368
368
}
369
369
370
370
// Theme changes
371
- this . _register ( this . themeService . onDidColorThemeChange ( ( ) => this . updateWindowBorder ( $window . vscodeWindowId ) ) ) ;
371
+ this . _register ( this . themeService . onDidColorThemeChange ( ( ) => this . updateWindowsBorder ( ) ) ) ;
372
372
373
373
// Window active / focus changes
374
- this . _register ( this . hostService . onDidChangeFocus ( focused => this . onWindowFocusChanged ( $window . vscodeWindowId , focused ) ) ) ;
374
+ this . _register ( this . hostService . onDidChangeFocus ( focused => this . onWindowFocusChanged ( focused ) ) ) ;
375
375
this . _register ( this . hostService . onDidChangeActiveWindow ( ( ) => this . onActiveWindowChanged ( ) ) ) ;
376
376
377
377
// WCO changes
@@ -449,7 +449,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
449
449
// Propagate to grid
450
450
this . workbenchGrid . setViewVisible ( this . titleBarPartView , this . shouldShowTitleBar ( ) ) ;
451
451
452
- this . updateWindowBorder ( $window . vscodeWindowId , true ) ;
452
+ this . updateWindowsBorder ( true ) ;
453
453
}
454
454
455
455
this . _onDidChangeFullscreen . fire ( this . state . runtime . fullscreen ) ;
@@ -459,14 +459,18 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
459
459
const activeContainerId = this . getActiveContainerId ( ) ;
460
460
if ( this . state . runtime . activeContainerId !== activeContainerId ) {
461
461
this . state . runtime . activeContainerId = activeContainerId ;
462
+
463
+ // Indicate active window border
464
+ this . updateWindowsBorder ( ) ;
465
+
462
466
this . _onDidChangeActiveContainer . fire ( ) ;
463
467
}
464
468
}
465
469
466
- private onWindowFocusChanged ( targetWindowId : number , hasFocus : boolean ) : void {
470
+ private onWindowFocusChanged ( hasFocus : boolean ) : void {
467
471
if ( this . state . runtime . hasFocus !== hasFocus ) {
468
472
this . state . runtime . hasFocus = hasFocus ;
469
- this . updateWindowBorder ( targetWindowId ) ;
473
+ this . updateWindowsBorder ( ) ;
470
474
}
471
475
}
472
476
@@ -520,7 +524,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
520
524
this . adjustPartPositions ( position , panelAlignment , panelPosition ) ;
521
525
}
522
526
523
- private updateWindowBorder ( targetWindowId : number , skipLayout : boolean = false ) {
527
+ private updateWindowsBorder ( skipLayout = false ) {
524
528
if (
525
529
isWeb ||
526
530
isWindows || // not working well with zooming and window control overlays
@@ -534,22 +538,26 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
534
538
const activeBorder = theme . getColor ( WINDOW_ACTIVE_BORDER ) ;
535
539
const inactiveBorder = theme . getColor ( WINDOW_INACTIVE_BORDER ) ;
536
540
537
- let windowBorder = false ;
538
- if ( ! this . state . runtime . fullscreen && ! this . state . runtime . maximized . has ( targetWindowId ) && ( activeBorder || inactiveBorder ) ) {
539
- windowBorder = true ;
541
+ for ( const container of this . containers ) {
542
+ const isMainContainer = container === this . mainContainer ;
543
+ const isActiveContainer = this . activeContainer === container ;
544
+ const containerWindowId = getWindowId ( getWindow ( container ) ) ;
540
545
541
- // If the inactive color is missing, fallback to the active one
542
- const borderColor = this . state . runtime . hasFocus ? activeBorder : inactiveBorder ?? activeBorder ;
543
- this . mainContainer . style . setProperty ( '--window-border-color' , borderColor ?. toString ( ) ?? 'transparent' ) ;
544
- }
546
+ let windowBorder = false ;
547
+ if ( ! this . state . runtime . fullscreen && ! this . state . runtime . maximized . has ( containerWindowId ) && ( activeBorder || inactiveBorder ) ) {
548
+ windowBorder = true ;
545
549
546
- if ( windowBorder === this . state . runtime . windowBorder ) {
547
- return ;
548
- }
550
+ // If the inactive color is missing, fallback to the active one
551
+ const borderColor = isActiveContainer && this . state . runtime . hasFocus ? activeBorder : inactiveBorder ?? activeBorder ;
552
+ container . style . setProperty ( '--window-border-color' , borderColor ?. toString ( ) ?? 'transparent' ) ;
553
+ }
549
554
550
- this . state . runtime . windowBorder = windowBorder ;
555
+ if ( isMainContainer ) {
556
+ this . state . runtime . mainWindowBorder = windowBorder ;
557
+ }
551
558
552
- this . mainContainer . classList . toggle ( LayoutClasses . WINDOW_BORDER , windowBorder ) ;
559
+ container . classList . toggle ( LayoutClasses . WINDOW_BORDER , windowBorder ) ;
560
+ }
553
561
554
562
if ( ! skipLayout ) {
555
563
this . layout ( ) ;
@@ -614,7 +622,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
614
622
fullscreen : isFullscreen ( ) ,
615
623
hasFocus : this . hostService . hasFocus ,
616
624
maximized : new Set < number > ( ) ,
617
- windowBorder : false ,
625
+ mainWindowBorder : false ,
618
626
menuBar : {
619
627
toggled : false ,
620
628
} ,
@@ -676,7 +684,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
676
684
}
677
685
678
686
// Window border
679
- this . updateWindowBorder ( mainWindow . vscodeWindowId , true ) ;
687
+ this . updateWindowsBorder ( true ) ;
680
688
}
681
689
682
690
private getDefaultLayoutViews ( environmentService : IBrowserWorkbenchEnvironmentService , storageService : IStorageService ) : string [ ] | undefined {
@@ -1995,16 +2003,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
1995
2003
}
1996
2004
}
1997
2005
1998
- hasWindowBorder ( ) : boolean {
1999
- return this . state . runtime . windowBorder ;
2000
- }
2001
-
2002
- getWindowBorderWidth ( ) : number {
2003
- return this . state . runtime . windowBorder ? 2 : 0 ;
2006
+ hasMainWindowBorder ( ) : boolean {
2007
+ return this . state . runtime . mainWindowBorder ;
2004
2008
}
2005
2009
2006
- getWindowBorderRadius ( ) : string | undefined {
2007
- return this . state . runtime . windowBorder && isMacintosh ? '5px' : undefined ;
2010
+ getMainWindowBorderRadius ( ) : string | undefined {
2011
+ return this . state . runtime . mainWindowBorder && isMacintosh ? '5px' : undefined ;
2008
2012
}
2009
2013
2010
2014
isPanelMaximized ( ) : boolean {
@@ -2139,7 +2143,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2139
2143
this . state . runtime . maximized . delete ( targetWindowId ) ;
2140
2144
}
2141
2145
2142
- this . updateWindowBorder ( targetWindowId ) ;
2146
+ this . updateWindowsBorder ( ) ;
2143
2147
this . _onDidChangeWindowMaximized . fire ( { windowId : targetWindowId , maximized } ) ;
2144
2148
}
2145
2149
0 commit comments