Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
8f61b620
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,发现更多精彩内容 >>
提交
8f61b620
编写于
11月 10, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove `windowEvent`
上级
df7dbe46
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
30 addition
and
87 deletion
+30
-87
src/vs/code/common/windows.ts
src/vs/code/common/windows.ts
+8
-12
src/vs/code/common/windowsIpc.ts
src/vs/code/common/windowsIpc.ts
+0
-49
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+4
-7
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+1
-12
src/vs/code/node/sharedProcessMain.ts
src/vs/code/node/sharedProcessMain.ts
+7
-6
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+1
-0
src/vs/platform/windows/common/windowsIpc.ts
src/vs/platform/windows/common/windowsIpc.ts
+8
-1
src/vs/platform/windows/electron-main/windowsService.ts
src/vs/platform/windows/electron-main/windowsService.ts
+1
-0
未找到文件。
src/vs/code/common/windows.ts
浏览文件 @
8f61b620
...
...
@@ -4,10 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import
Event
from
'
vs/base/common/event
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
export
const
IWindowEventService
=
createDecorator
<
IWindowEventService
>
(
'
windowEventService
'
);
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
export
interface
IWindowEventService
{
_serviceBrand
:
any
;
...
...
@@ -21,22 +19,20 @@ export class ActiveWindowManager implements IDisposable {
private
disposables
:
IDisposable
[]
=
[];
private
_activeWindowId
:
number
;
constructor
(
@
IWindow
EventService
private
windowService
:
IWindowEvent
Service
)
{
this
.
disposables
.
push
(
this
.
windowService
.
onNewWindowOpen
(
windowId
=>
this
.
setActiveWindow
(
windowId
))
);
this
.
disposables
.
push
(
this
.
windowService
.
onWindowFocus
(
windowId
=>
this
.
setActiveWindow
(
windowId
))
);
constructor
(
@
IWindow
sService
windowsService
:
IWindows
Service
)
{
windowsService
.
onWindowOpen
(
this
.
setActiveWindow
,
this
,
this
.
disposables
);
windowsService
.
onWindowFocus
(
this
.
setActiveWindow
,
this
,
this
.
disposables
);
}
private
setActiveWindow
(
windowId
:
number
)
{
this
.
_activeWindowId
=
windowId
;
}
public
get
activeClientId
():
string
{
get
activeClientId
():
string
{
return
`window:
${
this
.
_activeWindowId
}
`
;
}
public
dispose
()
{
for
(
const
disposable
of
this
.
disposables
)
{
disposable
.
dispose
();
}
dispose
()
{
this
.
disposables
=
dispose
(
this
.
disposables
);
}
}
\ No newline at end of file
src/vs/code/common/windowsIpc.ts
已删除
100644 → 0
浏览文件 @
df7dbe46
/*---------------------------------------------------------------------------------------------
* 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
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
,
eventToCall
,
eventFromCall
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IWindowEventService
}
from
'
vs/code/common/windows
'
;
import
Event
,
{
buffer
}
from
'
vs/base/common/event
'
;
export
interface
IWindowEventChannel
extends
IChannel
{
call
(
command
:
'
event:onNewWindowOpen
'
):
TPromise
<
number
>
;
call
(
command
:
'
event:onWindowFocus
'
):
TPromise
<
number
>
;
call
(
command
:
string
,
arg
?:
any
):
any
;
}
export
class
WindowEventChannel
implements
IWindowEventChannel
{
onNewWindowOpen
:
Event
<
number
>
;
onWindowFocus
:
Event
<
number
>
;
constructor
(
private
service
:
IWindowEventService
)
{
this
.
onNewWindowOpen
=
buffer
(
service
.
onNewWindowOpen
,
true
);
this
.
onWindowFocus
=
buffer
(
service
.
onWindowFocus
,
true
);
}
call
(
command
:
string
,
args
?:
any
):
any
{
switch
(
command
)
{
case
'
event:onNewWindowOpen
'
:
return
eventToCall
(
this
.
onNewWindowOpen
);
case
'
event:onWindowFocus
'
:
return
eventToCall
(
this
.
onWindowFocus
);
default
:
return
TPromise
.
wrapError
(
'
invalid command
'
);
}
}
}
export
class
WindowEventChannelClient
implements
IWindowEventService
{
_serviceBrand
:
any
;
constructor
(
private
channel
:
IWindowEventChannel
)
{
}
private
_onNewWindowOpen
:
Event
<
number
>
=
eventFromCall
<
number
>
(
this
.
channel
,
'
event:onNewWindowOpen
'
);
get
onNewWindowOpen
():
Event
<
number
>
{
return
this
.
_onNewWindowOpen
;
}
private
_onWindowFocus
:
Event
<
number
>
=
eventFromCall
<
number
>
(
this
.
channel
,
'
event:onWindowFocus
'
);
get
onWindowFocus
():
Event
<
number
>
{
return
this
.
_onWindowFocus
;
}
}
\ No newline at end of file
src/vs/code/electron-main/main.ts
浏览文件 @
8f61b620
...
...
@@ -15,7 +15,6 @@ import { IWindowsMainService, WindowsManager } from 'vs/code/electron-main/windo
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
WindowsChannel
}
from
'
vs/platform/windows/common/windowsIpc
'
;
import
{
WindowsService
}
from
'
vs/platform/windows/electron-main/windowsService
'
;
import
{
WindowEventChannel
}
from
'
vs/code/common/windowsIpc
'
;
import
{
ILifecycleService
,
LifecycleService
}
from
'
vs/code/electron-main/lifecycle
'
;
import
{
VSCodeMenu
}
from
'
vs/code/electron-main/menus
'
;
import
{
IUpdateService
}
from
'
vs/platform/update/common/update
'
;
...
...
@@ -167,6 +166,9 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
const
instantiationService2
=
instantiationService
.
createChild
(
services
);
instantiationService2
.
invokeFunction
(
accessor
=>
{
// TODO@Joao: unfold this
windowsMainService
=
accessor
.
get
(
IWindowsMainService
);
// Register more Main IPC services
const
launchService
=
accessor
.
get
(
ILaunchService
);
const
launchChannel
=
new
LaunchChannel
(
launchService
);
...
...
@@ -184,12 +186,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
const
windowsService
=
accessor
.
get
(
IWindowsService
);
const
windowsChannel
=
new
WindowsChannel
(
windowsService
);
electronIpcServer
.
registerChannel
(
'
windows
'
,
windowsChannel
);
// TODO@Joao revisit this
// Register windowEvent
windowsMainService
=
accessor
.
get
(
IWindowsMainService
);
const
windowEventChannel
=
new
WindowEventChannel
(
windowsMainService
);
sharedProcess
.
done
(
client
=>
client
.
registerChannel
(
'
windowEvent
'
,
windowEventChannel
));
sharedProcess
.
done
(
client
=>
client
.
registerChannel
(
'
windows
'
,
windowsChannel
));
// Make sure we associate the program with the app user model id
// This will help Windows to associate the running program with
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
8f61b620
...
...
@@ -24,7 +24,6 @@ import { ILifecycleService } from 'vs/code/electron-main/lifecycle';
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ILogService
}
from
'
vs/code/electron-main/log
'
;
import
{
getPathLabel
}
from
'
vs/base/common/labels
'
;
import
{
IWindowEventService
}
from
'
vs/code/common/windows
'
;
import
{
createDecorator
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
CommonEvent
,
{
Emitter
,
once
}
from
'
vs/base/common/event
'
;
...
...
@@ -88,8 +87,6 @@ export interface IWindowsMainService {
// events
onWindowReady
:
CommonEvent
<
VSCodeWindow
>
;
onWindowClose
:
CommonEvent
<
number
>
;
onNewWindowOpen
:
CommonEvent
<
number
>
;
onWindowFocus
:
CommonEvent
<
number
>
;
onRecentPathsChange
:
CommonEvent
<
void
>
;
// methods
...
...
@@ -119,7 +116,7 @@ export interface IWindowsMainService {
toggleMenuBar
(
windowId
:
number
):
void
;
}
export
class
WindowsManager
implements
IWindowsMainService
,
IWindowEventService
{
export
class
WindowsManager
implements
IWindowsMainService
{
_serviceBrand
:
any
;
...
...
@@ -134,12 +131,6 @@ export class WindowsManager implements IWindowsMainService, IWindowEventService
private
initialUserEnv
:
platform
.
IProcessEnvironment
;
private
windowsState
:
IWindowsState
;
private
_onFocus
=
new
Emitter
<
number
>
();
onWindowFocus
:
CommonEvent
<
number
>
=
this
.
_onFocus
.
event
;
private
_onNewWindow
=
new
Emitter
<
number
>
();
onNewWindowOpen
:
CommonEvent
<
number
>
=
this
.
_onNewWindow
.
event
;
private
_onRecentPathsChange
=
new
Emitter
<
void
>
();
onRecentPathsChange
:
CommonEvent
<
void
>
=
this
.
_onRecentPathsChange
.
event
;
...
...
@@ -754,9 +745,7 @@ export class WindowsManager implements IWindowsMainService, IWindowEventService
vscodeWindow
.
win
.
on
(
'
unresponsive
'
,
()
=>
this
.
onWindowError
(
vscodeWindow
,
WindowError
.
UNRESPONSIVE
));
vscodeWindow
.
win
.
on
(
'
close
'
,
()
=>
this
.
onBeforeWindowClose
(
vscodeWindow
));
vscodeWindow
.
win
.
on
(
'
closed
'
,
()
=>
this
.
onWindowClosed
(
vscodeWindow
));
vscodeWindow
.
win
.
on
(
'
focus
'
,
()
=>
this
.
_onFocus
.
fire
(
vscodeWindow
.
id
));
this
.
_onNewWindow
.
fire
(
vscodeWindow
.
id
);
// Lifecycle
this
.
lifecycleService
.
registerWindow
(
vscodeWindow
);
}
...
...
src/vs/code/node/sharedProcessMain.ts
浏览文件 @
8f61b620
...
...
@@ -32,8 +32,9 @@ import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppen
import
{
ISharedProcessInitData
}
from
'
./sharedProcess
'
;
import
{
IChoiceService
}
from
'
vs/platform/message/common/message
'
;
import
{
ChoiceChannelClient
}
from
'
vs/platform/message/common/messageIpc
'
;
import
{
WindowEventChannelClient
}
from
'
vs/code/common/windowsIpc
'
;
import
{
IWindowEventService
,
ActiveWindowManager
}
from
'
vs/code/common/windows
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
WindowsChannelClient
}
from
'
vs/platform/windows/common/windowsIpc
'
;
import
{
ActiveWindowManager
}
from
'
vs/code/common/windows
'
;
function
quit
(
err
?:
Error
)
{
if
(
err
)
{
...
...
@@ -66,11 +67,11 @@ function main(server: Server, initData: ISharedProcessInitData): void {
services
.
set
(
IConfigurationService
,
new
SyncDescriptor
(
ConfigurationService
));
services
.
set
(
IRequestService
,
new
SyncDescriptor
(
RequestService
));
const
window
EventChannel
=
server
.
getChannel
(
'
windowEvent
'
,
{
route
:
()
=>
'
main
'
});
const
window
EventService
:
IWindowEventService
=
new
WindowEventChannelClient
(
windowEvent
Channel
);
services
.
set
(
IWindow
EventService
,
windowEvent
Service
);
const
window
sChannel
=
server
.
getChannel
(
'
windows
'
,
{
route
:
()
=>
'
main
'
});
const
window
sService
=
new
WindowsChannelClient
(
windows
Channel
);
services
.
set
(
IWindow
sService
,
windows
Service
);
const
activeWindowManager
=
new
ActiveWindowManager
(
window
Event
Service
);
const
activeWindowManager
=
new
ActiveWindowManager
(
window
s
Service
);
const
choiceChannel
=
server
.
getChannel
(
'
choice
'
,
{
route
:
()
=>
activeWindowManager
.
activeClientId
});
services
.
set
(
IChoiceService
,
new
ChoiceChannelClient
(
choiceChannel
));
...
...
src/vs/platform/windows/common/windows.ts
浏览文件 @
8f61b620
...
...
@@ -15,6 +15,7 @@ export interface IWindowsService {
_serviceBrand
:
any
;
onWindowOpen
:
Event
<
number
>
;
onWindowFocus
:
Event
<
number
>
;
openFileFolderPicker
(
windowId
:
number
,
forceNewWindow
?:
boolean
):
TPromise
<
void
>
;
...
...
src/vs/platform/windows/common/windowsIpc.ts
浏览文件 @
8f61b620
...
...
@@ -11,6 +11,7 @@ import { IChannel, eventToCall, eventFromCall } from 'vs/base/parts/ipc/common/i
import
{
IWindowsService
}
from
'
./windows
'
;
export
interface
IWindowsChannel
extends
IChannel
{
call
(
command
:
'
event:onWindowOpen
'
):
TPromise
<
number
>
;
call
(
command
:
'
event:onWindowFocus
'
):
TPromise
<
number
>
;
call
(
command
:
'
openFileFolderPicker
'
,
arg
:
[
number
,
boolean
]):
TPromise
<
void
>
;
call
(
command
:
'
openFilePicker
'
,
arg
:
[
number
,
boolean
,
string
]):
TPromise
<
void
>
;
...
...
@@ -42,14 +43,17 @@ export interface IWindowsChannel extends IChannel {
export
class
WindowsChannel
implements
IWindowsChannel
{
onWindowFocus
:
Event
<
number
>
;
private
onWindowOpen
:
Event
<
number
>
;
private
onWindowFocus
:
Event
<
number
>
;
constructor
(
private
service
:
IWindowsService
)
{
this
.
onWindowOpen
=
buffer
(
service
.
onWindowOpen
,
true
);
this
.
onWindowFocus
=
buffer
(
service
.
onWindowFocus
,
true
);
}
call
(
command
:
string
,
arg
?:
any
):
TPromise
<
any
>
{
switch
(
command
)
{
case
'
event:onWindowOpen
'
:
return
eventToCall
(
this
.
onWindowOpen
);
case
'
event:onWindowFocus
'
:
return
eventToCall
(
this
.
onWindowFocus
);
case
'
openFileFolderPicker
'
:
return
this
.
service
.
openFileFolderPicker
(
arg
[
0
],
arg
[
1
]);
case
'
openFilePicker
'
:
return
this
.
service
.
openFilePicker
(
arg
[
0
],
arg
[
1
],
arg
[
2
]);
...
...
@@ -87,6 +91,9 @@ export class WindowsChannelClient implements IWindowsService {
constructor
(
private
channel
:
IWindowsChannel
)
{
}
private
_onWindowOpen
:
Event
<
number
>
=
eventFromCall
<
number
>
(
this
.
channel
,
'
event:onWindowOpen
'
);
get
onWindowOpen
():
Event
<
number
>
{
return
this
.
_onWindowOpen
;
}
private
_onWindowFocus
:
Event
<
number
>
=
eventFromCall
<
number
>
(
this
.
channel
,
'
event:onWindowFocus
'
);
get
onWindowFocus
():
Event
<
number
>
{
return
this
.
_onWindowFocus
;
}
...
...
src/vs/platform/windows/electron-main/windowsService.ts
浏览文件 @
8f61b620
...
...
@@ -19,6 +19,7 @@ export class WindowsService implements IWindowsService {
_serviceBrand
:
any
;
onWindowOpen
:
Event
<
number
>
=
fromEventEmitter
(
app
,
'
browser-window-created
'
,
(
_
,
w
:
Electron
.
BrowserWindow
)
=>
w
.
id
);
onWindowFocus
:
Event
<
number
>
=
fromEventEmitter
(
app
,
'
browser-window-focus
'
,
(
_
,
w
:
Electron
.
BrowserWindow
)
=>
w
.
id
);
constructor
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录