mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 1b314ab317fbff7d799b21754326b7d849889ceb
This commit is contained in:
@@ -187,3 +187,11 @@ export interface IWindowConfiguration {
|
||||
filesToOpenOrCreate?: IPath[];
|
||||
filesToDiff?: IPath[];
|
||||
}
|
||||
|
||||
/**
|
||||
* According to Electron docs: `scale := 1.2 ^ level`.
|
||||
* https://github.com/electron/electron/blob/master/docs/api/web-contents.md#contentssetzoomlevellevel
|
||||
*/
|
||||
export function zoomLevelToZoomFactor(zoomLevel = 0): number {
|
||||
return Math.pow(1.2, zoomLevel);
|
||||
}
|
||||
|
||||
@@ -1009,7 +1009,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
|
||||
restoreWindows = windowConfig?.restoreWindows || 'all'; // by default restore all windows
|
||||
|
||||
if (['all', 'folders', 'one', 'none'].indexOf(restoreWindows) === -1) {
|
||||
if (!['all', 'folders', 'one', 'none'].includes(restoreWindows)) {
|
||||
restoreWindows = 'all'; // by default restore all windows
|
||||
}
|
||||
}
|
||||
@@ -1117,6 +1117,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
|
||||
if (remoteAuthority) {
|
||||
const first = anyPath.charCodeAt(0);
|
||||
|
||||
// make absolute
|
||||
if (first !== CharCode.Slash) {
|
||||
if (isWindowsDriveLetter(first) && anyPath.charCodeAt(anyPath.charCodeAt(1)) === CharCode.Colon) {
|
||||
|
||||
29
src/vs/platform/windows/electron-sandbox/window.ts
Normal file
29
src/vs/platform/windows/electron-sandbox/window.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { webFrame } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { zoomLevelToZoomFactor } from 'vs/platform/windows/common/windows';
|
||||
import { setZoomFactor, setZoomLevel, getZoomLevel } from 'vs/base/browser/browser';
|
||||
|
||||
/**
|
||||
* Apply a zoom level to the window. Also sets it in our in-memory
|
||||
* browser helper so that it can be accessed in non-electron layers.
|
||||
*/
|
||||
export function applyZoom(zoomLevel: number): void {
|
||||
webFrame.setZoomLevel(zoomLevel);
|
||||
setZoomFactor(zoomLevelToZoomFactor(zoomLevel));
|
||||
// Cannot be trusted because the webFrame might take some time
|
||||
// until it really applies the new zoom level
|
||||
// See https://github.com/Microsoft/vscode/issues/26151
|
||||
setZoomLevel(zoomLevel, false /* isTrusted */);
|
||||
}
|
||||
|
||||
export function zoomIn(): void {
|
||||
applyZoom(getZoomLevel() + 1);
|
||||
}
|
||||
|
||||
export function zoomOut(): void {
|
||||
applyZoom(getZoomLevel() - 1);
|
||||
}
|
||||
Reference in New Issue
Block a user