Skip to content

Commit

Permalink
Handle screen resolution changes when in SimpleFullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
ignu committed Oct 16, 2018
1 parent 521f5f6 commit 2b86094
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/vs/code/electron-main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,14 @@ export class CodeWindow implements ICodeWindow {
this._lastFocusTime = Date.now();
});

// Simple fullscreen doesn't resize automatically when the resolution changes
screen.on('display-metrics-changed', () => {
if (isMacintosh && this.isFullScreen() && this.useNativeFullScreen()) {
this.setFullScreen(false);
this.setFullScreen(true);
}
});

// Window (Un)Maximize
this._win.on('maximize', (e) => {
if (this.currentConfig) {
Expand Down Expand Up @@ -423,6 +431,11 @@ export class CodeWindow implements ICodeWindow {
}
}

private useNativeFullScreen(): boolean {
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
return windowConfig && windowConfig.nativeFullscreen === false;
}

private onConfigurationUpdated(): void {
const newMenuBarVisibility = this.getMenuBarVisibility();
if (newMenuBarVisibility !== this.currentMenuBarVisibility) {
Expand Down Expand Up @@ -786,9 +799,7 @@ export class CodeWindow implements ICodeWindow {
}

private setFullScreen(willBeFullScreen?: boolean): void {
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');

if (windowConfig && windowConfig.nativeFullscreen === false) {
if (this.useNativeFullScreen()) {
this.setSimpleFullScreen(willBeFullScreen);
} else {
this.setNativeFullScreen(willBeFullScreen);
Expand Down

0 comments on commit 2b86094

Please sign in to comment.