Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3fc07e3f
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,发现更多精彩内容 >>
提交
3fc07e3f
编写于
12月 09, 2017
作者:
R
Ryan Adolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement button actions, make maximize icon change
上级
96c530ba
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
95 addition
and
6 deletion
+95
-6
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+3
-0
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+6
-1
src/vs/platform/windows/common/windowsIpc.ts
src/vs/platform/windows/common/windowsIpc.ts
+23
-0
src/vs/platform/windows/electron-browser/windowService.ts
src/vs/platform/windows/electron-browser/windowService.ts
+8
-0
src/vs/platform/windows/electron-main/windowsService.ts
src/vs/platform/windows/electron-main/windowsService.ts
+13
-1
src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css
...s/workbench/browser/parts/titlebar/media/titlebarpart.css
+2
-2
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+21
-2
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+19
-0
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
3fc07e3f
...
...
@@ -187,6 +187,9 @@ export class CodeWindow implements ICodeWindow {
});
}
this
.
_win
.
on
(
'
maximize
'
,
(
e
)
=>
app
.
emit
(
'
browser-window-maximize
'
,
e
,
this
.
_win
));
this
.
_win
.
on
(
'
unmaximize
'
,
(
e
)
=>
app
.
emit
(
'
browser-window-unmaximize
'
,
e
,
this
.
_win
));
if
(
isFullscreenOrMaximized
)
{
this
.
_win
.
maximize
();
...
...
src/vs/platform/windows/common/windows.ts
浏览文件 @
3fc07e3f
...
...
@@ -33,6 +33,8 @@ export interface IWindowsService {
onWindowOpen
:
Event
<
number
>
;
onWindowFocus
:
Event
<
number
>
;
onWindowBlur
:
Event
<
number
>
;
onWindowMaximize
:
Event
<
number
>
;
onWindowUnmaximize
:
Event
<
number
>
;
pickFileFolderAndOpen
(
options
:
INativeOpenDialogOptions
):
TPromise
<
void
>
;
pickFileAndOpen
(
options
:
INativeOpenDialogOptions
):
TPromise
<
void
>
;
...
...
@@ -55,6 +57,7 @@ export interface IWindowsService {
isMaximized
(
windowId
:
number
):
TPromise
<
boolean
>
;
maximizeWindow
(
windowId
:
number
):
TPromise
<
void
>
;
unmaximizeWindow
(
windowId
:
number
):
TPromise
<
void
>
;
minimizeWindow
(
windowId
:
number
):
TPromise
<
void
>
;
onWindowTitleDoubleClick
(
windowId
:
number
):
TPromise
<
void
>
;
setDocumentEdited
(
windowId
:
number
,
flag
:
boolean
):
TPromise
<
void
>
;
quit
():
TPromise
<
void
>
;
...
...
@@ -88,6 +91,7 @@ export interface IWindowService {
_serviceBrand
:
any
;
onDidChangeFocus
:
Event
<
boolean
>
;
onDidChangeMaximize
:
Event
<
boolean
>
;
getCurrentWindowId
():
number
;
pickFileFolderAndOpen
(
options
:
INativeOpenDialogOptions
):
TPromise
<
void
>
;
...
...
@@ -109,6 +113,7 @@ export interface IWindowService {
isMaximized
():
TPromise
<
boolean
>
;
maximizeWindow
():
TPromise
<
void
>
;
unmaximizeWindow
():
TPromise
<
void
>
;
minimizeWindow
():
TPromise
<
void
>
;
onWindowTitleDoubleClick
():
TPromise
<
void
>
;
showMessageBox
(
options
:
Electron
.
ShowMessageBoxOptions
):
number
;
showSaveDialog
(
options
:
Electron
.
SaveDialogOptions
,
callback
?:
(
fileName
:
string
)
=>
void
):
string
;
...
...
@@ -223,4 +228,4 @@ export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
perfStartTime
?:
number
;
perfAppReady
?:
number
;
perfWindowLoadTime
?:
number
;
}
\ No newline at end of file
}
src/vs/platform/windows/common/windowsIpc.ts
浏览文件 @
3fc07e3f
...
...
@@ -36,6 +36,7 @@ export interface IWindowsChannel extends IChannel {
call
(
command
:
'
isMaximized
'
,
arg
:
number
):
TPromise
<
boolean
>
;
call
(
command
:
'
maximizeWindow
'
,
arg
:
number
):
TPromise
<
void
>
;
call
(
command
:
'
unmaximizeWindow
'
,
arg
:
number
):
TPromise
<
void
>
;
call
(
command
:
'
minimizeWindow
'
,
arg
:
number
):
TPromise
<
void
>
;
call
(
command
:
'
onWindowTitleDoubleClick
'
,
arg
:
number
):
TPromise
<
void
>
;
call
(
command
:
'
setDocumentEdited
'
,
arg
:
[
number
,
boolean
]):
TPromise
<
void
>
;
call
(
command
:
'
quit
'
):
TPromise
<
void
>
;
...
...
@@ -59,11 +60,15 @@ export class WindowsChannel implements IWindowsChannel {
private
onWindowOpen
:
Event
<
number
>
;
private
onWindowFocus
:
Event
<
number
>
;
private
onWindowBlur
:
Event
<
number
>
;
private
onWindowMaximize
:
Event
<
number
>
;
private
onWindowUnmaximize
:
Event
<
number
>
;
constructor
(
private
service
:
IWindowsService
)
{
this
.
onWindowOpen
=
buffer
(
service
.
onWindowOpen
,
true
);
this
.
onWindowFocus
=
buffer
(
service
.
onWindowFocus
,
true
);
this
.
onWindowBlur
=
buffer
(
service
.
onWindowBlur
,
true
);
this
.
onWindowMaximize
=
buffer
(
service
.
onWindowMaximize
,
true
);
this
.
onWindowUnmaximize
=
buffer
(
service
.
onWindowUnmaximize
,
true
);
}
call
(
command
:
string
,
arg
?:
any
):
TPromise
<
any
>
{
...
...
@@ -71,6 +76,8 @@ export class WindowsChannel implements IWindowsChannel {
case
'
event:onWindowOpen
'
:
return
eventToCall
(
this
.
onWindowOpen
);
case
'
event:onWindowFocus
'
:
return
eventToCall
(
this
.
onWindowFocus
);
case
'
event:onWindowBlur
'
:
return
eventToCall
(
this
.
onWindowBlur
);
case
'
event:onWindowMaximize
'
:
return
eventToCall
(
this
.
onWindowMaximize
);
case
'
event:onWindowUnmaximize
'
:
return
eventToCall
(
this
.
onWindowUnmaximize
);
case
'
pickFileFolderAndOpen
'
:
return
this
.
service
.
pickFileFolderAndOpen
(
arg
);
case
'
pickFileAndOpen
'
:
return
this
.
service
.
pickFileAndOpen
(
arg
);
case
'
pickFolderAndOpen
'
:
return
this
.
service
.
pickFolderAndOpen
(
arg
);
...
...
@@ -92,6 +99,7 @@ export class WindowsChannel implements IWindowsChannel {
case
'
isMaximized
'
:
return
this
.
service
.
isMaximized
(
arg
);
case
'
maximizeWindow
'
:
return
this
.
service
.
maximizeWindow
(
arg
);
case
'
unmaximizeWindow
'
:
return
this
.
service
.
unmaximizeWindow
(
arg
);
case
'
minimizeWindow
'
:
return
this
.
service
.
minimizeWindow
(
arg
);
case
'
onWindowTitleDoubleClick
'
:
return
this
.
service
.
onWindowTitleDoubleClick
(
arg
);
case
'
setDocumentEdited
'
:
return
this
.
service
.
setDocumentEdited
(
arg
[
0
],
arg
[
1
]);
case
'
openWindow
'
:
return
this
.
service
.
openWindow
(
arg
[
0
],
arg
[
1
]);
...
...
@@ -127,6 +135,13 @@ export class WindowsChannelClient implements IWindowsService {
private
_onWindowBlur
:
Event
<
number
>
=
eventFromCall
<
number
>
(
this
.
channel
,
'
event:onWindowBlur
'
);
get
onWindowBlur
():
Event
<
number
>
{
return
this
.
_onWindowBlur
;
}
private
_onWindowMaximize
:
Event
<
number
>
=
eventFromCall
<
number
>
(
this
.
channel
,
'
event:onWindowMaximize
'
);
get
onWindowMaximize
():
Event
<
number
>
{
return
this
.
_onWindowMaximize
;
}
private
_onWindowUnmaximize
:
Event
<
number
>
=
eventFromCall
<
number
>
(
this
.
channel
,
'
event:onWindowUnmaximize
'
);
get
onWindowUnmaximize
():
Event
<
number
>
{
return
this
.
_onWindowUnmaximize
;
}
pickFileFolderAndOpen
(
options
:
INativeOpenDialogOptions
):
TPromise
<
void
>
{
return
this
.
channel
.
call
(
'
pickFileFolderAndOpen
'
,
options
);
}
...
...
@@ -211,6 +226,14 @@ export class WindowsChannelClient implements IWindowsService {
return
this
.
channel
.
call
(
'
unmaximizeWindow
'
,
windowId
);
}
minimizeWindow
(
windowId
:
number
):
TPromise
<
void
>
{
return
this
.
channel
.
call
(
'
minimizeWindow
'
,
windowId
);
}
addMaximizeListener
(
windowId
:
number
,
listener
:
(
maximized
:
boolean
)
=>
void
):
TPromise
<
void
>
{
return
TPromise
.
as
(
null
);
}
onWindowTitleDoubleClick
(
windowId
:
number
):
TPromise
<
void
>
{
return
this
.
channel
.
call
(
'
onWindowTitleDoubleClick
'
,
windowId
);
}
...
...
src/vs/platform/windows/electron-browser/windowService.ts
浏览文件 @
3fc07e3f
...
...
@@ -14,6 +14,7 @@ import { IRecentlyOpened } from "vs/platform/history/common/history";
export
class
WindowService
implements
IWindowService
{
readonly
onDidChangeFocus
:
Event
<
boolean
>
;
readonly
onDidChangeMaximize
:
Event
<
boolean
>
;
_serviceBrand
:
any
;
...
...
@@ -23,7 +24,10 @@ export class WindowService implements IWindowService {
)
{
const
onThisWindowFocus
=
mapEvent
(
filterEvent
(
windowsService
.
onWindowFocus
,
id
=>
id
===
windowId
),
_
=>
true
);
const
onThisWindowBlur
=
mapEvent
(
filterEvent
(
windowsService
.
onWindowBlur
,
id
=>
id
===
windowId
),
_
=>
false
);
const
onThisWindowMaximize
=
mapEvent
(
filterEvent
(
windowsService
.
onWindowMaximize
,
id
=>
id
===
windowId
),
_
=>
true
);
const
onThisWindowUnmaximize
=
mapEvent
(
filterEvent
(
windowsService
.
onWindowUnmaximize
,
id
=>
id
===
windowId
),
_
=>
false
);
this
.
onDidChangeFocus
=
any
(
onThisWindowFocus
,
onThisWindowBlur
);
this
.
onDidChangeMaximize
=
any
(
onThisWindowMaximize
,
onThisWindowUnmaximize
);
}
getCurrentWindowId
():
number
{
...
...
@@ -108,6 +112,10 @@ export class WindowService implements IWindowService {
return
this
.
windowsService
.
unmaximizeWindow
(
this
.
windowId
);
}
minimizeWindow
():
TPromise
<
void
>
{
return
this
.
windowsService
.
minimizeWindow
(
this
.
windowId
);
}
onWindowTitleDoubleClick
():
TPromise
<
void
>
{
return
this
.
windowsService
.
onWindowTitleDoubleClick
(
this
.
windowId
);
}
...
...
src/vs/platform/windows/electron-main/windowsService.ts
浏览文件 @
3fc07e3f
...
...
@@ -29,6 +29,8 @@ export class WindowsService implements IWindowsService, IDisposable {
readonly
onWindowOpen
:
Event
<
number
>
=
fromEventEmitter
(
app
,
'
browser-window-created
'
,
(
_
,
w
:
Electron
.
BrowserWindow
)
=>
w
.
id
);
readonly
onWindowFocus
:
Event
<
number
>
=
fromEventEmitter
(
app
,
'
browser-window-focus
'
,
(
_
,
w
:
Electron
.
BrowserWindow
)
=>
w
.
id
);
readonly
onWindowBlur
:
Event
<
number
>
=
fromEventEmitter
(
app
,
'
browser-window-blur
'
,
(
_
,
w
:
Electron
.
BrowserWindow
)
=>
w
.
id
);
readonly
onWindowMaximize
:
Event
<
number
>
=
fromEventEmitter
(
app
,
'
browser-window-maximize
'
,
(
_
,
w
:
Electron
.
BrowserWindow
)
=>
w
.
id
);
readonly
onWindowUnmaximize
:
Event
<
number
>
=
fromEventEmitter
(
app
,
'
browser-window-unmaximize
'
,
(
_
,
w
:
Electron
.
BrowserWindow
)
=>
w
.
id
);
constructor
(
private
sharedProcess
:
ISharedProcess
,
...
...
@@ -242,6 +244,16 @@ export class WindowsService implements IWindowsService, IDisposable {
return
TPromise
.
as
(
null
);
}
minimizeWindow
(
windowId
:
number
):
TPromise
<
void
>
{
const
codeWindow
=
this
.
windowsMainService
.
getWindowById
(
windowId
);
if
(
codeWindow
)
{
codeWindow
.
win
.
minimize
();
}
return
TPromise
.
as
(
null
);
}
onWindowTitleDoubleClick
(
windowId
:
number
):
TPromise
<
void
>
{
const
codeWindow
=
this
.
windowsMainService
.
getWindowById
(
windowId
);
...
...
@@ -365,4 +377,4 @@ export class WindowsService implements IWindowsService, IDisposable {
dispose
():
void
{
this
.
disposables
=
dispose
(
this
.
disposables
);
}
}
\ No newline at end of file
}
src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css
浏览文件 @
3fc07e3f
...
...
@@ -54,7 +54,7 @@
-webkit-app-region
:
no-drag
;
}
.window-maximize
{
.window-
un
maximize
{
display
:
none
;
}
...
...
@@ -69,7 +69,7 @@
}
.monaco-workbench.windows
>
.part.titlebar.light
>
.window-icon
:hover
{
background-color
:
rgba
(
0
,
0
,
0
,
0.1
);
background-color
:
rgba
(
0
,
0
,
0
,
0.1
);
}
.monaco-workbench.windows
>
.part.titlebar.titlebar
>
.window-close
:hover
{
...
...
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
浏览文件 @
3fc07e3f
...
...
@@ -277,18 +277,21 @@ export class TitlebarPart extends Part implements ITitleService {
};
if
(
isWindows
)
{
// The svgs and styles for the titlebar come from the electron-titlebar-windows package
$
(
this
.
titleContainer
).
div
({
class
:
'
window-icon
'
},
(
builder
)
=>
{
const
svg
=
$svg
(
'
svg
'
,
{
x
:
0
,
y
:
0
,
viewBox
:
'
0 0 10 1
'
});
svg
.
appendChild
(
$svg
(
'
rect
'
,
{
fill
:
'
currentColor
'
,
width
:
10
,
height
:
1
}));
builder
.
getHTMLElement
().
appendChild
(
svg
);
}).
on
(
DOM
.
EventType
.
CLICK
,
()
=>
{
this
.
windowService
.
minimizeWindow
().
then
(
null
,
errors
.
onUnexpectedError
);;
});
$
(
this
.
titleContainer
).
div
({
class
:
'
window-icon
'
},
(
builder
)
=>
{
const
svgf
=
$svg
(
'
svg
'
,
{
class
:
'
window-
fullscreen
'
,
x
:
0
,
y
:
0
,
viewBox
:
'
0 0 10 10
'
});
const
svgf
=
$svg
(
'
svg
'
,
{
class
:
'
window-
maximize
'
,
x
:
0
,
y
:
0
,
viewBox
:
'
0 0 10 10
'
});
svgf
.
appendChild
(
$svg
(
'
path
'
,
{
fill
:
'
currentColor
'
,
d
:
'
M 0 0 L 0 10 L 10 10 L 10 0 L 0 0 z M 1 1 L 9 1 L 9 9 L 1 9 L 1 1 z
'
}));
builder
.
getHTMLElement
().
appendChild
(
svgf
);
const
svgm
=
$svg
(
'
svg
'
,
{
class
:
'
window-maximize
'
,
x
:
0
,
y
:
0
,
viewBox
:
'
0 0 10 10
'
});
const
svgm
=
$svg
(
'
svg
'
,
{
class
:
'
window-
un
maximize
'
,
x
:
0
,
y
:
0
,
viewBox
:
'
0 0 10 10
'
});
const
mask
=
$svg
(
'
mask
'
,
{
id
:
'
Mask
'
});
mask
.
appendChild
(
$svg
(
'
rect
'
,
{
fill
:
'
#fff
'
,
width
:
10
,
height
:
10
}));
mask
.
appendChild
(
$svg
(
'
path
'
,
{
fill
:
'
#000
'
,
d
:
'
M 3 1 L 9 1 L 9 7 L 8 7 L 8 2 L 3 2 L 3 1 z
'
}));
...
...
@@ -296,13 +299,29 @@ export class TitlebarPart extends Part implements ITitleService {
svgm
.
appendChild
(
mask
);
svgm
.
appendChild
(
$svg
(
'
path
'
,
{
fill
:
'
currentColor
'
,
d
:
'
M 2 0 L 10 0 L 10 8 L 8 8 L 8 10 L 0 10 L 0 2 L 2 2 L 2 0 z
'
,
mask
:
'
url(#Mask)
'
}));
builder
.
getHTMLElement
().
appendChild
(
svgm
);
}).
on
(
DOM
.
EventType
.
CLICK
,
()
=>
{
this
.
windowService
.
isMaximized
().
then
((
maximized
)
=>
{
if
(
maximized
)
{
return
this
.
windowService
.
unmaximizeWindow
();
}
else
{
return
this
.
windowService
.
maximizeWindow
();
}
}).
then
(
null
,
errors
.
onUnexpectedError
);
});
$
(
this
.
titleContainer
).
div
({
class
:
'
window-icon window-close
'
},
(
builder
)
=>
{
const
svg
=
$svg
(
'
svg
'
,
{
x
:
'
0
'
,
y
:
'
0
'
,
viewBox
:
'
0 0 10 10
'
});
svg
.
appendChild
(
$svg
(
'
polygon
'
,
{
fill
:
'
currentColor
'
,
points
:
'
10,1 9,0 5,4 1,0 0,1 4,5 0,9 1,10 5,6 9,10 10,9 6,5
'
}));
builder
.
getHTMLElement
().
appendChild
(
svg
);
}).
on
(
DOM
.
EventType
.
CLICK
,
()
=>
{
this
.
windowService
.
closeWindow
().
then
(
null
,
errors
.
onUnexpectedError
);;
});
this
.
windowService
.
onDidChangeMaximize
((
mazimized
)
=>
{
console
.
log
(
'
change!
'
);
$
(
this
.
titleContainer
).
select
(
'
.window-maximize
'
).
display
(
mazimized
?
'
none
'
:
'
inline
'
);
$
(
this
.
titleContainer
).
select
(
'
.window-unmaximize
'
).
display
(
mazimized
?
'
inline
'
:
'
none
'
);
},
this
);
}
return
this
.
titleContainer
;
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
3fc07e3f
...
...
@@ -841,6 +841,7 @@ export class TestWindowService implements IWindowService {
public
_serviceBrand
:
any
;
onDidChangeFocus
:
Event
<
boolean
>
;
onDidChangeMaximize
:
Event
<
boolean
>
;
isFocused
():
TPromise
<
boolean
>
{
return
TPromise
.
as
(
false
);
...
...
@@ -922,6 +923,14 @@ export class TestWindowService implements IWindowService {
return
TPromise
.
as
(
void
0
);
}
minimizeWindow
():
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
}
addMaximizeListener
(
listener
:
(
maximized
:
boolean
)
=>
void
):
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
}
onWindowTitleDoubleClick
():
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
}
...
...
@@ -981,6 +990,8 @@ export class TestWindowsService implements IWindowsService {
onWindowOpen
:
Event
<
number
>
;
onWindowFocus
:
Event
<
number
>
;
onWindowBlur
:
Event
<
number
>
;
onWindowMaximize
:
Event
<
number
>
;
onWindowUnmaximize
:
Event
<
number
>
;
isFocused
(
windowId
:
number
):
TPromise
<
boolean
>
{
return
TPromise
.
as
(
false
);
...
...
@@ -1066,6 +1077,14 @@ export class TestWindowsService implements IWindowsService {
return
TPromise
.
as
(
void
0
);
}
minimizeWindow
(
windowId
:
number
):
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
}
addMaximizeListener
(
windowId
:
number
,
listener
:
(
maximized
:
boolean
)
=>
void
):
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
}
onWindowTitleDoubleClick
(
windowId
:
number
):
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录