Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
56111083
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
56111083
编写于
5月 25, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
How to configure a window (also for reload case)? (fixes #27192)
上级
145310ae
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
100 addition
and
94 deletion
+100
-94
src/vs/code/electron-main/menus.ts
src/vs/code/electron-main/menus.ts
+18
-2
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+5
-5
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+3
-81
src/vs/code/node/keyboard.ts
src/vs/code/node/keyboard.ts
+70
-0
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+4
-6
未找到文件。
src/vs/code/electron-main/menus.ts
浏览文件 @
56111083
...
...
@@ -9,7 +9,7 @@ import * as nls from 'vs/nls';
import
{
isMacintosh
,
isLinux
,
isWindows
,
language
}
from
'
vs/base/common/platform
'
;
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ipcMain
as
ipc
,
app
,
shell
,
dialog
,
Menu
,
MenuItem
}
from
'
electron
'
;
import
{
ipcMain
as
ipc
,
app
,
shell
,
dialog
,
Menu
,
MenuItem
,
BrowserWindow
}
from
'
electron
'
;
import
{
OpenContext
}
from
'
vs/code/common/windows
'
;
import
{
IWindowsMainService
}
from
'
vs/code/electron-main/windows
'
;
import
{
VSCodeWindow
}
from
'
vs/code/electron-main/window
'
;
...
...
@@ -908,7 +908,7 @@ export class VSCodeMenu {
label
:
this
.
mnemonicLabel
(
nls
.
localize
({
key
:
'
miAccessibilityOptions
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
Accessibility &&Options
"
)),
accelerator
:
null
,
click
:
()
=>
{
this
.
windowsService
.
openAccessibilityOptions
();
this
.
openAccessibilityOptions
();
}
},
false
));
...
...
@@ -974,6 +974,22 @@ export class VSCodeMenu {
}
}
private
openAccessibilityOptions
():
void
{
let
win
=
new
BrowserWindow
({
alwaysOnTop
:
true
,
skipTaskbar
:
true
,
resizable
:
false
,
width
:
450
,
height
:
300
,
show
:
true
,
title
:
nls
.
localize
(
'
accessibilityOptionsWindowTitle
'
,
"
Accessibility Options
"
)
});
win
.
setMenuBarVisibility
(
false
);
win
.
loadURL
(
'
chrome://accessibility
'
);
}
private
getUpdateMenuItems
():
Electron
.
MenuItem
[]
{
switch
(
this
.
updateService
.
state
)
{
case
UpdateState
.
Uninitialized
:
...
...
src/vs/code/electron-main/window.ts
浏览文件 @
56111083
...
...
@@ -22,7 +22,7 @@ import product from 'vs/platform/node/product';
import
{
getCommonHTTPHeaders
}
from
'
vs/platform/environment/node/http
'
;
import
{
IWindowSettings
,
MenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
KeyboardLayoutMonitor
}
from
"
vs/code/node/keyboard
"
;
export
interface
IWindowState
{
width
?:
number
;
...
...
@@ -82,10 +82,7 @@ export interface IWindowConfiguration extends ParsedArgs {
* The physical keyboard is of ISO type (on OSX).
*/
isISOKeyboard
?:
boolean
;
/**
* Accessibility support is enabled.
*/
accessibilitySupportEnabled
?:
boolean
;
zoomLevel
?:
number
;
fullscreen
?:
boolean
;
highContrast
?:
boolean
;
...
...
@@ -558,6 +555,9 @@ export class VSCodeWindow {
windowConfiguration
.
highContrast
=
platform
.
isWindows
&&
systemPreferences
.
isInvertedColorScheme
()
&&
(
!
windowConfig
||
windowConfig
.
autoDetectHighContrast
);
windowConfiguration
.
accessibilitySupport
=
app
.
isAccessibilitySupportEnabled
();
// Set Keyboard Config
windowConfiguration
.
isISOKeyboard
=
KeyboardLayoutMonitor
.
INSTANCE
.
isISOKeyboard
();
// Theme
windowConfiguration
.
baseTheme
=
this
.
getBaseTheme
();
windowConfiguration
.
backgroundColor
=
this
.
getBackgroundColor
();
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
56111083
...
...
@@ -31,8 +31,7 @@ import product from 'vs/platform/node/product';
import
{
OpenContext
}
from
'
vs/code/common/windows
'
;
import
{
ITelemetryService
,
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
isParent
,
isEqual
,
isEqualOrParent
}
from
'
vs/platform/files/common/files
'
;
import
*
as
nativeKeymap
from
'
native-keymap
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
KeyboardLayoutMonitor
}
from
"
vs/code/node/keyboard
"
;
enum
WindowError
{
UNRESPONSIVE
,
...
...
@@ -107,7 +106,6 @@ export interface IWindowsMainService {
openFileFolderPicker
(
forceNewWindow
?:
boolean
,
data
?:
ITelemetryData
):
void
;
openFilePicker
(
forceNewWindow
?:
boolean
,
path
?:
string
,
window
?:
VSCodeWindow
,
data
?:
ITelemetryData
):
void
;
openFolderPicker
(
forceNewWindow
?:
boolean
,
window
?:
VSCodeWindow
,
data
?:
ITelemetryData
):
void
;
openAccessibilityOptions
():
void
;
focusLastActive
(
cli
:
ParsedArgs
,
context
:
OpenContext
):
VSCodeWindow
;
getLastActiveWindow
():
VSCodeWindow
;
findWindow
(
workspacePath
:
string
,
filePath
?:
string
,
extensionDevelopmentPath
?:
string
):
VSCodeWindow
;
...
...
@@ -343,6 +341,7 @@ export class WindowsManager implements IWindowsMainService {
}
private
onBroadcast
(
event
:
string
,
payload
:
any
):
void
{
// Theme changes
if
(
event
===
'
vscode:changeColorTheme
'
&&
typeof
payload
===
'
string
'
)
{
...
...
@@ -737,8 +736,6 @@ export class WindowsManager implements IWindowsMainService {
configuration
.
filesToCreate
=
filesToCreate
;
configuration
.
filesToDiff
=
filesToDiff
;
configuration
.
nodeCachedDataDir
=
this
.
environmentService
.
nodeCachedDataDir
;
configuration
.
isISOKeyboard
=
KeyboardLayoutMonitor
.
INSTANCE
.
isISOKeyboard
();
configuration
.
accessibilitySupportEnabled
=
app
.
isAccessibilitySupportEnabled
();
return
configuration
;
}
...
...
@@ -1028,22 +1025,6 @@ export class WindowsManager implements IWindowsMainService {
this
.
doPickAndOpen
({
pickFolders
:
true
,
forceNewWindow
,
window
},
'
openFolder
'
,
data
);
}
public
openAccessibilityOptions
():
void
{
let
win
=
new
BrowserWindow
({
alwaysOnTop
:
true
,
skipTaskbar
:
true
,
resizable
:
false
,
width
:
450
,
height
:
300
,
show
:
true
,
title
:
nls
.
localize
(
'
accessibilityOptionsWindowTitle
'
,
"
Accessibility Options
"
)
});
win
.
setMenuBarVisibility
(
false
);
win
.
loadURL
(
'
chrome://accessibility
'
);
}
private
doPickAndOpen
(
options
:
INativeOpenDialogOptions
,
eventName
:
string
,
data
?:
ITelemetryData
):
void
{
this
.
getFileOrFolderPaths
(
options
,
(
paths
:
string
[])
=>
{
const
nOfPaths
=
paths
?
paths
.
length
:
0
;
...
...
@@ -1338,63 +1319,4 @@ export class WindowsManager implements IWindowsMainService {
},
10
/* delay to unwind callback stack (IPC) */
);
}
}
}
class
KeyboardLayoutMonitor
{
public
static
INSTANCE
=
new
KeyboardLayoutMonitor
();
private
_emitter
:
Emitter
<
boolean
>
;
private
_registered
:
boolean
;
private
_isISOKeyboard
:
boolean
;
private
constructor
()
{
this
.
_emitter
=
new
Emitter
<
boolean
>
();
this
.
_registered
=
false
;
this
.
_isISOKeyboard
=
this
.
_readIsISOKeyboard
();
}
public
onDidChangeKeyboardLayout
(
callback
:
(
isISOKeyboard
:
boolean
)
=>
void
):
IDisposable
{
if
(
!
this
.
_registered
)
{
this
.
_registered
=
true
;
nativeKeymap
.
onDidChangeKeyboardLayout
(()
=>
{
this
.
_emitter
.
fire
(
this
.
_isISOKeyboard
);
});
if
(
platform
.
isMacintosh
)
{
// See https://github.com/Microsoft/vscode/issues/24153
// On OSX, on ISO keyboards, Chromium swaps the scan codes
// of IntlBackslash and Backquote.
//
// The C++ methods can give the current keyboard type (ISO or not)
// only after a NSEvent was handled.
//
// We therefore poll.
setInterval
(()
=>
{
let
newValue
=
this
.
_readIsISOKeyboard
();
if
(
this
.
_isISOKeyboard
===
newValue
)
{
// no change
return
;
}
this
.
_isISOKeyboard
=
newValue
;
this
.
_emitter
.
fire
(
this
.
_isISOKeyboard
);
},
3000
);
}
}
return
this
.
_emitter
.
event
(
callback
);
}
private
_readIsISOKeyboard
():
boolean
{
if
(
platform
.
isMacintosh
)
{
return
nativeKeymap
.
isISOKeyboard
();
}
return
false
;
}
public
isISOKeyboard
():
boolean
{
return
this
.
_isISOKeyboard
;
}
}
}
\ No newline at end of file
src/vs/code/node/keyboard.ts
0 → 100644
浏览文件 @
56111083
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
nativeKeymap
from
'
native-keymap
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
isMacintosh
}
from
"
vs/base/common/platform
"
;
import
{
Emitter
}
from
"
vs/base/common/event
"
;
export
class
KeyboardLayoutMonitor
{
public
static
readonly
INSTANCE
=
new
KeyboardLayoutMonitor
();
private
_emitter
:
Emitter
<
boolean
>
;
private
_registered
:
boolean
;
private
_isISOKeyboard
:
boolean
;
private
constructor
()
{
this
.
_emitter
=
new
Emitter
<
boolean
>
();
this
.
_registered
=
false
;
this
.
_isISOKeyboard
=
this
.
_readIsISOKeyboard
();
}
public
onDidChangeKeyboardLayout
(
callback
:
(
isISOKeyboard
:
boolean
)
=>
void
):
IDisposable
{
if
(
!
this
.
_registered
)
{
this
.
_registered
=
true
;
nativeKeymap
.
onDidChangeKeyboardLayout
(()
=>
{
this
.
_emitter
.
fire
(
this
.
_isISOKeyboard
);
});
if
(
isMacintosh
)
{
// See https://github.com/Microsoft/vscode/issues/24153
// On OSX, on ISO keyboards, Chromium swaps the scan codes
// of IntlBackslash and Backquote.
//
// The C++ methods can give the current keyboard type (ISO or not)
// only after a NSEvent was handled.
//
// We therefore poll.
setInterval
(()
=>
{
let
newValue
=
this
.
_readIsISOKeyboard
();
if
(
this
.
_isISOKeyboard
===
newValue
)
{
// no change
return
;
}
this
.
_isISOKeyboard
=
newValue
;
this
.
_emitter
.
fire
(
this
.
_isISOKeyboard
);
},
3000
);
}
}
return
this
.
_emitter
.
event
(
callback
);
}
private
_readIsISOKeyboard
():
boolean
{
if
(
isMacintosh
)
{
return
nativeKeymap
.
isISOKeyboard
();
}
return
false
;
}
public
isISOKeyboard
():
boolean
{
return
this
.
_isISOKeyboard
;
}
}
src/vs/workbench/electron-browser/main.ts
浏览文件 @
56111083
...
...
@@ -42,10 +42,7 @@ export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
*/
isISOKeyboard
?:
boolean
;
/**
* Accessibility support is enabled.
*/
accessibilitySupportEnabled
?:
boolean
;
accessibilitySupport
?:
boolean
;
appRoot
:
string
;
execPath
:
string
;
...
...
@@ -62,15 +59,16 @@ export function startup(configuration: IWindowConfiguration): TPromise<void> {
// Ensure others can listen to zoom level changes
browser
.
setZoomFactor
(
webFrame
.
getZoomFactor
());
// See https://github.com/Microsoft/vscode/issues/26151
// Can be trusted because we are not setting it ourselves.
browser
.
setZoomLevel
(
webFrame
.
getZoomLevel
(),
/*isTrusted*/
true
);
browser
.
setZoomLevel
(
webFrame
.
getZoomLevel
(),
true
/* isTrusted */
);
browser
.
setFullscreen
(
!!
configuration
.
fullscreen
);
KeyboardMapperFactory
.
INSTANCE
.
_onKeyboardLayoutChanged
(
configuration
.
isISOKeyboard
);
browser
.
setAccessibilitySupport
(
configuration
.
accessibilitySupport
Enabled
?
platform
.
AccessibilitySupport
.
Enabled
:
platform
.
AccessibilitySupport
.
Disabled
);
browser
.
setAccessibilitySupport
(
configuration
.
accessibilitySupport
?
platform
.
AccessibilitySupport
.
Enabled
:
platform
.
AccessibilitySupport
.
Disabled
);
// Setup Intl
comparer
.
setFileNameComparer
(
new
Intl
.
Collator
(
undefined
,
{
numeric
:
true
,
sensitivity
:
'
base
'
}));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录