Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4492cd47
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看板
提交
4492cd47
编写于
7月 26, 2013
作者:
L
leonidr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8007267: [macosx] com.apple.eawt.Application.setDefaultMenuBar is not working
Reviewed-by: anthony, serb
上级
0bac9fca
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
48 addition
and
13 deletion
+48
-13
src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java
src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java
+6
-4
src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java
src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java
+1
-1
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+31
-5
src/macosx/native/sun/awt/CMenuItem.m
src/macosx/native/sun/awt/CMenuItem.m
+10
-3
未找到文件。
src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java
浏览文件 @
4492cd47
...
...
@@ -31,6 +31,7 @@ import java.awt.peer.MenuComponentPeer;
import
javax.swing.*
;
import
javax.swing.plaf.MenuBarUI
;
import
com.apple.laf.ScreenMenuBar
;
import
sun.lwawt.macosx.CMenuBar
;
import
com.apple.laf.AquaMenuBarUI
;
...
...
@@ -72,12 +73,15 @@ class _AppMenuBarHandler {
// scan the current frames, and see if any are foreground
final
Frame
[]
frames
=
Frame
.
getFrames
();
for
(
final
Frame
frame
:
frames
)
{
if
(
frame
.
isVisible
()
&&
!
isFrameMinimized
(
frame
))
return
;
if
(
frame
.
isVisible
()
&&
!
isFrameMinimized
(
frame
))
{
return
;
}
}
// if we have no foreground frames, then we have to "kick" the menubar
final
JFrame
pingFrame
=
new
JFrame
();
pingFrame
.
getRootPane
().
putClientProperty
(
"Window.alpha"
,
new
Float
(
0.0f
));
pingFrame
.
setUndecorated
(
true
);
pingFrame
.
setVisible
(
true
);
pingFrame
.
toFront
();
pingFrame
.
setVisible
(
false
);
...
...
@@ -101,7 +105,6 @@ class _AppMenuBarHandler {
// Aqua was not installed
throw
new
IllegalStateException
(
"Application.setDefaultMenuBar() only works with the Aqua Look and Feel"
);
}
/* TODO: disabled until ScreenMenuBar is working
final
AquaMenuBarUI
aquaUI
=
(
AquaMenuBarUI
)
ui
;
final
ScreenMenuBar
screenMenuBar
=
aquaUI
.
getScreenMenuBar
();
...
...
@@ -118,8 +121,7 @@ class _AppMenuBarHandler {
}
// grab the pointer to the CMenuBar, and retain it in native
nativeSetDefaultMenuBar(((CMenuBar)peer).getNativeMenuBarPeer());
*/
nativeSetDefaultMenuBar
(((
CMenuBar
)
peer
).
getModel
());
}
void
setAboutMenuItemVisible
(
final
boolean
present
)
{
...
...
src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java
浏览文件 @
4492cd47
...
...
@@ -43,7 +43,7 @@ public abstract class CMenuComponent implements MenuComponentPeer {
return
target
;
}
long
getModel
()
{
public
long
getModel
()
{
return
modelPtr
;
}
...
...
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
4492cd47
...
...
@@ -30,6 +30,7 @@
#import "sun_lwawt_macosx_CPlatformWindow.h"
#import "com_apple_eawt_event_GestureHandler.h"
#import "com_apple_eawt_FullScreenHandler.h"
#import "ApplicationDelegate.h"
#import "AWTWindow.h"
#import "AWTView.h"
...
...
@@ -55,7 +56,7 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
// doesn't provide information about "opposite" window, so we
// have to do a bit of tracking. This variable points to a window
// which had been the key window just before a new key window
// was set. It would be nil if the new key window isn't an AWT
// was set. It would be nil if the new key window isn't an AWT
// window or the app currently has no key window.
static
AWTWindow
*
lastKeyWindow
=
nil
;
...
...
@@ -542,17 +543,26 @@ AWT_ASSERT_APPKIT_THREAD;
AWT_ASSERT_APPKIT_THREAD
;
[
AWTToolkit
eventCountPlusPlus
];
AWTWindow
*
opposite
=
[
AWTWindow
lastKeyWindow
];
// Finds appropriate menubar in our hierarchy,
AWTWindow
*
awtWindow
=
self
;
while
(
awtWindow
.
ownerWindow
!=
nil
)
{
awtWindow
=
awtWindow
.
ownerWindow
;
}
CMenuBar
*
menuBar
=
nil
;
BOOL
isDisabled
=
NO
;
if
([
awtWindow
.
nsWindow
isVisible
]){
menuBar
=
awtWindow
.
javaMenuBar
;
isDisabled
=
!
awtWindow
.
isEnabled
;
}
if
(
menuBar
==
nil
)
{
menuBar
=
[[
ApplicationDelegate
sharedDelegate
]
defaultMenuBar
];
isDisabled
=
NO
;
}
[
CMenuBar
activate
:
menuBar
modallyDisabled
:
!
awtWindow
.
isEnabled
];
[
CMenuBar
activate
:
menuBar
modallyDisabled
:
isDisabled
];
[
AWTWindow
setLastKeyWindow
:
nil
];
...
...
@@ -565,6 +575,14 @@ AWT_ASSERT_APPKIT_THREAD;
[
AWTToolkit
eventCountPlusPlus
];
[
self
.
javaMenuBar
deactivate
];
// In theory, this might cause flickering if the window gaining focus
// has its own menu. However, I couldn't reproduce it on practice, so
// perhaps this is a non issue.
CMenuBar
*
defaultMenu
=
[[
ApplicationDelegate
sharedDelegate
]
defaultMenuBar
];
if
(
defaultMenu
!=
nil
)
{
[
CMenuBar
activate
:
defaultMenu
modallyDisabled
:
NO
];
}
// the new key window
NSWindow
*
keyWindow
=
[
NSApp
keyWindow
];
AWTWindow
*
opposite
=
nil
;
...
...
@@ -829,11 +847,19 @@ JNF_COCOA_ENTER(env);
AWTWindow
*
window
=
(
AWTWindow
*
)[
nsWindow
delegate
];
if
([
nsWindow
isKeyWindow
])
[
window
.
javaMenuBar
deactivate
];
if
([
nsWindow
isKeyWindow
])
{
[
window
.
javaMenuBar
deactivate
];
}
window
.
javaMenuBar
=
menuBar
;
CMenuBar
*
actualMenuBar
=
menuBar
;
if
(
actualMenuBar
==
nil
)
{
actualMenuBar
=
[[
ApplicationDelegate
sharedDelegate
]
defaultMenuBar
];
}
if
([
nsWindow
isKeyWindow
])
{
[
CMenuBar
activate
:
window
.
java
MenuBar
modallyDisabled
:
NO
];
[
CMenuBar
activate
:
actual
MenuBar
modallyDisabled
:
NO
];
}
}];
...
...
src/macosx/native/sun/awt/CMenuItem.m
浏览文件 @
4492cd47
...
...
@@ -70,9 +70,15 @@ AWT_ASSERT_APPKIT_THREAD;
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
JNF_COCOA_ENTER
(
env
);
// If we are called as a result of user pressing a shorcut, do nothing,
// If we are called as a result of user pressing a shor
t
cut, do nothing,
// because AVTView has already sent corresponding key event to the Java
// layer from performKeyEquivalent
// layer from performKeyEquivalent.
// There is an exception from the rule above, though: if a window with
// a menu gets minimized by user and there are no other windows to take
// focus, the window's menu won't be removed from the global menu bar.
// However, the Java layer won't handle invocation by a shortcut coming
// from this "frameless" menu, because there are no active windows. This
// means we have to handle it here.
NSEvent
*
currEvent
=
[[
NSApplication
sharedApplication
]
currentEvent
];
if
([
currEvent
type
]
==
NSKeyDown
)
{
NSString
*
menuKey
=
[
sender
keyEquivalent
];
...
...
@@ -91,7 +97,8 @@ JNF_COCOA_ENTER(env);
eventKey
=
[
NSString
stringWithCharacters
:
&
newChar
length
:
1
];
}
if
([
menuKey
isEqualToString
:
eventKey
])
{
NSWindow
*
keyWindow
=
[
NSApp
keyWindow
];
if
([
menuKey
isEqualToString
:
eventKey
]
&&
keyWindow
!=
nil
)
{
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录