Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
98a3c4fe
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
98a3c4fe
编写于
11月 09, 2020
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reduce work when menu is not visible
fixes #108712
上级
a45abdbd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
46 addition
and
3 deletion
+46
-3
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
+46
-3
未找到文件。
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
浏览文件 @
98a3c4fe
...
...
@@ -122,7 +122,7 @@ export abstract class MenubarControl extends Disposable {
this
.
_register
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
e
)));
// Listen to update service
this
.
updateService
.
onStateChange
(()
=>
this
.
updateMenubar
());
this
.
updateService
.
onStateChange
(()
=>
this
.
onUpdateStateChange
());
// Listen for changes in recently opened menu
this
.
_register
(
this
.
workspacesService
.
onRecentlyOpenedChange
(()
=>
{
this
.
onRecentlyOpenedChange
();
}));
...
...
@@ -148,6 +148,14 @@ export abstract class MenubarControl extends Disposable {
return
label
;
}
protected
onUpdateStateChange
():
void
{
this
.
updateMenubar
();
}
protected
onUpdateKeybindings
():
void
{
this
.
updateMenubar
();
}
protected
getOpenRecentActions
():
(
Separator
|
IAction
&
{
uri
:
URI
})[]
{
if
(
!
this
.
recentlyOpened
)
{
return
[];
...
...
@@ -193,7 +201,7 @@ export abstract class MenubarControl extends Disposable {
}
}
pr
ivate
onRecentlyOpenedChange
():
void
{
pr
otected
onRecentlyOpenedChange
():
void
{
this
.
workspacesService
.
getRecentlyOpened
().
then
(
recentlyOpened
=>
{
this
.
recentlyOpened
=
recentlyOpened
;
this
.
updateMenubar
();
...
...
@@ -266,6 +274,7 @@ export class CustomMenubarControl extends MenubarControl {
private
container
:
HTMLElement
|
undefined
;
private
alwaysOnMnemonics
:
boolean
=
false
;
private
focusInsideMenubar
:
boolean
=
false
;
private
visible
:
boolean
=
true
;
private
readonly
_onVisibilityChange
:
Emitter
<
boolean
>
;
private
readonly
_onFocusStateChange
:
Emitter
<
boolean
>
;
...
...
@@ -530,6 +539,12 @@ export class CustomMenubarControl extends MenubarControl {
return
currentSidebarLocation
===
'
right
'
?
Direction
.
Left
:
Direction
.
Right
;
}
private
onDidVisibilityChange
(
visible
:
boolean
):
void
{
this
.
visible
=
visible
;
this
.
onRecentlyOpenedChange
();
this
.
_onVisibilityChange
.
fire
(
visible
);
}
private
setupCustomMenubar
(
firstTime
:
boolean
):
void
{
// If there is no container, we cannot setup the menubar
if
(
!
this
.
container
)
{
...
...
@@ -554,7 +569,7 @@ export class CustomMenubarControl extends MenubarControl {
}
}));
this
.
_register
(
this
.
menubar
.
onVisibilityChange
(
e
=>
this
.
_onVisibilityChange
.
fir
e
(
e
)));
this
.
_register
(
this
.
menubar
.
onVisibilityChange
(
e
=>
this
.
onDidVisibilityChang
e
(
e
)));
// Before we focus the menubar, stop updates to it so that focus-related context keys will work
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
container
,
DOM
.
EventType
.
FOCUS_IN
,
()
=>
{
...
...
@@ -668,6 +683,10 @@ export class CustomMenubarControl extends MenubarControl {
}
protected
onDidChangeWindowFocus
(
hasFocus
:
boolean
):
void
{
if
(
!
this
.
visible
)
{
return
;
}
super
.
onDidChangeWindowFocus
(
hasFocus
);
if
(
this
.
container
)
{
...
...
@@ -682,6 +701,30 @@ export class CustomMenubarControl extends MenubarControl {
}
}
protected
onUpdateStateChange
():
void
{
if
(
!
this
.
visible
)
{
return
;
}
super
.
onUpdateStateChange
();
}
protected
onRecentlyOpenedChange
():
void
{
if
(
!
this
.
visible
)
{
return
;
}
super
.
onRecentlyOpenedChange
();
}
protected
onUpdateKeybindings
():
void
{
if
(
!
this
.
visible
)
{
return
;
}
super
.
onUpdateKeybindings
();
}
protected
registerListeners
():
void
{
super
.
registerListeners
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录