Skip to content

Commit a1561eb

Browse files
committed
Adds window border support to splash
1 parent b53811e commit a1561eb

6 files changed

Lines changed: 53 additions & 13 deletions

File tree

src/vs/code/electron-browser/workbench/workbench.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ bootstrapWindow.load([
3333
return require('vs/workbench/electron-browser/desktop.main').main(configuration);
3434
});
3535
}, {
36-
removeDeveloperKeybindingsAfterLoad: true,
37-
canModifyDOM: function (windowConfig) {
38-
showPartsSplash(windowConfig);
39-
},
40-
beforeLoaderConfig: function (windowConfig, loaderConfig) {
41-
loaderConfig.recordStats = true;
42-
},
43-
beforeRequire: function () {
44-
perf.mark('willLoadWorkbenchMain');
45-
}
46-
});
36+
removeDeveloperKeybindingsAfterLoad: true,
37+
canModifyDOM: function (windowConfig) {
38+
showPartsSplash(windowConfig);
39+
},
40+
beforeLoaderConfig: function (windowConfig, loaderConfig) {
41+
loaderConfig.recordStats = true;
42+
},
43+
beforeRequire: function () {
44+
perf.mark('willLoadWorkbenchMain');
45+
}
46+
});
4747

4848
/**
4949
* @param {{
@@ -84,14 +84,26 @@ function showPartsSplash(configuration) {
8484
style.className = 'initialShellColors';
8585
document.head.appendChild(style);
8686
document.body.className = baseTheme;
87-
style.innerHTML = `body { background-color: ${shellBackground}; color: ${shellForeground}; }`;
87+
style.innerHTML = `body { background-color: ${shellBackground}; color: ${shellForeground}; margin: 0; padding: 0; }`;
8888

8989
if (data && data.layoutInfo) {
9090
// restore parts if possible (we might not always store layout info)
9191
const { id, layoutInfo, colorInfo } = data;
9292
const splash = document.createElement('div');
9393
splash.id = id;
9494

95+
if (layoutInfo.windowBorder) {
96+
splash.style.position = 'relative';
97+
splash.style.height = 'calc(100vh - 2px)';
98+
splash.style.width = 'calc(100vw - 2px)';
99+
splash.style.border = '1px solid var(--window-border-color)';
100+
splash.style.setProperty('--window-border-color', colorInfo.windowBorder);
101+
102+
if (layoutInfo.windowBorderRadius) {
103+
splash.style.borderRadius = layoutInfo.windowBorderRadius;
104+
}
105+
}
106+
95107
// ensure there is enough space
96108
layoutInfo.sideBarWidth = Math.min(layoutInfo.sideBarWidth, window.innerWidth - (layoutInfo.activityBarWidth + layoutInfo.editorPartMinWidth));
97109

src/vs/workbench/browser/layout.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,14 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
11461146
}
11471147
}
11481148

1149+
hasWindowBorder(): boolean {
1150+
return this.state.windowBorder;
1151+
}
1152+
1153+
getWindowBorderRadius(): string | undefined {
1154+
return this.state.windowBorder && isMacintosh ? '5px' : undefined;
1155+
}
1156+
11491157
isPanelMaximized(): boolean {
11501158
if (!this.workbenchGrid) {
11511159
return false;

src/vs/workbench/browser/media/style.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ body.web {
5656
}
5757

5858
.monaco-workbench.border {
59-
position: relative;
6059
height: calc(100vh - 2px);
6160
width: calc(100vw - 2px);
6261
border: 1px solid var(--window-border-color);

src/vs/workbench/contrib/splash/electron-browser/partsSplash.contribution.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class PartsSplash {
8080
sideBarBackground: this._getThemeColor(themes.SIDE_BAR_BACKGROUND),
8181
statusBarBackground: this._getThemeColor(themes.STATUS_BAR_BACKGROUND),
8282
statusBarNoFolderBackground: this._getThemeColor(themes.STATUS_BAR_NO_FOLDER_BACKGROUND),
83+
windowBorder: this._getThemeColor(themes.WINDOW_ACTIVE_BORDER) ?? this._getThemeColor(themes.WINDOW_INACTIVE_BORDER)
8384
};
8485
const layoutInfo = !this._shouldSaveLayoutInfo() ? undefined : {
8586
sideBarSide: this._layoutService.getSideBarPosition() === Position.RIGHT ? 'right' : 'left',
@@ -88,6 +89,8 @@ class PartsSplash {
8889
activityBarWidth: this._layoutService.isVisible(Parts.ACTIVITYBAR_PART) ? getTotalWidth(assertIsDefined(this._layoutService.getContainer(Parts.ACTIVITYBAR_PART))) : 0,
8990
sideBarWidth: this._layoutService.isVisible(Parts.SIDEBAR_PART) ? getTotalWidth(assertIsDefined(this._layoutService.getContainer(Parts.SIDEBAR_PART))) : 0,
9091
statusBarHeight: this._layoutService.isVisible(Parts.STATUSBAR_PART) ? getTotalHeight(assertIsDefined(this._layoutService.getContainer(Parts.STATUSBAR_PART))) : 0,
92+
windowBorder: this._layoutService.hasWindowBorder(),
93+
windowBorderRadius: this._layoutService.getWindowBorderRadius()
9194
};
9295
this._textFileService.write(
9396
URI.file(join(this._envService.userDataPath, 'rapid_render.json')),

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ export interface IWorkbenchLayoutService extends ILayoutService {
114114
*/
115115
toggleMaximizedPanel(): void;
116116

117+
/**
118+
* Returns true if the window has a border.
119+
*/
120+
hasWindowBorder(): boolean;
121+
122+
/**
123+
* Returns the window border radius if any.
124+
*/
125+
getWindowBorderRadius(): string | undefined;
126+
117127
/**
118128
* Returns true if the panel is maximized.
119129
*/

src/vs/workbench/test/workbenchTestServices.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,14 @@ export class TestLayoutService implements IWorkbenchLayoutService {
481481
return false;
482482
}
483483

484+
public hasWindowBorder(): boolean {
485+
return false;
486+
}
487+
488+
public getWindowBorderRadius(): string | undefined {
489+
return undefined;
490+
}
491+
484492
public isVisible(_part: Parts): boolean {
485493
return true;
486494
}

0 commit comments

Comments
 (0)