Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
230f677e
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 搜索 >>
提交
230f677e
编写于
12月 16, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
window - more changes to ensure window is not out of display bounds (#86771)
上级
73fcde8b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
10 deletion
+25
-10
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+25
-10
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
230f677e
...
@@ -795,33 +795,48 @@ export class CodeWindow extends Disposable implements ICodeWindow {
...
@@ -795,33 +795,48 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}
}
// Single Monitor: be strict about x/y positioning
// Single Monitor: be strict about x/y positioning
// macOS & Linux: these OS seem to be pretty good in ensuring that a window is never outside of it's bounds.
// Windows: it is possible to have a window with a size that makes it fall out of the window. our strategy
// is to try as much as possible to keep the window in the monitor bounds. we are not as strict as
// macOS and Linux and allow the window to exceed the monitor bounds as long as the window is still
// some pixels (128) visible on the screen for the user to drag it back.
if
(
displays
.
length
===
1
)
{
if
(
displays
.
length
===
1
)
{
const
displayWorkingArea
=
this
.
getWorkingArea
(
displays
[
0
]);
const
displayWorkingArea
=
this
.
getWorkingArea
(
displays
[
0
]);
if
(
displayWorkingArea
)
{
if
(
displayWorkingArea
)
{
this
.
logService
.
trace
(
'
window#validateWindowState: 1 monitor working area
'
,
displayWorkingArea
);
this
.
logService
.
trace
(
'
window#validateWindowState: 1 monitor working area
'
,
displayWorkingArea
);
if
(
state
.
x
<
displayWorkingArea
.
x
)
{
if
(
state
.
x
<
displayWorkingArea
.
x
)
{
state
.
x
=
displayWorkingArea
.
x
;
// prevent window from falling out of the screen to the left
// prevent window from falling out of the screen to the left
state
.
x
=
displayWorkingArea
.
x
;
}
}
if
(
state
.
y
<
displayWorkingArea
.
y
)
{
if
(
state
.
y
<
displayWorkingArea
.
y
)
{
state
.
y
=
displayWorkingArea
.
y
;
// prevent window from falling out of the screen to the top
// prevent window from falling out of the screen to the top
state
.
y
=
displayWorkingArea
.
y
;
}
}
if
(
state
.
x
>
(
displayWorkingArea
.
x
+
displayWorkingArea
.
width
))
{
if
(
state
.
width
>
displayWorkingArea
.
width
)
{
state
.
x
=
displayWorkingArea
.
x
;
// prevent window from falling out of the screen to the right
// prevent window from exceeding display bounds width
state
.
width
=
displayWorkingArea
.
width
;
}
}
if
(
state
.
y
>
(
displayWorkingArea
.
y
+
displayWorkingArea
.
height
))
{
if
(
state
.
height
>
displayWorkingArea
.
height
)
{
state
.
y
=
displayWorkingArea
.
y
;
// prevent window from falling out of the screen to the bottom
// prevent window from exceeding display bounds height
state
.
height
=
displayWorkingArea
.
height
;
}
}
if
(
state
.
width
>
displayWorkingArea
.
width
)
{
if
(
state
.
x
>
(
displayWorkingArea
.
x
+
displayWorkingArea
.
width
-
128
))
{
state
.
width
=
displayWorkingArea
.
width
;
// prevent window from exceeding display bounds width
// prevent window from falling out of the screen to the right with
// 128px margin by positioning the window to the far right edge of
// the screen
state
.
x
=
displayWorkingArea
.
x
+
displayWorkingArea
.
width
-
state
.
width
;
}
}
if
(
state
.
height
>
displayWorkingArea
.
height
)
{
if
(
state
.
y
>
(
displayWorkingArea
.
y
+
displayWorkingArea
.
height
-
128
))
{
state
.
height
=
displayWorkingArea
.
height
;
// prevent window from exceeding display bounds height
// prevent window from falling out of the screen to the bottom with
// 128px margin by positioning the window to the far bottom edge of
// the screen
state
.
y
=
displayWorkingArea
.
y
+
displayWorkingArea
.
height
-
state
.
height
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录