Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1c454ad2
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1c454ad2
编写于
5月 22, 2012
作者:
D
dcherepanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7160293: [macosx] FileDialog appears on secondary display
Reviewed-by: art, bae
上级
5821288d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
40 addition
and
52 deletion
+40
-52
src/macosx/classes/sun/awt/CGraphicsEnvironment.java
src/macosx/classes/sun/awt/CGraphicsEnvironment.java
+4
-0
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+7
-17
src/macosx/classes/sun/lwawt/PlatformWindow.java
src/macosx/classes/sun/lwawt/PlatformWindow.java
+2
-2
src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
...cosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
+3
-4
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+13
-8
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+11
-21
未找到文件。
src/macosx/classes/sun/awt/CGraphicsEnvironment.java
浏览文件 @
1c454ad2
...
@@ -181,6 +181,10 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
...
@@ -181,6 +181,10 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
return
devices
.
values
().
toArray
(
new
CGraphicsDevice
[
devices
.
values
().
size
()]);
return
devices
.
values
().
toArray
(
new
CGraphicsDevice
[
devices
.
values
().
size
()]);
}
}
public
synchronized
GraphicsDevice
getScreenDevice
(
int
displayID
)
{
return
devices
.
get
(
displayID
);
}
@Override
@Override
protected
synchronized
int
getNumScreens
()
{
protected
synchronized
int
getNumScreens
()
{
return
devices
.
size
();
return
devices
.
size
();
...
...
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
1c454ad2
...
@@ -68,7 +68,7 @@ public class LWWindowPeer
...
@@ -68,7 +68,7 @@ public class LWWindowPeer
private
Insets
insets
=
new
Insets
(
0
,
0
,
0
,
0
);
private
Insets
insets
=
new
Insets
(
0
,
0
,
0
,
0
);
private
int
screenOn
=
-
1
;
private
GraphicsDevice
graphicsDevice
;
private
GraphicsConfiguration
graphicsConfig
;
private
GraphicsConfiguration
graphicsConfig
;
private
SurfaceData
surfaceData
;
private
SurfaceData
surfaceData
;
...
@@ -868,17 +868,6 @@ public class LWWindowPeer
...
@@ -868,17 +868,6 @@ public class LWWindowPeer
return
0
;
return
0
;
}
}
private
static
GraphicsConfiguration
getScreenGraphicsConfig
(
int
screen
)
{
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsDevice
[]
gds
=
ge
.
getScreenDevices
();
if
(
screen
>=
gds
.
length
)
{
// This could happen during device addition/removal. Use
// the default screen device in this case
return
ge
.
getDefaultScreenDevice
().
getDefaultConfiguration
();
}
return
gds
[
screen
].
getDefaultConfiguration
();
}
/*
/*
* This method is called when window's graphics config is changed from
* This method is called when window's graphics config is changed from
* the app code (e.g. when the window is made non-opaque) or when
* the app code (e.g. when the window is made non-opaque) or when
...
@@ -893,7 +882,7 @@ public class LWWindowPeer
...
@@ -893,7 +882,7 @@ public class LWWindowPeer
}
}
// If window's graphics config is changed from the app code, the
// If window's graphics config is changed from the app code, the
// config correspond to the same device as before; when the window
// config correspond to the same device as before; when the window
// is moved by user,
screenOn
is updated in checkIfOnNewScreen().
// is moved by user,
graphicsDevice
is updated in checkIfOnNewScreen().
// In either case, there's nothing to do with screenOn here
// In either case, there's nothing to do with screenOn here
graphicsConfig
=
gc
;
graphicsConfig
=
gc
;
}
}
...
@@ -902,16 +891,17 @@ public class LWWindowPeer
...
@@ -902,16 +891,17 @@ public class LWWindowPeer
}
}
private
void
checkIfOnNewScreen
()
{
private
void
checkIfOnNewScreen
()
{
int
windowScreen
=
platformWindow
.
getScreenImOn
();
GraphicsDevice
newGraphicsDevice
=
platformWindow
.
getGraphicsDevice
();
synchronized
(
getStateLock
())
{
synchronized
(
getStateLock
())
{
if
(
windowScreen
==
screenOn
)
{
if
(
graphicsDevice
==
newGraphicsDevice
)
{
return
;
return
;
}
}
screenOn
=
windowScreen
;
graphicsDevice
=
newGraphicsDevice
;
}
}
// TODO: DisplayChangedListener stuff
// TODO: DisplayChangedListener stuff
final
GraphicsConfiguration
newGC
=
getScreenGraphicsConfig
(
windowScreen
);
final
GraphicsConfiguration
newGC
=
newGraphicsDevice
.
getDefaultConfiguration
();
if
(!
setGraphicsConfig
(
newGC
))
return
;
if
(!
setGraphicsConfig
(
newGC
))
return
;
SunToolkit
.
executeOnEventHandlerThread
(
getTarget
(),
new
Runnable
()
{
SunToolkit
.
executeOnEventHandlerThread
(
getTarget
(),
new
Runnable
()
{
...
...
src/macosx/classes/sun/lwawt/PlatformWindow.java
浏览文件 @
1c454ad2
...
@@ -67,9 +67,9 @@ public interface PlatformWindow {
...
@@ -67,9 +67,9 @@ public interface PlatformWindow {
public
void
setBounds
(
int
x
,
int
y
,
int
w
,
int
h
);
public
void
setBounds
(
int
x
,
int
y
,
int
w
,
int
h
);
/*
/*
* Returns the
screen number
where the window is.
* Returns the
graphics device
where the window is.
*/
*/
public
int
getScreenImOn
();
public
GraphicsDevice
getGraphicsDevice
();
/*
/*
* Returns the location of the window.
* Returns the location of the window.
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
浏览文件 @
1c454ad2
...
@@ -86,11 +86,10 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
...
@@ -86,11 +86,10 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
}
}
@Override
@Override
public
int
getScreenImOn
()
{
public
GraphicsDevice
getGraphicsDevice
()
{
// REMIND: return the main screen for the initial implementation
// REMIND: return the main screen for the initial implementation
CGraphicsConfig
gc
=
(
CGraphicsConfig
)
peer
.
getGraphicsConfiguration
();
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
CGraphicsDevice
device
=
gc
.
getDevice
();
return
ge
.
getDefaultScreenDevice
();
return
device
.
getCoreGraphicsScreen
();
}
}
@Override
@Override
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
1c454ad2
...
@@ -64,7 +64,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -64,7 +64,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private
static
native
void
nativeSetEnabled
(
long
nsWindowPtr
,
boolean
isEnabled
);
private
static
native
void
nativeSetEnabled
(
long
nsWindowPtr
,
boolean
isEnabled
);
private
static
native
void
nativeSynthesizeMouseEnteredExitedEvents
(
long
nsWindowPtr
);
private
static
native
void
nativeSynthesizeMouseEnteredExitedEvents
(
long
nsWindowPtr
);
private
static
native
int
nativeGet
ScreenNSWindowIsOn
_AppKitThread
(
long
nsWindowPtr
);
private
static
native
int
nativeGet
NSWindowDisplayID
_AppKitThread
(
long
nsWindowPtr
);
// Loger to report issues happened during execution but that do not affect functionality
// Loger to report issues happened during execution but that do not affect functionality
private
static
final
PlatformLogger
logger
=
PlatformLogger
.
getLogger
(
"sun.lwawt.macosx.CPlatformWindow"
);
private
static
final
PlatformLogger
logger
=
PlatformLogger
.
getLogger
(
"sun.lwawt.macosx.CPlatformWindow"
);
...
@@ -452,13 +452,18 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -452,13 +452,18 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
return
new
Point
(
nativeBounds
.
x
,
nativeBounds
.
y
);
return
new
Point
(
nativeBounds
.
x
,
nativeBounds
.
y
);
}
}
@Override
// PlatformWindow
@Override
public
int
getScreenImOn
()
{
public
GraphicsDevice
getGraphicsDevice
()
{
// REMIND: we could also acquire screenID from the
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
// graphicsConfig.getDevice().getCoreGraphicsScreen()
CGraphicsEnvironment
cge
=
(
CGraphicsEnvironment
)
ge
;
// which might look a bit less natural but don't
int
displayID
=
nativeGetNSWindowDisplayID_AppKitThread
(
getNSWindowPtr
());
// require new native accessor.
GraphicsDevice
gd
=
cge
.
getScreenDevice
(
displayID
);
return
nativeGetScreenNSWindowIsOn_AppKitThread
(
getNSWindowPtr
());
if
(
gd
==
null
)
{
// this could possibly happen during device removal
// use the default screen device in this case
gd
=
ge
.
getDefaultScreenDevice
();
}
return
gd
;
}
}
@Override
// PlatformWindow
@Override
// PlatformWindow
...
...
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
1c454ad2
...
@@ -1080,38 +1080,28 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou
...
@@ -1080,38 +1080,28 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou
/*
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeGet
ScreenNSWindowIsOn
_AppKitThread
* Method: nativeGet
DisplayID
_AppKitThread
* Signature: (J)I
* Signature: (J)I
*/
*/
JNIEXPORT
jint
JNICALL
Java_sun_lwawt_macosx_CPlatformWindow_nativeGetScreenNSWindowIsOn_1AppKitThread
JNIEXPORT
jint
JNICALL
Java_sun_lwawt_macosx_CPlatformWindow_nativeGetNSWindowDisplayID_1AppKitThread
(
JNIEnv
*
env
,
jclass
clazz
,
jlong
windowPtr
)
(
JNIEnv
*
env
,
jclass
clazz
,
jlong
windowPtr
)
{
{
jint
index
=
-
1
;
jint
ret
;
// CGDirectDisplayID
JNF_COCOA_ENTER
(
env
);
JNF_COCOA_ENTER
(
env
);
AWT_ASSERT_APPKIT_THREAD
;
AWT_ASSERT_APPKIT_THREAD
;
NSWindow
*
nsWindow
=
OBJC
(
windowPtr
);
NSWindow
*
window
=
OBJC
(
windowPtr
);
NSScreen
*
screen
=
[
nsWindow
screen
];
NSScreen
*
screen
=
[
window
screen
];
NSDictionary
*
deviceDescription
=
[
screen
deviceDescription
];
//+++gdb NOTE: This is using a linear search of the screens. If it should
NSNumber
*
displayID
=
[
deviceDescription
objectForKey
:
@"NSScreenNumber"
];
// prove to be a bottleneck, this can definitely be improved. However,
ret
=
(
jint
)[
displayID
intValue
];
// many screens should prove to be the exception, rather than the rule.
NSArray
*
screens
=
[
NSScreen
screens
];
NSUInteger
i
;
for
(
i
=
0
;
i
<
[
screens
count
];
i
++
)
{
if
([[
screens
objectAtIndex
:
i
]
isEqualTo
:
screen
])
{
index
=
i
;
break
;
}
}
JNF_COCOA_EXIT
(
env
);
JNF_COCOA_EXIT
(
env
);
return
1
;
}
return
ret
;
}
/*
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Class: sun_lwawt_macosx_CPlatformWindow
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录