Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ddefeddf
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看板
提交
ddefeddf
编写于
7月 15, 2011
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
4717864: setFont() does not update Fonts of Menus already on screen
Reviewed-by: art, bagiras
上级
5bb3779f
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
174 addition
and
79 deletion
+174
-79
src/windows/classes/sun/awt/windows/WMenuItemPeer.java
src/windows/classes/sun/awt/windows/WMenuItemPeer.java
+4
-2
src/windows/native/sun/windows/awt_Menu.cpp
src/windows/native/sun/windows/awt_Menu.cpp
+35
-0
src/windows/native/sun/windows/awt_Menu.h
src/windows/native/sun/windows/awt_Menu.h
+3
-0
src/windows/native/sun/windows/awt_MenuBar.cpp
src/windows/native/sun/windows/awt_MenuBar.cpp
+10
-2
src/windows/native/sun/windows/awt_MenuBar.h
src/windows/native/sun/windows/awt_MenuBar.h
+1
-0
src/windows/native/sun/windows/awt_MenuItem.cpp
src/windows/native/sun/windows/awt_MenuItem.cpp
+118
-73
src/windows/native/sun/windows/awt_MenuItem.h
src/windows/native/sun/windows/awt_MenuItem.h
+3
-2
未找到文件。
src/windows/classes/sun/awt/windows/WMenuItemPeer.java
浏览文件 @
ddefeddf
...
...
@@ -183,7 +183,9 @@ class WMenuItemPeer extends WObjectPeer implements MenuItemPeer {
*/
private
static
native
void
initIDs
();
// Needed for MenuComponentPeer.
public
void
setFont
(
Font
f
)
{
private
native
void
_setFont
(
Font
f
);
public
void
setFont
(
final
Font
f
)
{
_setFont
(
f
);
}
}
src/windows/native/sun/windows/awt_Menu.cpp
浏览文件 @
ddefeddf
...
...
@@ -119,6 +119,41 @@ done:
return
menu
;
}
void
AwtMenu
::
UpdateLayout
()
{
UpdateLayout
(
GetHMenu
());
RedrawMenuBar
();
}
void
AwtMenu
::
UpdateLayout
(
const
HMENU
hmenu
)
{
const
int
nMenuItemCount
=
::
GetMenuItemCount
(
hmenu
);
static
MENUITEMINFO
mii
;
for
(
int
idx
=
0
;
idx
<
nMenuItemCount
;
++
idx
)
{
memset
(
&
mii
,
0
,
sizeof
(
mii
));
mii
.
cbSize
=
sizeof
(
mii
);
mii
.
fMask
=
MIIM_CHECKMARKS
|
MIIM_DATA
|
MIIM_ID
|
MIIM_STATE
|
MIIM_SUBMENU
|
MIIM_TYPE
;
if
(
::
GetMenuItemInfo
(
hmenu
,
idx
,
TRUE
,
&
mii
))
{
VERIFY
(
::
RemoveMenu
(
hmenu
,
idx
,
MF_BYPOSITION
));
VERIFY
(
::
InsertMenuItem
(
hmenu
,
idx
,
TRUE
,
&
mii
));
if
(
mii
.
hSubMenu
!=
NULL
)
{
UpdateLayout
(
mii
.
hSubMenu
);
}
}
}
}
void
AwtMenu
::
UpdateContainerLayout
()
{
AwtMenu
*
menu
=
GetMenuContainer
();
if
(
menu
!=
NULL
)
{
menu
->
UpdateLayout
();
}
else
{
UpdateLayout
();
}
}
AwtMenuBar
*
AwtMenu
::
GetMenuBar
()
{
return
(
GetMenuContainer
()
==
NULL
)
?
NULL
:
GetMenuContainer
()
->
GetMenuBar
();
}
...
...
src/windows/native/sun/windows/awt_Menu.h
浏览文件 @
ddefeddf
...
...
@@ -72,6 +72,8 @@ public:
virtual
AwtMenuBar
*
GetMenuBar
();
void
AddSeparator
();
virtual
void
UpdateContainerLayout
();
void
UpdateLayout
();
virtual
void
AddItem
(
AwtMenuItem
*
item
);
virtual
void
DeleteItem
(
UINT
index
);
...
...
@@ -103,6 +105,7 @@ protected:
virtual
void
RemoveCmdID
()
{
/* do nothing */
}
private:
void
UpdateLayout
(
const
HMENU
hmenu
);
HMENU
m_hMenu
;
};
...
...
src/windows/native/sun/windows/awt_MenuBar.cpp
浏览文件 @
ddefeddf
...
...
@@ -198,7 +198,15 @@ void AwtMenuBar::DeleteItem(UINT index)
if
(
hOwnerWnd
!=
NULL
)
{
VERIFY
(
::
InvalidateRect
(
hOwnerWnd
,
0
,
TRUE
));
}
::
DrawMenuBar
(
GetOwnerHWnd
());
RedrawMenuBar
();
}
/**
* If the menu changes after the system has created the window,
* this function must be called to draw the changed menu bar.
*/
void
AwtMenuBar
::
RedrawMenuBar
()
{
VERIFY
(
::
DrawMenuBar
(
GetOwnerHWnd
()));
}
LRESULT
AwtMenuBar
::
WinThreadExecProc
(
ExecuteArgs
*
args
)
...
...
@@ -232,7 +240,7 @@ void AwtMenuBar::_AddMenu(void *param)
if
(
::
IsWindow
(
m
->
GetOwnerHWnd
()))
{
/* The menu was already created and added during peer creation -- redraw */
::
DrawMenuBar
(
m
->
GetOwnerHWnd
()
);
m
->
RedrawMenuBar
(
);
}
ret:
env
->
DeleteGlobalRef
(
self
);
...
...
src/windows/native/sun/windows/awt_MenuBar.h
浏览文件 @
ddefeddf
...
...
@@ -65,6 +65,7 @@ public:
INLINE
AwtFrame
*
GetFrame
()
{
return
m_frame
;
}
virtual
HWND
GetOwnerHWnd
();
virtual
void
RedrawMenuBar
();
AwtMenuItem
*
GetItem
(
jobject
target
,
long
index
);
int
CountItem
(
jobject
menuBar
);
...
...
src/windows/native/sun/windows/awt_MenuItem.cpp
浏览文件 @
ddefeddf
...
...
@@ -626,7 +626,7 @@ void AwtMenuItem::SetLabel(LPCTSTR sb)
mii
.
dwTypeData
=
(
LPTSTR
)(
*
sb
);
// find index by menu item id
int
nMenuItemCount
=
::
GetMenuItemCount
(
hMenu
);
;
int
nMenuItemCount
=
::
GetMenuItemCount
(
hMenu
);
int
idx
;
for
(
idx
=
0
;
(
idx
<
nMenuItemCount
);
idx
++
)
{
memset
(
&
mii1
,
0
,
sizeof
(
MENUITEMINFO
));
...
...
@@ -639,10 +639,7 @@ void AwtMenuItem::SetLabel(LPCTSTR sb)
::
RemoveMenu
(
hMenu
,
idx
,
MF_BYPOSITION
);
::
InsertMenuItem
(
hMenu
,
idx
,
TRUE
,
&
mii
);
// Redraw menu bar if it was affected.
if
(
menu
->
GetMenuBar
()
==
menu
)
{
::
DrawMenuBar
(
menu
->
GetOwnerHWnd
());
}
RedrawMenuBar
();
}
void
AwtMenuItem
::
Enable
(
BOOL
isEnabled
)
...
...
@@ -658,10 +655,7 @@ void AwtMenuItem::Enable(BOOL isEnabled)
MF_BYCOMMAND
|
(
isEnabled
?
MF_ENABLED
:
MF_GRAYED
))
!=
0xFFFFFFFF
);
// Redraw menu bar if it was affected.
if
(
menu
->
GetMenuBar
()
==
menu
)
{
::
DrawMenuBar
(
menu
->
GetOwnerHWnd
());
}
RedrawMenuBar
();
}
void
AwtMenuItem
::
SetState
(
BOOL
isChecked
)
...
...
@@ -676,23 +670,31 @@ void AwtMenuItem::SetState(BOOL isChecked)
MF_BYCOMMAND
|
(
isChecked
?
MF_CHECKED
:
MF_UNCHECKED
))
!=
0xFFFFFFFF
);
// Redraw menu bar if it was affected.
if
(
menu
->
GetMenuBar
()
==
menu
)
{
::
DrawMenuBar
(
menu
->
GetOwnerHWnd
());
RedrawMenuBar
();
}
/**
* If the menu changes after the system has created the window,
* this function must be called to draw the changed menu bar.
*/
void
AwtMenuItem
::
RedrawMenuBar
()
{
AwtMenu
*
menu
=
GetMenuContainer
();
if
(
menu
!=
NULL
&&
menu
->
GetMenuBar
()
==
menu
){
menu
->
RedrawMenuBar
();
}
}
void
AwtMenuItem
::
UpdateContainerLayout
()
{
AwtMenu
*
menu
=
GetMenuContainer
();
if
(
menu
!=
NULL
)
{
DASSERT
(
menu
!=
NULL
&&
GetID
()
>=
0
);
menu
->
UpdateLayout
();
}
}
LRESULT
AwtMenuItem
::
WinThreadExecProc
(
ExecuteArgs
*
args
)
{
switch
(
args
->
cmdId
)
{
case
MENUITEM_SETLABEL
:
{
LPCTSTR
sb
=
(
LPCTSTR
)
args
->
param1
;
DASSERT
(
!
IsBadStringPtr
(
sb
,
20
));
this
->
SetLabel
(
sb
);
}
break
;
case
MENUITEM_ENABLE
:
{
BOOL
isEnabled
=
(
BOOL
)
args
->
param1
;
...
...
@@ -714,8 +716,8 @@ LRESULT AwtMenuItem::WinThreadExecProc(ExecuteArgs * args)
return
0L
;
}
void
AwtMenuItem
::
_SetLabel
(
void
*
param
)
{
void
AwtMenuItem
::
_SetLabel
(
void
*
param
)
{
if
(
AwtToolkit
::
IsMainThread
())
{
JNIEnv
*
env
=
(
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
);
SetLabelStruct
*
sls
=
(
SetLabelStruct
*
)
param
;
...
...
@@ -752,10 +754,8 @@ void AwtMenuItem::_SetLabel(void *param)
}
else
{
ExecuteArgs
args
;
args
.
cmdId
=
MENUITEM_SETLABEL
;
args
.
param1
=
(
LPARAM
)
labelPtr
;
m
->
WinThreadExecProc
(
&
args
);
DASSERT
(
!
IsBadStringPtr
(
labelPtr
,
20
));
m
->
SetLabel
(
labelPtr
);
if
(
empty
!=
NULL
)
{
JNU_ReleaseStringPlatformChars
(
env
,
empty
,
labelPtr
);
...
...
@@ -784,6 +784,31 @@ ret:
{
throw
std
::
bad_alloc
();
}
}
else
{
AwtToolkit
::
GetInstance
().
InvokeFunction
(
AwtMenuItem
::
_SetLabel
,
param
);
}
}
void
AwtMenuItem
::
_UpdateLayout
(
void
*
param
)
{
if
(
AwtToolkit
::
IsMainThread
())
{
JNIEnv
*
env
=
(
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
);
jobject
self
=
(
jobject
)
param
;
AwtMenuItem
*
m
=
NULL
;
PDATA
pData
;
JNI_CHECK_PEER_GOTO
(
self
,
ret
);
m
=
(
AwtMenuItem
*
)
pData
;
m
->
UpdateContainerLayout
();
ret:
env
->
DeleteGlobalRef
(
self
);
}
else
{
AwtToolkit
::
GetInstance
().
InvokeFunction
(
AwtMenuItem
::
_UpdateLayout
,
param
);
}
}
BOOL
AwtMenuItem
::
IsSeparator
()
{
...
...
@@ -883,8 +908,8 @@ extern "C" {
/*
* Class: sun_awt_windows_WMenuItemPeer
* Method:
_setLabel
* Signature: (
Ljava/lang/String;
)V
* Method:
initIDs
* Signature: ()V
*/
JNIEXPORT
void
JNICALL
Java_sun_awt_windows_WMenuItemPeer_initIDs
(
JNIEnv
*
env
,
jclass
cls
)
...
...
@@ -925,6 +950,26 @@ Java_sun_awt_windows_WMenuItemPeer__1setLabel(JNIEnv *env, jobject self,
CATCH_BAD_ALLOC
;
}
/*
* Class: sun_awt_windows_WMenuItemPeer
* Method: _setFont
* Signature: (Ljava/awt/Font;)V
*/
JNIEXPORT
void
JNICALL
Java_sun_awt_windows_WMenuItemPeer__1setFont
(
JNIEnv
*
env
,
jobject
self
,
jobject
)
{
TRY
;
jobject
selfGlobalRef
=
env
->
NewGlobalRef
(
self
);
// Current implementation of AwtMenuItem get font attribute from the peer
// directly, so we ignore it here, but update current menu layout.
AwtToolkit
::
GetInstance
().
SyncCall
(
AwtMenuItem
::
_UpdateLayout
,
selfGlobalRef
);
// selfGlobalRef is deleted in _UpdateLayout
CATCH_BAD_ALLOC
;
}
/*
* Class: sun_awt_windows_WMenuItemPeer
* Method: create
...
...
src/windows/native/sun/windows/awt_MenuItem.h
浏览文件 @
ddefeddf
...
...
@@ -48,7 +48,6 @@ class AwtMenuItem : public AwtObject {
public:
// id's for methods executed on toolkit thread
enum
{
MENUITEM_SETLABEL
,
MENUITEM_ENABLE
,
MENUITEM_SETSTATE
,
MENUITEM_LAST
...
...
@@ -78,7 +77,6 @@ public:
virtual
LPCTSTR
GetClassName
();
void
AwtMenuItem
::
LinkObjects
(
jobject
peer
);
static
AwtMenuItem
*
Create
(
jobject
self
,
jobject
menu
);
INLINE
AwtMenu
*
GetMenuContainer
()
{
return
m_menuContainer
;
}
...
...
@@ -148,6 +146,8 @@ public:
void
SetLabel
(
LPCTSTR
sb
);
virtual
void
Enable
(
BOOL
isEnabled
);
virtual
void
UpdateContainerLayout
();
virtual
void
RedrawMenuBar
();
void
SetState
(
BOOL
isChecked
);
/*
...
...
@@ -163,6 +163,7 @@ public:
// invoked on Toolkit thread
static
void
_SetLabel
(
void
*
param
);
static
void
_UpdateLayout
(
void
*
param
);
protected:
AwtMenu
*
m_menuContainer
;
/* The menu object containing this item */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录