diff --git a/src/vs/workbench/electron-browser/index.html b/src/vs/workbench/electron-browser/index.html index 8090e6351803bf83b48b6315cd76f424c8ea69e4..5afc32ca42729375c38680b94bf4547e2673f895 100644 --- a/src/vs/workbench/electron-browser/index.html +++ b/src/vs/workbench/electron-browser/index.html @@ -123,12 +123,14 @@ }; } - // disable pinch zoom + // disable pinch zoom & apply zoom level early to avoid glitches + var windowConfiguration = globalSettings.settings && globalSettings.settings.window; webFrame.setZoomLevelLimits(1, 1); + if (windowConfiguration && typeof windowConfiguration.zoomLevel === 'number' && windowConfiguration.zoomLevel !== 0) { + webFrame.setZoomLevel(windowConfiguration.zoomLevel); + } - // apply zoom level very early to avoid glitches - webFrame.setZoomLevel(globalSettings.settings.window.zoomLevel); - + // Load the loader and start loading the workbench var rootUrl = uriFromPath(configuration.appRoot) + '/out'; createScript(rootUrl + '/vs/loader.js', function() { require.config({ diff --git a/src/vs/workbench/electron-browser/integration.ts b/src/vs/workbench/electron-browser/integration.ts index a6635c6c928d4968468550862bafc7f399b74ddf..28ccc08c9a363114041956fbbfdc1074be5c14a9 100644 --- a/src/vs/workbench/electron-browser/integration.ts +++ b/src/vs/workbench/electron-browser/integration.ts @@ -17,6 +17,7 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry'; import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService'; import {IWorkspaceContextService}from 'vs/workbench/services/workspace/common/contextService'; import {IWindowService}from 'vs/workbench/services/window/electron-browser/windowService'; +import {IWindowConfiguration} from 'vs/workbench/electron-browser/window'; import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration'; import win = require('vs/workbench/electron-browser/window'); @@ -103,8 +104,16 @@ export class ElectronIntegration { // Configuration changes this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => { - let zoomLevel = e.config && e.config.window && e.config.window.zoomLevel; - webFrame.setZoomLevel(zoomLevel); + let windowConfig: IWindowConfiguration = e.config; + + let newZoomLevel = 0; + if (windowConfig.window && typeof windowConfig.window.zoomLevel === 'number') { + newZoomLevel = windowConfig.window.zoomLevel; + } + + if (webFrame.getZoomLevel() !== newZoomLevel) { + webFrame.setZoomLevel(newZoomLevel); + } }); } diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index ac920e5ecb67d3f4aaf9c67d25706fb9ebf03325..075dbed945431f7a65aefb9efb3d28c7eaf10faf 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -60,8 +60,8 @@ configurationRegistry.registerConfiguration({ }, 'window.zoomLevel': { 'type': 'number', - 'default': '0', - 'description': nls.localize('zoomLevel', "Zoom level todo") + 'default': 0, + 'description': nls.localize('zoomLevel', "Adjust the zoom level of the window. The original size is 0 and each increment above or below represents zooming 20% larger or smaller.") } } }); diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts index 89755c55e6482bd64178e3913fca7ea4711e66c0..af785181ab65a7e5e21e788864a23355f00cc8e9 100644 --- a/src/vs/workbench/electron-browser/window.ts +++ b/src/vs/workbench/electron-browser/window.ts @@ -26,6 +26,14 @@ import ipc = require('ipc'); const Shell = remote.require('shell'); const Dialog = remote.require('dialog'); +export interface IWindowConfiguration { + window: { + openFilesInNewWindow: boolean; + reopenFolders: string; + zoomLevel: number; + } +} + export class ElectronWindow { private win: remote.BrowserWindow;