Skip to content

Commit 5c3fdb8

Browse files
committed
Move window border widget into layout service
Part of microsoft#104508
1 parent fb80351 commit 5c3fdb8

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/vs/workbench/browser/layout.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,10 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
16161616
return this.state.windowBorder;
16171617
}
16181618

1619+
getWindowBorderWidth(): number {
1620+
return this.state.windowBorder ? 2 : 0;
1621+
}
1622+
16191623
getWindowBorderRadius(): string | undefined {
16201624
return this.state.windowBorder && isMacintosh ? '5px' : undefined;
16211625
}

src/vs/workbench/services/hover/browser/hoverWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class HoverWidget extends Widget {
143143
// Get horizontal alignment and position
144144
let targetLeft = this._target.x !== undefined ? this._target.x : Math.min(...targetBounds.map(e => e.left));
145145
if (targetLeft + this._hover.containerDomNode.clientWidth >= document.documentElement.clientWidth) {
146-
this._x = document.documentElement.clientWidth - (this._workbenchLayoutService.hasWindowBorder() ? 3 : 1);
146+
this._x = document.documentElement.clientWidth - this._workbenchLayoutService.getWindowBorderWidth() - 1;
147147
this._hover.containerDomNode.classList.add('right-aligned');
148148
} else {
149149
this._x = targetLeft;

src/vs/workbench/services/layout/browser/layoutService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ export interface IWorkbenchLayoutService extends ILayoutService {
144144
*/
145145
hasWindowBorder(): boolean;
146146

147+
/**
148+
* Returns the window border width.
149+
*/
150+
getWindowBorderWidth(): number;
151+
147152
/**
148153
* Returns the window border radius if any.
149154
*/

src/vs/workbench/test/browser/workbenchTestServices.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ export class TestLayoutService implements IWorkbenchLayoutService {
429429
hasFocus(_part: Parts): boolean { return false; }
430430
focusPart(_part: Parts): void { }
431431
hasWindowBorder(): boolean { return false; }
432+
getWindowBorderWidth(): number { return 0; }
432433
getWindowBorderRadius(): string | undefined { return undefined; }
433434
isVisible(_part: Parts): boolean { return true; }
434435
getDimension(_part: Parts): Dimension { return new Dimension(0, 0); }

0 commit comments

Comments
 (0)