mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Update to electron 1.4.x (#15298)
* electron 1.4.6 * fix broken DND image feedback * OSS input * remove cat.exe as it is no longer needed * update electron.d.ts * set new ELECTRON_NO_ASAR environment for forked processes * Automatically enable high contrast theme when enabled in Windows (fixes #15360)
This commit is contained in:
parent
2c9bafc134
commit
97bef4bdc6
|
@ -68,7 +68,7 @@
|
|||
},
|
||||
{
|
||||
"name": "chromium",
|
||||
"version": "52.0.2743.82",
|
||||
"version": "53.0.2785.143",
|
||||
"repositoryURL": "http://www.chromium.org/Home",
|
||||
"licenseDetail": [
|
||||
"BSD License",
|
||||
|
@ -104,7 +104,7 @@
|
|||
},
|
||||
{
|
||||
"name": "libchromiumcontent",
|
||||
"version": "52.0.2743.82",
|
||||
"version": "53.0.2785.143",
|
||||
"license": "MIT",
|
||||
"repositoryURL": "https://github.com/electron/libchromiumcontent",
|
||||
"isProd": true
|
||||
|
@ -117,7 +117,7 @@
|
|||
},
|
||||
{
|
||||
"name": "electron",
|
||||
"version": "1.3.8",
|
||||
"version": "1.4.6",
|
||||
"license": "MIT",
|
||||
"repositoryURL": "https://github.com/electron/electron",
|
||||
"isProd": true
|
||||
|
|
|
@ -289,7 +289,6 @@ function packageTask(platform, arch, opts) {
|
|||
|
||||
if (platform === 'win32') {
|
||||
result = es.merge(result, gulp.src('resources/win32/bin/code.js', { base: 'resources/win32' }));
|
||||
result = es.merge(result, gulp.src('resources/win32/bin/cat.exe', { base: 'resources/win32' }));
|
||||
|
||||
result = es.merge(result, gulp.src('resources/win32/bin/code.cmd', { base: 'resources/win32' })
|
||||
.pipe(replace('@@NAME@@', product.nameShort))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.8.0",
|
||||
"electronVersion": "1.3.8",
|
||||
"electronVersion": "1.4.6",
|
||||
"distro": "cc6a2710b81e898b8cde2b51ba29e178980009e8",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
|
|
Binary file not shown.
|
@ -2,5 +2,5 @@
|
|||
setlocal
|
||||
set VSCODE_DEV=
|
||||
set ELECTRON_RUN_AS_NODE=1
|
||||
call "%~dp0..\@@NAME@@.exe" "%~dp0..\resources\app\out\cli.js" %* | "%~dp0\cat.exe"
|
||||
call "%~dp0..\@@NAME@@.exe" "%~dp0..\resources\app\out\cli.js" %*
|
||||
endlocal
|
|
@ -11,5 +11,5 @@ if [ "$(expr substr $(uname -s) 1 9)" == "CYGWIN_NT" ]; then
|
|||
else
|
||||
CLI="$VSCODE_PATH/resources/app/out/cli.js"
|
||||
fi
|
||||
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@" | cat
|
||||
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
|
||||
exit $?
|
||||
|
|
|
@ -17,7 +17,7 @@ if not "%BUILD_BUILDID%" == "" (
|
|||
|
||||
rem Otherwise
|
||||
if "%BUILD_BUILDID%" == "" (
|
||||
%CODE% .\node_modules\mocha\bin\_mocha --reporter dot %* | .\resources\win32\bin\cat
|
||||
%CODE% .\node_modules\mocha\bin\_mocha --reporter dot %*
|
||||
)
|
||||
popd
|
||||
|
||||
|
|
284
src/typings/electron.d.ts
vendored
284
src/typings/electron.d.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
// Type definitions for Electron v1.3.5
|
||||
// Type definitions for Electron v1.4.4
|
||||
// Project: http://electron.atom.io/
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
@ -46,6 +46,17 @@ declare namespace Electron {
|
|||
height: number;
|
||||
}
|
||||
|
||||
interface Destroyable {
|
||||
/**
|
||||
* Destroys the object.
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* @returns Whether the object is destroyed.
|
||||
*/
|
||||
isDestroyed(): boolean;
|
||||
}
|
||||
|
||||
// https://github.com/electron/electron/blob/master/docs/api/app.md
|
||||
|
||||
/**
|
||||
|
@ -66,7 +77,7 @@ declare namespace Electron {
|
|||
/**
|
||||
* Emitted when Electron has finished initialization.
|
||||
*/
|
||||
on(event: 'ready', listener: Function): this;
|
||||
on(event: 'ready', listener: (event: Event, launchInfo: Object) => void): this;
|
||||
/**
|
||||
* Emitted when all windows have been closed.
|
||||
*
|
||||
|
@ -180,7 +191,7 @@ declare namespace Electron {
|
|||
/**
|
||||
* Emitted when the gpu process crashes.
|
||||
*/
|
||||
on(event: 'gpu-process-crashed', listener: Function): this;
|
||||
on(event: 'gpu-process-crashed', listener: (event: Event, killed: boolean) => void): this;
|
||||
/**
|
||||
* Emitted when Chrome's accessibility support changes.
|
||||
*
|
||||
|
@ -222,6 +233,10 @@ declare namespace Electron {
|
|||
args?: string[],
|
||||
execPath?: string
|
||||
}): void;
|
||||
/**
|
||||
* @returns Whether Electron has finished initializing.
|
||||
*/
|
||||
isReady(): boolean;
|
||||
/**
|
||||
* On Linux, focuses on the first visible window.
|
||||
* On macOS, makes the application the active app.
|
||||
|
@ -425,6 +440,13 @@ declare namespace Electron {
|
|||
* Note: This API is only available on macOS and Windows.
|
||||
*/
|
||||
setLoginItemSettings(settings: LoginItemSettings): void;
|
||||
/**
|
||||
* Set the about panel options. This will override the values defined in the app's .plist file.
|
||||
* See the Apple docs for more details.
|
||||
*
|
||||
* Note: This API is only available on macOS.
|
||||
*/
|
||||
setAboutPanelOptions(options: AboutPanelOptions): void;
|
||||
commandLine: CommandLine;
|
||||
/**
|
||||
* Note: This API is only available on macOS.
|
||||
|
@ -432,7 +454,7 @@ declare namespace Electron {
|
|||
dock: Dock;
|
||||
}
|
||||
|
||||
type AppPathName = 'home' | 'appData' | 'userData' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'pepperFlashSystemPlugin';
|
||||
type AppPathName = 'home'|'appData'|'userData'|'temp'|'exe'|'module'|'desktop'|'documents'|'downloads'|'music'|'pictures'|'videos'|'pepperFlashSystemPlugin';
|
||||
|
||||
interface ImportCertificateOptions {
|
||||
/**
|
||||
|
@ -686,12 +708,35 @@ declare namespace Electron {
|
|||
restoreState?: boolean;
|
||||
}
|
||||
|
||||
interface AboutPanelOptions {
|
||||
/**
|
||||
* The app's name.
|
||||
*/
|
||||
applicationName?: string;
|
||||
/**
|
||||
* The app's version.
|
||||
*/
|
||||
applicationVersion?: string;
|
||||
/**
|
||||
* Copyright information.
|
||||
*/
|
||||
copyright?: string;
|
||||
/**
|
||||
* Credit information.
|
||||
*/
|
||||
credits?: string;
|
||||
/**
|
||||
* The app's build version number.
|
||||
*/
|
||||
version?: string;
|
||||
}
|
||||
|
||||
// https://github.com/electron/electron/blob/master/docs/api/auto-updater.md
|
||||
|
||||
/**
|
||||
* This module provides an interface for the Squirrel auto-updater framework.
|
||||
*/
|
||||
interface AutoUpdater extends NodeJS.EventEmitter {
|
||||
interface AutoUpdater extends EventEmitter {
|
||||
/**
|
||||
* Emitted when there is an error while updating.
|
||||
*/
|
||||
|
@ -740,7 +785,7 @@ declare namespace Electron {
|
|||
* The BrowserWindow class gives you ability to create a browser window.
|
||||
* You can also create a window without chrome by using Frameless Window API.
|
||||
*/
|
||||
class BrowserWindow extends EventEmitter {
|
||||
class BrowserWindow extends EventEmitter implements Destroyable {
|
||||
/**
|
||||
* Emitted when the document changed its title,
|
||||
* calling event.preventDefault() would prevent the native window’s title to change.
|
||||
|
@ -841,6 +886,11 @@ declare namespace Electron {
|
|||
* Note: This is only implemented on macOS.
|
||||
*/
|
||||
on(event: 'scroll-touch-end', listener: Function): this;
|
||||
/**
|
||||
* Emitted when scroll wheel event phase filed upon reaching the edge of element.
|
||||
* Note: This is only implemented on macOS.
|
||||
*/
|
||||
on(event: 'scroll-touch-edge', listener: Function): this;
|
||||
/**
|
||||
* Emitted on 3-finger swipe.
|
||||
* Note: This is only implemented on macOS.
|
||||
|
@ -1099,7 +1149,7 @@ declare namespace Electron {
|
|||
* setting this, the window is still a normal window, not a toolbox window
|
||||
* which can not be focused on.
|
||||
*/
|
||||
setAlwaysOnTop(flag: boolean): void;
|
||||
setAlwaysOnTop(flag: boolean, level?: WindowLevel): void;
|
||||
/**
|
||||
* @returns Whether the window is always on top of other windows.
|
||||
*/
|
||||
|
@ -1352,8 +1402,8 @@ declare namespace Electron {
|
|||
getChildWindows(): BrowserWindow[];
|
||||
}
|
||||
|
||||
type WindowLevel = 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver' | 'dock';
|
||||
type SwipeDirection = 'up' | 'right' | 'down' | 'left';
|
||||
|
||||
type ThumbarButtonFlags = 'enabled' | 'disabled' | 'dismissonclick' | 'nobackground' | 'hidden' | 'noninteractive';
|
||||
|
||||
interface ThumbarButton {
|
||||
|
@ -1371,6 +1421,12 @@ declare namespace Electron {
|
|||
}
|
||||
|
||||
interface WebPreferences {
|
||||
/**
|
||||
* Whether to enable DevTools.
|
||||
* If it is set to false, can not use BrowserWindow.webContents.openDevTools() to open DevTools.
|
||||
* Default: true.
|
||||
*/
|
||||
devTools?: boolean;
|
||||
/**
|
||||
* Whether node integration is enabled.
|
||||
* Default: true.
|
||||
|
@ -1527,6 +1583,11 @@ declare namespace Electron {
|
|||
* Default: false.
|
||||
*/
|
||||
offscreen?: boolean;
|
||||
/**
|
||||
* Whether to enable Chromium OS-level sandbox.
|
||||
* Default: false.
|
||||
*/
|
||||
sandbox?: boolean;
|
||||
}
|
||||
|
||||
interface BrowserWindowOptions {
|
||||
|
@ -1653,7 +1714,7 @@ declare namespace Electron {
|
|||
/**
|
||||
* The window icon, when omitted on Windows the executable’s icon would be used as window icon.
|
||||
*/
|
||||
icon?: NativeImage | string;
|
||||
icon?: NativeImage|string;
|
||||
/**
|
||||
* Whether window should be shown when created.
|
||||
* Default: true.
|
||||
|
@ -1961,7 +2022,7 @@ declare namespace Electron {
|
|||
|
||||
interface CrashReporterStartOptions {
|
||||
/**
|
||||
* Default: Electron
|
||||
* Default: app.getName()
|
||||
*/
|
||||
productName?: string;
|
||||
companyName: string;
|
||||
|
@ -1982,7 +2043,7 @@ declare namespace Electron {
|
|||
* An object you can define that will be sent along with the report.
|
||||
* Only string properties are sent correctly, nested objects are not supported.
|
||||
*/
|
||||
extra?: { [prop: string]: string };
|
||||
extra?: {[prop: string]: string};
|
||||
}
|
||||
|
||||
interface CrashReport {
|
||||
|
@ -2478,7 +2539,7 @@ declare namespace Electron {
|
|||
* In Electron for the APIs that take images, you can pass either file paths
|
||||
* or NativeImage instances. When passing null, an empty image will be used.
|
||||
*/
|
||||
icon?: NativeImage | string;
|
||||
icon?: NativeImage|string;
|
||||
/**
|
||||
* If false, the menu item will be greyed out and unclickable.
|
||||
*/
|
||||
|
@ -2495,7 +2556,7 @@ declare namespace Electron {
|
|||
* Should be specified for submenu type menu item, when it's specified the
|
||||
* type: 'submenu' can be omitted for the menu item
|
||||
*/
|
||||
submenu?: Menu | MenuItemOptions[];
|
||||
submenu?: Menu|MenuItemOptions[];
|
||||
/**
|
||||
* Unique within a single menu. If defined then it can be used as a reference
|
||||
* to this item by the position attribute.
|
||||
|
@ -2583,6 +2644,7 @@ declare namespace Electron {
|
|||
static createEmpty(): NativeImage;
|
||||
/**
|
||||
* Creates a new NativeImage instance from file located at path.
|
||||
* This method returns an empty image if the path does not exist, cannot be read, or is not a valid image.
|
||||
*/
|
||||
static createFromPath(path: string): NativeImage;
|
||||
/**
|
||||
|
@ -2615,7 +2677,7 @@ declare namespace Electron {
|
|||
*/
|
||||
getBitmap(): Buffer;
|
||||
/**
|
||||
* @returns string The data URL of the image.
|
||||
* @returns The data URL of the image.
|
||||
*/
|
||||
toDataURL(): string;
|
||||
/**
|
||||
|
@ -2625,11 +2687,11 @@ declare namespace Electron {
|
|||
*/
|
||||
getNativeHandle(): Buffer;
|
||||
/**
|
||||
* @returns boolean Whether the image is empty.
|
||||
* @returns Whether the image is empty.
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
/**
|
||||
* @returns {} The size of the image.
|
||||
* @returns The size of the image.
|
||||
*/
|
||||
getSize(): Size;
|
||||
/**
|
||||
|
@ -2640,6 +2702,28 @@ declare namespace Electron {
|
|||
* Returns a boolean whether the image is a template image.
|
||||
*/
|
||||
isTemplateImage(): boolean;
|
||||
/**
|
||||
* @param rect The area of the image to crop
|
||||
* @returns The cropped image.
|
||||
*/
|
||||
crop(rect: Rectangle): NativeImage;
|
||||
/**
|
||||
* @returns The resized image.
|
||||
* If only the height or the width are specified then the current aspect ratio will be preserved in the resized image.
|
||||
*/
|
||||
resize(options: {
|
||||
width?: number;
|
||||
height?: number;
|
||||
/**
|
||||
* The desired quality of the resized image.
|
||||
* Default: best.
|
||||
*/
|
||||
quality?: 'good' | 'better' | 'best';
|
||||
}): NativeImage;
|
||||
/**
|
||||
* @returns The image's aspect ratio.
|
||||
*/
|
||||
getAspectRatio(): number;
|
||||
}
|
||||
|
||||
// https://github.com/electron/electron/blob/master/docs/api/power-monitor.md
|
||||
|
@ -2677,7 +2761,7 @@ declare namespace Electron {
|
|||
interface PowerSaveBlocker {
|
||||
/**
|
||||
* Starts preventing the system from entering lower-power mode.
|
||||
* @returns an integer identifying the power save blocker.
|
||||
* @returns The blocker ID that is assigned to this power blocker.
|
||||
* Note: prevent-display-sleep has higher has precedence over prevent-app-suspension.
|
||||
*/
|
||||
start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
|
||||
|
@ -2688,7 +2772,7 @@ declare namespace Electron {
|
|||
stop(id: number): void;
|
||||
/**
|
||||
* @param id The power save blocker id returned by powerSaveBlocker.start.
|
||||
* @returns a boolean whether the corresponding powerSaveBlocker has started.
|
||||
* @returns Whether the corresponding powerSaveBlocker has started.
|
||||
*/
|
||||
isStarted(id: number): boolean;
|
||||
}
|
||||
|
@ -2763,8 +2847,18 @@ declare namespace Electron {
|
|||
referrer: string;
|
||||
method: string;
|
||||
uploadData?: {
|
||||
/**
|
||||
* Content being sent.
|
||||
*/
|
||||
bytes: Buffer,
|
||||
file: string
|
||||
/**
|
||||
* Path of file being uploaded.
|
||||
*/
|
||||
file: string,
|
||||
/**
|
||||
* UUID of blob data. Use session.getBlobData method to retrieve the data.
|
||||
*/
|
||||
blobUUID: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
|
@ -3010,6 +3104,10 @@ declare namespace Electron {
|
|||
* @returns The user agent for this session.
|
||||
*/
|
||||
getUserAgent(): string;
|
||||
/**
|
||||
* Returns the blob data associated with the identifier.
|
||||
*/
|
||||
getBlobData(identifier: string, callback: (result: Buffer) => void): void;
|
||||
/**
|
||||
* The webRequest API set allows to intercept and modify contents of a request at various stages of its lifetime.
|
||||
*/
|
||||
|
@ -3110,6 +3208,11 @@ declare namespace Electron {
|
|||
}
|
||||
|
||||
interface Cookie {
|
||||
/**
|
||||
* Emitted when a cookie is changed because it was added, edited, removed, or expired.
|
||||
*/
|
||||
on(event: 'changed', listener: (event: Event, cookie: Cookie, cause: CookieChangedCause) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
/**
|
||||
* The name of the cookie.
|
||||
*/
|
||||
|
@ -3149,6 +3252,8 @@ declare namespace Electron {
|
|||
expirationDate?: number;
|
||||
}
|
||||
|
||||
type CookieChangedCause = 'explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite';
|
||||
|
||||
interface CookieDetails {
|
||||
/**
|
||||
* The URL associated with the cookie.
|
||||
|
@ -3311,6 +3416,10 @@ declare namespace Electron {
|
|||
* Path of file being uploaded.
|
||||
*/
|
||||
file: string;
|
||||
/**
|
||||
* UUID of blob data. Use session.getBlobData method to retrieve the data.
|
||||
*/
|
||||
blobUUID: string;
|
||||
}
|
||||
|
||||
interface BeforeRequestDetails extends Details {
|
||||
|
@ -3396,16 +3505,18 @@ declare namespace Electron {
|
|||
interface Shell {
|
||||
/**
|
||||
* Show the given file in a file manager. If possible, select the file.
|
||||
* @returns Whether the item was successfully shown.
|
||||
*/
|
||||
showItemInFolder(fullPath: string): void;
|
||||
showItemInFolder(fullPath: string): boolean;
|
||||
/**
|
||||
* Open the given file in the desktop's default manner.
|
||||
* @returns Whether the item was successfully shown.
|
||||
*/
|
||||
openItem(fullPath: string): void;
|
||||
openItem(fullPath: string): boolean;
|
||||
/**
|
||||
* Open the given external protocol URL in the desktop's default manner
|
||||
* (e.g., mailto: URLs in the default mail user agent).
|
||||
* @returns true if an application was available to open the URL, false otherwise.
|
||||
* @returns Whether an application was available to open the URL.
|
||||
*/
|
||||
openExternal(url: string, options?: {
|
||||
/**
|
||||
|
@ -3416,7 +3527,7 @@ declare namespace Electron {
|
|||
}): boolean;
|
||||
/**
|
||||
* Move the given file to trash.
|
||||
* @returns boolean status for the operation.
|
||||
* @returns Whether the item was successfully moved to the trash.
|
||||
*/
|
||||
moveItemToTrash(fullPath: string): boolean;
|
||||
/**
|
||||
|
@ -3483,18 +3594,69 @@ declare namespace Electron {
|
|||
|
||||
// https://github.com/electron/electron/blob/master/docs/api/system-preferences.md
|
||||
|
||||
type SystemColor =
|
||||
'3d-dark-shadow' | // Dark shadow for three-dimensional display elements.
|
||||
'3d-face' | // Face color for three-dimensional display elements and for dialog box backgrounds.
|
||||
'3d-highlight' | // Highlight color for three-dimensional display elements.
|
||||
'3d-light' | // Light color for three-dimensional display elements.
|
||||
'3d-shadow' | // Shadow color for three-dimensional display elements.
|
||||
'active-border' | // Active window border.
|
||||
'active-caption' | // Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.
|
||||
'active-caption-gradient' | // Right side color in the color gradient of an active window's title bar.
|
||||
'app-workspace' | // Background color of multiple document interface (MDI) applications.
|
||||
'button-text' | // Text on push buttons.
|
||||
'caption-text' | // Text in caption, size box, and scroll bar arrow box.
|
||||
'desktop' | // Desktop background color.
|
||||
'disabled-text' | // Grayed (disabled) text.
|
||||
'highlight' | // Item(s) selected in a control.
|
||||
'highlight-text' | // Text of item(s) selected in a control.
|
||||
'hotlight' | // Color for a hyperlink or hot-tracked item.
|
||||
'inactive-border' | // Inactive window border.
|
||||
'inactive-caption' | // Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.
|
||||
'inactive-caption-gradient' | // Right side color in the color gradient of an inactive window's title bar.
|
||||
'inactive-caption-text' | // Color of text in an inactive caption.
|
||||
'info-background' | // Background color for tooltip controls.
|
||||
'info-text' | // Text color for tooltip controls.
|
||||
'menu' | // Menu background.
|
||||
'menu-highlight' | // The color used to highlight menu items when the menu appears as a flat menu.
|
||||
'menubar' | // The background color for the menu bar when menus appear as flat menus.
|
||||
'menu-text' | // Text in menus.
|
||||
'scrollbar' | // Scroll bar gray area.
|
||||
'window' | // Window background.
|
||||
'window-frame' | // Window frame.
|
||||
'window-text'; // Text in windows.
|
||||
|
||||
/**
|
||||
* Get system preferences.
|
||||
*/
|
||||
interface SystemPreferences {
|
||||
/**
|
||||
* @returns If the system is in Dark Mode.
|
||||
* Note: This is only implemented on Windows.
|
||||
*/
|
||||
on(event: 'accent-color-changed', listener: (event: Event, newColor: string) => void): this;
|
||||
/**
|
||||
* Note: This is only implemented on Windows.
|
||||
*/
|
||||
on(event: 'color-changed', listener: (event: Event) => void): this;
|
||||
/**
|
||||
* Note: This is only implemented on Windows.
|
||||
*/
|
||||
on(event: 'inverted-color-scheme-changed', listener: (
|
||||
event: Event,
|
||||
/**
|
||||
* @param invertedColorScheme true if an inverted color scheme, such as a high contrast theme, is being used, false otherwise.
|
||||
*/
|
||||
invertedColorScheme: boolean
|
||||
) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
/**
|
||||
* @returns Whether the system is in Dark Mode.
|
||||
*
|
||||
* Note: This is only implemented on macOS.
|
||||
*/
|
||||
isDarkMode(): boolean;
|
||||
/**
|
||||
* @returns If the Swipe between pages setting is on.
|
||||
* @returns Whether the Swipe between pages setting is on.
|
||||
*
|
||||
* Note: This is only implemented on macOS.
|
||||
*/
|
||||
|
@ -3541,13 +3703,29 @@ declare namespace Electron {
|
|||
*/
|
||||
getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
|
||||
/**
|
||||
* This method returns true if DWM composition (Aero Glass) is enabled,
|
||||
* and false otherwise. You can use it to determine if you should create
|
||||
* a transparent window or not (transparent windows won’t work correctly when DWM composition is disabled).
|
||||
* @returns Whether DWM composition (Aero Glass) is enabled.
|
||||
*
|
||||
* Note: This is only implemented on Windows.
|
||||
*/
|
||||
isAeroGlassEnabled(): boolean;
|
||||
/**
|
||||
* @returns The users current system wide color preference in the form of an RGBA hexadecimal string.
|
||||
*
|
||||
* Note: This is only implemented on Windows.
|
||||
*/
|
||||
getAccentColor(): string;
|
||||
/**
|
||||
* @returns true if an inverted color scheme, such as a high contrast theme, is active, false otherwise.
|
||||
*
|
||||
* Note: This is only implemented on Windows.
|
||||
*/
|
||||
isInvertedColorScheme(): boolean;
|
||||
/**
|
||||
* @returns The system color setting in RGB hexadecimal form (#ABCDEF). See the Windows docs for more details.
|
||||
*
|
||||
* Note: This is only implemented on Windows.
|
||||
*/
|
||||
getColor(color: SystemColor): string;
|
||||
}
|
||||
|
||||
// https://github.com/electron/electron/blob/master/docs/api/tray.md
|
||||
|
@ -3555,7 +3733,7 @@ declare namespace Electron {
|
|||
/**
|
||||
* A Tray represents an icon in an operating system's notification area.
|
||||
*/
|
||||
interface Tray extends NodeJS.EventEmitter {
|
||||
class Tray extends EventEmitter implements Destroyable {
|
||||
/**
|
||||
* Emitted when the tray icon is clicked.
|
||||
* Note: The bounds payload is only implemented on macOS and Windows.
|
||||
|
@ -3620,7 +3798,7 @@ declare namespace Electron {
|
|||
/**
|
||||
* Creates a new tray icon associated with the image.
|
||||
*/
|
||||
new (image: NativeImage | string): Tray;
|
||||
constructor(image: NativeImage|string);
|
||||
/**
|
||||
* Destroys the tray icon immediately.
|
||||
*/
|
||||
|
@ -3628,7 +3806,7 @@ declare namespace Electron {
|
|||
/**
|
||||
* Sets the image associated with this tray icon.
|
||||
*/
|
||||
setImage(image: NativeImage | string): void;
|
||||
setImage(image: NativeImage|string): void;
|
||||
/**
|
||||
* Sets the image associated with this tray icon when pressed.
|
||||
*/
|
||||
|
@ -3671,6 +3849,10 @@ declare namespace Electron {
|
|||
* @returns The bounds of this tray icon.
|
||||
*/
|
||||
getBounds(): Rectangle;
|
||||
/**
|
||||
* @returns Whether the tray icon is destroyed.
|
||||
*/
|
||||
isDestroyed(): boolean;
|
||||
}
|
||||
|
||||
interface Modifiers {
|
||||
|
@ -3776,12 +3958,21 @@ declare namespace Electron {
|
|||
* By default a new BrowserWindow will be created for the url.
|
||||
*
|
||||
* Calling event.preventDefault() will prevent creating new windows.
|
||||
* In such case, the event.newGuest may be set with a reference
|
||||
* to a BrowserWindow instance to make it used by the Electron's runtime.
|
||||
*/
|
||||
on(event: 'new-window', listener: (event: Event,
|
||||
on(event: 'new-window', listener: (event: WebContents.NewWindowEvent,
|
||||
url: string,
|
||||
frameName: string,
|
||||
disposition: NewWindowDisposition,
|
||||
options: BrowserWindowOptions
|
||||
/**
|
||||
* The options which will be used for creating the new BrowserWindow.
|
||||
*/
|
||||
options: BrowserWindowOptions,
|
||||
/**
|
||||
* The non-standard features (features not handled by Chromium or Electron) given to window.open().
|
||||
*/
|
||||
additionalFeatures: string[]
|
||||
) => void): this;
|
||||
/**
|
||||
* Emitted when a user or the page wants to start navigation.
|
||||
|
@ -3814,7 +4005,7 @@ declare namespace Electron {
|
|||
/**
|
||||
* Emitted when the renderer process has crashed.
|
||||
*/
|
||||
on(event: 'crashed', listener: Function): this;
|
||||
on(event: 'crashed', listener: (event: Event, killed: boolean) => void): this;
|
||||
/**
|
||||
* Emitted when a plugin process has crashed.
|
||||
*/
|
||||
|
@ -4229,6 +4420,10 @@ declare namespace Electron {
|
|||
* If offscreen rendering is enabled returns the current frame rate.
|
||||
*/
|
||||
getFrameRate(): number;
|
||||
/**
|
||||
* If offscreen rendering is enabled invalidates the frame and generates a new one through the 'paint' event.
|
||||
*/
|
||||
invalidate(): void;
|
||||
/**
|
||||
* Sets the item as dragging item for current drag-drop operation.
|
||||
*/
|
||||
|
@ -4265,6 +4460,12 @@ declare namespace Electron {
|
|||
debugger: Debugger;
|
||||
}
|
||||
|
||||
namespace WebContents {
|
||||
interface NewWindowEvent extends Event {
|
||||
newGuest?: BrowserWindow;
|
||||
}
|
||||
}
|
||||
|
||||
interface BeginFrameSubscriptionCallback {
|
||||
(
|
||||
/**
|
||||
|
@ -4430,7 +4631,7 @@ declare namespace Electron {
|
|||
[key: string]: string;
|
||||
}
|
||||
|
||||
type NewWindowDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other';
|
||||
type NewWindowDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other';
|
||||
|
||||
/**
|
||||
* Specifies the action to take place when ending webContents.findInPage request.
|
||||
|
@ -4440,7 +4641,7 @@ declare namespace Electron {
|
|||
*/
|
||||
type StopFindInPageAtion = 'clearSelection' | 'keepSelection' | 'activateSelection';
|
||||
|
||||
type CursorType = 'default' | 'crosshair' | 'pointer' | 'text' | 'wait' | 'help' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ns-resize' | 'ew-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'm-panning' | 'e-panning' | 'n-panning' | 'ne-panning' | 'nw-panning' | 's-panning' | 'se-panning' | 'sw-panning' | 'w-panning' | 'move' | 'vertical-text' | 'cell' | 'context-menu' | 'alias' | 'progress' | 'nodrop' | 'copy' | 'none' | 'not-allowed' | 'zoom-in' | 'zoom-out' | 'grab' | 'grabbing' | 'custom';
|
||||
type CursorType = 'default' | 'crosshair' | 'pointer' | 'text' | 'wait' | 'help' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ns-resize' | 'ew-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'm-panning' | 'e-panning' | 'n-panning' | 'ne-panning' | 'nw-panning' | 's-panning' | 'se-panning' |'sw-panning' | 'w-panning' | 'move' | 'vertical-text' | 'cell' | 'context-menu' | 'alias' | 'progress' | 'nodrop' | 'copy' | 'none' | 'not-allowed' | 'zoom-in' | 'zoom-out' | 'grab' | 'grabbing' | 'custom';
|
||||
|
||||
interface LoadURLOptions {
|
||||
/**
|
||||
|
@ -4873,6 +5074,15 @@ declare namespace Electron {
|
|||
* A list of strings which specifies the blink features to be disabled separated by ,.
|
||||
*/
|
||||
disableblinkfeatures: string;
|
||||
/**
|
||||
* A value that links the webview to a specific webContents.
|
||||
* When a webview first loads a new webContents is created and this attribute is set
|
||||
* to its instance identifier. Setting this attribute on a new or existing webview connects
|
||||
* it to the existing webContents that currently renders in a different webview.
|
||||
*
|
||||
* The existing webview will see the destroy event and will then create a new webContents when a new url is loaded.
|
||||
*/
|
||||
guestinstance: string;
|
||||
/**
|
||||
* Loads the url in the webview, the url must contain the protocol prefix, e.g. the http:// or file://.
|
||||
*/
|
||||
|
@ -5411,7 +5621,7 @@ declare namespace Electron {
|
|||
screen: Electron.Screen;
|
||||
session: typeof Electron.Session;
|
||||
systemPreferences: Electron.SystemPreferences;
|
||||
Tray: Electron.Tray;
|
||||
Tray: typeof Electron.Tray;
|
||||
webContents: Electron.WebContentsStatic;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ function generatePatchedEnv(env: any, stdInPipeName: string, stdOutPipeName: str
|
|||
newEnv['STDOUT_PIPE_NAME'] = stdOutPipeName;
|
||||
newEnv['STDERR_PIPE_NAME'] = stdErrPipeName;
|
||||
newEnv['ELECTRON_RUN_AS_NODE'] = '1';
|
||||
newEnv['ELECTRON_NO_ASAR'] = '1';
|
||||
|
||||
return newEnv;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,6 @@
|
|||
border-radius: 10px;
|
||||
font-size: 12px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
/* for OS X ballistic scrolling */
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as path from 'path';
|
|||
import * as platform from 'vs/base/common/platform';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import { IStorageService } from 'vs/code/electron-main/storage';
|
||||
import { shell, screen, BrowserWindow } from 'electron';
|
||||
import { shell, screen, BrowserWindow, systemPreferences } from 'electron';
|
||||
import { TPromise, TValueCallback } from 'vs/base/common/winjs.base';
|
||||
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { ILogService } from 'vs/code/electron-main/log';
|
||||
|
@ -99,6 +99,7 @@ export interface IWindowConfiguration extends ParsedArgs {
|
|||
|
||||
zoomLevel?: number;
|
||||
fullscreen?: boolean;
|
||||
highContrast?: boolean;
|
||||
|
||||
workspacePath?: string;
|
||||
|
||||
|
@ -158,7 +159,9 @@ export class VSCodeWindow {
|
|||
this.restoreWindowState(config.state);
|
||||
|
||||
// For VS theme we can show directly because background is white
|
||||
const usesLightTheme = /vs($| )/.test(this.storageService.getItem<string>(VSCodeWindow.colorThemeStorageKey));
|
||||
const themeId = this.storageService.getItem<string>(VSCodeWindow.colorThemeStorageKey);
|
||||
const usesLightTheme = /vs($| )/.test(themeId);
|
||||
const usesHighContrastTheme = /hc-black($| )/.test(themeId) || (platform.isWindows && systemPreferences.isInvertedColorScheme());
|
||||
if (!global.windowShow) {
|
||||
global.windowShow = Date.now();
|
||||
}
|
||||
|
@ -171,7 +174,7 @@ export class VSCodeWindow {
|
|||
height: this.windowState.height,
|
||||
x: this.windowState.x,
|
||||
y: this.windowState.y,
|
||||
backgroundColor: usesLightTheme ? '#FFFFFF' : platform.isMacintosh ? '#171717' : '#1E1E1E', // https://github.com/electron/electron/issues/5150
|
||||
backgroundColor: usesHighContrastTheme ? '#000000' : usesLightTheme ? '#FFFFFF' : platform.isMacintosh ? '#171717' : '#1E1E1E', // https://github.com/electron/electron/issues/5150
|
||||
minWidth: VSCodeWindow.MIN_WIDTH,
|
||||
minHeight: VSCodeWindow.MIN_HEIGHT,
|
||||
show: !isFullscreenOrMaximized,
|
||||
|
@ -369,6 +372,17 @@ export class VSCodeWindow {
|
|||
this.sendWhenReady('vscode:leaveFullScreen');
|
||||
});
|
||||
|
||||
// React to HC color scheme changes (Windows)
|
||||
if (platform.isWindows) {
|
||||
systemPreferences.on('inverted-color-scheme-changed', () => {
|
||||
if (systemPreferences.isInvertedColorScheme()) {
|
||||
this.sendWhenReady('vscode:enterHighContrast');
|
||||
} else {
|
||||
this.sendWhenReady('vscode:leaveHighContrast');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Window Failed to load
|
||||
this._win.webContents.on('did-fail-load', (event: Event, errorCode: string, errorDescription: string) => {
|
||||
console.warn('[electron event]: fail to load, ', errorDescription);
|
||||
|
@ -463,6 +477,9 @@ export class VSCodeWindow {
|
|||
// Set fullscreen state
|
||||
windowConfiguration.fullscreen = this._win.isFullScreen();
|
||||
|
||||
// Set High Contrast state
|
||||
windowConfiguration.highContrast = platform.isWindows && systemPreferences.isInvertedColorScheme();
|
||||
|
||||
// Config (combination of process.argv and window configuration)
|
||||
const environment = parseArgs(process.argv);
|
||||
const config = objects.assign(environment, windowConfiguration);
|
||||
|
|
|
@ -24,7 +24,8 @@ const boostrapPath = URI.parse(require.toUrl('bootstrap')).fsPath;
|
|||
function _spawnSharedProcess(initData: ISharedProcessInitData, options: ISharedProcessOptions): cp.ChildProcess {
|
||||
const execArgv = [];
|
||||
const env = assign({}, process.env, {
|
||||
AMD_ENTRYPOINT: 'vs/code/node/sharedProcessMain'
|
||||
AMD_ENTRYPOINT: 'vs/code/node/sharedProcessMain',
|
||||
ELECTRON_NO_ASAR: '1'
|
||||
});
|
||||
|
||||
if (options.allowOutput) {
|
||||
|
|
|
@ -135,6 +135,16 @@ function main() {
|
|||
webFrame.setZoomLevel(zoomLevel);
|
||||
}
|
||||
|
||||
// Handle high contrast mode
|
||||
if (configuration.highContrast) {
|
||||
var themeStorageKey = 'storage://global/workbench.theme';
|
||||
var hcTheme = 'hc-black vscode-theme-defaults-themes-hc_black-json';
|
||||
if (window.localStorage.getItem(themeStorageKey) !== hcTheme) {
|
||||
window.localStorage.setItem(themeStorageKey, hcTheme);
|
||||
window.document.body.className = 'monaco-shell ' + hcTheme;
|
||||
}
|
||||
}
|
||||
|
||||
// Load the loader and start loading the workbench
|
||||
const rootUrl = uriFromPath(configuration.appRoot) + '/out';
|
||||
|
||||
|
|
|
@ -95,7 +95,8 @@ export class ExtensionHostProcessWorker {
|
|||
AMD_ENTRYPOINT: 'vs/workbench/node/extensionHostProcess',
|
||||
PIPE_LOGGING: 'true',
|
||||
VERBOSE_LOGGING: true,
|
||||
VSCODE_WINDOW_ID: String(this.windowService.getWindowId())
|
||||
VSCODE_WINDOW_ID: String(this.windowService.getWindowId()),
|
||||
ELECTRON_NO_ASAR: '1'
|
||||
}),
|
||||
// We only detach the extension host on windows. Linux and Mac orphan by default
|
||||
// and detach under Linux and Mac create another process group.
|
||||
|
|
|
@ -24,6 +24,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
|||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IThemeService, VS_HC_THEME, VS_DARK_THEME } from 'vs/workbench/services/themes/common/themeService';
|
||||
import { IWindowIPCService } from 'vs/workbench/services/window/electron-browser/windowService';
|
||||
import { AutoSaveConfiguration } from 'vs/platform/files/common/files';
|
||||
import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing';
|
||||
|
@ -74,7 +75,8 @@ export class ElectronIntegration {
|
|||
@IContextMenuService private contextMenuService: IContextMenuService,
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
|
||||
@IEnvironmentService private environmentService: IEnvironmentService
|
||||
@IEnvironmentService private environmentService: IEnvironmentService,
|
||||
@IThemeService private themeService: IThemeService
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -145,6 +147,19 @@ export class ElectronIntegration {
|
|||
});
|
||||
});
|
||||
|
||||
// High Contrast Events
|
||||
ipc.on('vscode:enterHighContrast', (event) => {
|
||||
this.partService.joinCreation().then(() => {
|
||||
this.themeService.setColorTheme(VS_HC_THEME, false);
|
||||
});
|
||||
});
|
||||
|
||||
ipc.on('vscode:leaveHighContrast', (event) => {
|
||||
this.partService.joinCreation().then(() => {
|
||||
this.themeService.setColorTheme(VS_DARK_THEME, false);
|
||||
});
|
||||
});
|
||||
|
||||
// Configuration changes
|
||||
let previousConfiguredZoomLevel: number;
|
||||
this.configurationService.onDidUpdateConfiguration(e => {
|
||||
|
|
|
@ -10,6 +10,10 @@ import Event from 'vs/base/common/event';
|
|||
|
||||
export let IThemeService = createDecorator<IThemeService>('themeService');
|
||||
|
||||
export const VS_LIGHT_THEME = 'vs';
|
||||
export const VS_DARK_THEME = 'vs-dark';
|
||||
export const VS_HC_THEME = 'hc-black';
|
||||
|
||||
export interface IThemeService {
|
||||
_serviceBrand: any;
|
||||
setColorTheme(themeId: string, broadcastToAllWindows: boolean): TPromise<boolean>;
|
||||
|
|
|
@ -11,7 +11,7 @@ import Json = require('vs/base/common/json');
|
|||
import { IThemeExtensionPoint } from 'vs/platform/theme/common/themeExtensionPoint';
|
||||
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionsRegistry, ExtensionMessageCollector } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||
import { IThemeService, IThemeData, IThemeSetting, IThemeDocument } from 'vs/workbench/services/themes/common/themeService';
|
||||
import { IThemeService, IThemeData, IThemeSetting, IThemeDocument, VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME } from 'vs/workbench/services/themes/common/themeService';
|
||||
import { TokenStylesContribution, EditorStylesContribution, SearchViewStylesContribution, TerminalStylesContribution } from 'vs/workbench/services/themes/electron-browser/stylesContributions';
|
||||
import { getBaseThemeId } from 'vs/platform/theme/common/themes';
|
||||
import { IWindowIPCService } from 'vs/workbench/services/window/electron-browser/windowService';
|
||||
|
@ -44,9 +44,9 @@ const oldDefaultThemeExtensionId = 'vscode-theme-colorful-defaults';
|
|||
function validateThemeId(theme: string): string {
|
||||
// migrations
|
||||
switch (theme) {
|
||||
case 'vs': return `vs ${defaultThemeExtensionId}-themes-light_vs-json`;
|
||||
case 'vs-dark': return `vs-dark ${defaultThemeExtensionId}-themes-dark_vs-json`;
|
||||
case 'hc-black': return `hc-black ${defaultThemeExtensionId}-themes-hc_black-json`;
|
||||
case VS_LIGHT_THEME: return `vs ${defaultThemeExtensionId}-themes-light_vs-json`;
|
||||
case VS_DARK_THEME: return `vs-dark ${defaultThemeExtensionId}-themes-dark_vs-json`;
|
||||
case VS_HC_THEME: return `hc-black ${defaultThemeExtensionId}-themes-hc_black-json`;
|
||||
case `vs ${oldDefaultThemeExtensionId}-themes-light_plus-tmTheme`: return `vs ${defaultThemeExtensionId}-themes-light_plus-json`;
|
||||
case `vs-dark ${oldDefaultThemeExtensionId}-themes-dark_plus-tmTheme`: return `vs-dark ${defaultThemeExtensionId}-themes-dark_plus-json`;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ let themesExtPoint = ExtensionsRegistry.registerExtensionPoint<IThemeExtensionPo
|
|||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
defaultSnippets: [{ body: { label: '{{label}}', uiTheme: 'vs-dark', path: './themes/{{id}}.tmTheme.' } }],
|
||||
defaultSnippets: [{ body: { label: '{{label}}', uiTheme: VS_DARK_THEME, path: './themes/{{id}}.tmTheme.' } }],
|
||||
properties: {
|
||||
label: {
|
||||
description: nls.localize('vscode.extension.contributes.themes.label', 'Label of the color theme as shown in the UI.'),
|
||||
|
@ -66,7 +66,7 @@ let themesExtPoint = ExtensionsRegistry.registerExtensionPoint<IThemeExtensionPo
|
|||
},
|
||||
uiTheme: {
|
||||
description: nls.localize('vscode.extension.contributes.themes.uiTheme', 'Base theme defining the colors around the editor: \'vs\' is the light color theme, \'vs-dark\' is the dark color theme. \'hc-black\' is the dark high contrast theme.'),
|
||||
enum: ['vs', 'vs-dark', 'hc-black']
|
||||
enum: [VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME]
|
||||
},
|
||||
path: {
|
||||
description: nls.localize('vscode.extension.contributes.themes.path', 'Path of the tmTheme file. The path is relative to the extension folder and is typically \'./themes/themeFile.tmTheme\'.'),
|
||||
|
|
Loading…
Reference in a new issue