@@ -7,7 +7,7 @@ import 'vs/css!./media/titlebarpart';
7
7
import { localize , localize2 } from 'vs/nls' ;
8
8
import { MultiWindowParts , Part } from 'vs/workbench/browser/part' ;
9
9
import { ITitleService } from 'vs/workbench/services/title/browser/titleService' ;
10
- import { getWCOBoundingRect , getZoomFactor , isWCOEnabled } from 'vs/base/browser/browser' ;
10
+ import { getWCOTitlebarAreaRect , getZoomFactor , isWCOEnabled } from 'vs/base/browser/browser' ;
11
11
import { MenuBarVisibility , getTitleBarStyle , getMenuBarVisibility , TitlebarStyle , hasCustomTitlebar , hasNativeTitlebar , DEFAULT_CUSTOM_TITLEBAR_HEIGHT } from 'vs/platform/window/common/window' ;
12
12
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView' ;
13
13
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent' ;
@@ -228,7 +228,7 @@ export class BrowserTitlebarPart extends Part implements ITitlebarPart {
228
228
const wcoEnabled = isWeb && isWCOEnabled ( ) ;
229
229
let value = this . isCommandCenterVisible || wcoEnabled ? DEFAULT_CUSTOM_TITLEBAR_HEIGHT : 30 ;
230
230
if ( wcoEnabled ) {
231
- value = Math . max ( value , getWCOBoundingRect ( ) ?. height ?? 0 ) ;
231
+ value = Math . max ( value , getWCOTitlebarAreaRect ( getWindow ( this . element ) ) ?. height ?? 0 ) ;
232
232
}
233
233
234
234
return value / ( this . preventZoom ? getZoomFactor ( getWindow ( this . element ) ) : 1 ) ;
@@ -499,6 +499,13 @@ export class BrowserTitlebarPart extends Part implements ITitlebarPart {
499
499
this . windowControlsContainer = append ( windowControlsLocation === 'left' ? this . leftContent : this . rightContent , $ ( 'div.window-controls-container' ) ) ;
500
500
if ( isWCOEnabled ( ) ) {
501
501
this . windowControlsContainer . classList . add ( 'wco-enabled' ) ;
502
+
503
+ const targetWindow = getWindow ( this . element ) ;
504
+ const wcoTitlebarAreaRect = getWCOTitlebarAreaRect ( targetWindow ) ;
505
+ if ( wcoTitlebarAreaRect ) {
506
+ const wcoWidth = targetWindow . innerWidth - wcoTitlebarAreaRect . width - wcoTitlebarAreaRect . x ;
507
+ this . windowControlsContainer . style . setProperty ( '--title-wco-width' , `${ wcoWidth } px` ) ;
508
+ }
502
509
}
503
510
}
504
511
}
0 commit comments