Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
b158d152
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看板
提交
b158d152
编写于
5月 17, 2012
作者:
A
ant
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7145768: [macosx] Regression: failure in b11 of ModalDialogInFocusEventTest
Summary: forward port from 7u4 Reviewed-by: art
上级
a60768a9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
57 addition
and
15 deletion
+57
-15
src/macosx/classes/sun/lwawt/LWComponentPeer.java
src/macosx/classes/sun/lwawt/LWComponentPeer.java
+38
-2
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+19
-13
未找到文件。
src/macosx/classes/sun/lwawt/LWComponentPeer.java
浏览文件 @
b158d152
...
...
@@ -56,6 +56,8 @@ import sun.java2d.SunGraphics2D;
import
sun.java2d.opengl.OGLRenderQueue
;
import
sun.java2d.pipe.Region
;
import
sun.util.logging.PlatformLogger
;
import
javax.swing.JComponent
;
import
javax.swing.SwingUtilities
;
import
javax.swing.RepaintManager
;
...
...
@@ -65,7 +67,10 @@ import sun.lwawt.macosx.CDropTarget;
import
com.sun.java.swing.SwingUtilities3
;
public
abstract
class
LWComponentPeer
<
T
extends
Component
,
D
extends
JComponent
>
implements
ComponentPeer
,
DropTargetPeer
{
implements
ComponentPeer
,
DropTargetPeer
{
private
static
final
PlatformLogger
focusLog
=
PlatformLogger
.
getLogger
(
"sun.lwawt.focus.LWComponentPeer"
);
// State lock is to be used for modifications to this
// peer's fields (e.g. bounds, background, font, etc.)
// It should be the last lock in the lock chain
...
...
@@ -885,7 +890,13 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
@Override
public
boolean
requestFocus
(
Component
lightweightChild
,
boolean
temporary
,
boolean
focusedWindowChangeAllowed
,
long
time
,
CausedFocusEvent
.
Cause
cause
)
{
CausedFocusEvent
.
Cause
cause
)
{
if
(
focusLog
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
focusLog
.
finest
(
"lightweightChild="
+
lightweightChild
+
", temporary="
+
temporary
+
", focusedWindowChangeAllowed="
+
focusedWindowChangeAllowed
+
", time= "
+
time
+
", cause="
+
cause
);
}
if
(
LWKeyboardFocusManagerPeer
.
getInstance
(
getAppContext
()).
processSynchronousLightweightTransfer
(
getTarget
(),
lightweightChild
,
temporary
,
focusedWindowChangeAllowed
,
time
))
{
...
...
@@ -901,19 +912,44 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
case
LWKeyboardFocusManagerPeer
.
SNFH_SUCCESS_PROCEED
:
Window
parentWindow
=
SunToolkit
.
getContainingWindow
(
getTarget
());
if
(
parentWindow
==
null
)
{
focusLog
.
fine
(
"request rejected, parentWindow is null"
);
LWKeyboardFocusManagerPeer
.
removeLastFocusRequest
(
getTarget
());
return
false
;
}
LWWindowPeer
parentPeer
=
(
LWWindowPeer
)
parentWindow
.
getPeer
();
if
(
parentPeer
==
null
)
{
focusLog
.
fine
(
"request rejected, parentPeer is null"
);
LWKeyboardFocusManagerPeer
.
removeLastFocusRequest
(
getTarget
());
return
false
;
}
// A fix for 7145768. Ensure the parent window is currently natively focused.
// The more evident place to perform this check is in KFM.shouldNativelyFocusHeavyweight,
// however that is the shared code and this particular problem's reproducibility has
// platform specifics. So, it was decided to narrow down the fix to lwawt (OSX) in
// current release. TODO: consider fixing it in the shared code.
if
(!
focusedWindowChangeAllowed
)
{
LWWindowPeer
decoratedPeer
=
parentPeer
.
isSimpleWindow
()
?
LWWindowPeer
.
getOwnerFrameDialog
(
parentPeer
)
:
parentPeer
;
if
(
decoratedPeer
==
null
||
!
decoratedPeer
.
getPlatformWindow
().
isActive
())
{
if
(
focusLog
.
isLoggable
(
PlatformLogger
.
FINE
))
{
focusLog
.
fine
(
"request rejected, focusedWindowChangeAllowed==false, "
+
"decoratedPeer is inactive: "
+
decoratedPeer
);
}
LWKeyboardFocusManagerPeer
.
removeLastFocusRequest
(
getTarget
());
return
false
;
}
}
boolean
res
=
parentPeer
.
requestWindowFocus
(
cause
);
// If parent window can be made focused and has been made focused (synchronously)
// then we can proceed with children, otherwise we retreat
if
(!
res
||
!
parentWindow
.
isFocused
())
{
if
(
focusLog
.
isLoggable
(
PlatformLogger
.
FINE
))
{
focusLog
.
fine
(
"request rejected, res= "
+
res
+
", parentWindow.isFocused()="
+
parentWindow
.
isFocused
());
}
LWKeyboardFocusManagerPeer
.
removeLastFocusRequest
(
getTarget
());
return
false
;
}
...
...
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
b158d152
...
...
@@ -50,7 +50,7 @@ public class LWWindowPeer
EMBEDDEDFRAME
}
private
static
final
sun
.
util
.
logging
.
PlatformLogger
focusLog
=
PlatformLogger
.
getLogger
(
"sun.lwawt.focus.LWWindowPeer"
);
private
static
final
PlatformLogger
focusLog
=
PlatformLogger
.
getLogger
(
"sun.lwawt.focus.LWWindowPeer"
);
private
PlatformWindow
platformWindow
;
...
...
@@ -245,15 +245,17 @@ public class LWWindowPeer
getInstance
(
getAppContext
());
if
(
visible
)
{
updateFocusableWindowState
();
changeFocusedWindow
(
true
,
true
);
if
(!
getTarget
().
isAutoRequestFocus
())
{
return
;
}
else
{
requestWindowFocus
(
CausedFocusEvent
.
Cause
.
ACTIVATION
);
}
// Focus the owner in case this window is focused.
}
else
if
(
manager
.
getCurrentFocusedWindow
()
==
getTarget
())
{
// Transfer focus to the owner.
LWWindowPeer
owner
=
getOwnerFrameDialog
(
LWWindowPeer
.
this
);
if
(
owner
!=
null
)
{
// KFM will do all the rest.
owner
.
changeFocusedWindow
(
true
,
false
);
owner
.
requestWindowFocus
(
CausedFocusEvent
.
Cause
.
ACTIVATION
);
}
}
}
...
...
@@ -619,7 +621,7 @@ public class LWWindowPeer
}
public
void
notifyActivation
(
boolean
activation
)
{
changeFocusedWindow
(
activation
,
false
);
changeFocusedWindow
(
activation
);
}
// MouseDown in non-client area
...
...
@@ -1065,6 +1067,10 @@ public class LWWindowPeer
return
lastMouseEventPeer
;
}
/*
* Requests platform to set native focus on a frame/dialog.
* In case of a simple window, triggers appropriate java focus change.
*/
public
boolean
requestWindowFocus
(
CausedFocusEvent
.
Cause
cause
)
{
if
(
focusLog
.
isLoggable
(
PlatformLogger
.
FINE
))
{
focusLog
.
fine
(
"requesting native focus to "
+
this
);
...
...
@@ -1108,14 +1114,14 @@ public class LWWindowPeer
}
// DKFM will synthesize all the focus/activation events correctly.
changeFocusedWindow
(
true
,
false
);
changeFocusedWindow
(
true
);
return
true
;
// In case the toplevel is active but not focused, change focus directly,
// as requesting native focus on it will not have effect.
}
else
if
(
getTarget
()
==
currentActive
&&
!
getTarget
().
hasFocus
())
{
changeFocusedWindow
(
true
,
false
);
changeFocusedWindow
(
true
);
return
true
;
}
return
platformWindow
.
requestWindowFocus
();
...
...
@@ -1133,13 +1139,13 @@ public class LWWindowPeer
}
/*
*
"Delegates" the responsibility of managing focus to keyboard focus manager
.
*
Changes focused window on java level
.
*/
private
void
changeFocusedWindow
(
boolean
becomesFocused
,
boolean
isShowing
)
{
private
void
changeFocusedWindow
(
boolean
becomesFocused
)
{
if
(
focusLog
.
isLoggable
(
PlatformLogger
.
FINE
))
{
focusLog
.
fine
((
becomesFocused
?
"gaining"
:
"loosing"
)
+
" focus window: "
+
this
);
}
if
(
isShowing
&&
!
getTarget
().
isAutoRequestFocus
()
||
skipNextFocusChange
)
{
if
(
skipNextFocusChange
)
{
focusLog
.
fine
(
"skipping focus change"
);
skipNextFocusChange
=
false
;
return
;
...
...
@@ -1184,7 +1190,7 @@ public class LWWindowPeer
postEvent
(
windowEvent
);
}
private
static
LWWindowPeer
getOwnerFrameDialog
(
LWWindowPeer
peer
)
{
static
LWWindowPeer
getOwnerFrameDialog
(
LWWindowPeer
peer
)
{
Window
owner
=
(
peer
!=
null
?
peer
.
getTarget
().
getOwner
()
:
null
);
while
(
owner
!=
null
&&
!(
owner
instanceof
Frame
||
owner
instanceof
Dialog
))
{
owner
=
owner
.
getOwner
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录