Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
be5a175a
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看板
提交
be5a175a
编写于
9月 28, 2012
作者:
A
alexsch
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7197619: Using modifiers for the dead key detection on Windows
Reviewed-by: bagiras, leonidr
上级
fd6a4551
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
18 deletion
+36
-18
src/windows/native/sun/windows/awt_Component.cpp
src/windows/native/sun/windows/awt_Component.cpp
+34
-16
src/windows/native/sun/windows/awt_Component.h
src/windows/native/sun/windows/awt_Component.h
+2
-2
未找到文件。
src/windows/native/sun/windows/awt_Component.cpp
浏览文件 @
be5a175a
...
...
@@ -3144,7 +3144,8 @@ void AwtComponent::JavaKeyToWindowsKey(UINT javaKey,
return
;
}
UINT
AwtComponent
::
WindowsKeyToJavaKey
(
UINT
windowsKey
,
UINT
modifiers
)
UINT
AwtComponent
::
WindowsKeyToJavaKey
(
UINT
windowsKey
,
UINT
modifiers
,
UINT
character
,
BOOL
isDeadKey
)
{
// Handle the few cases where we need to take the modifier into
// consideration for the Java VK code or where we have to take the keyboard
...
...
@@ -3171,6 +3172,15 @@ UINT AwtComponent::WindowsKeyToJavaKey(UINT windowsKey, UINT modifiers)
break
;
};
// check dead key
if
(
isDeadKey
)
{
for
(
int
i
=
0
;
charToDeadVKTable
[
i
].
c
!=
0
;
i
++
)
{
if
(
charToDeadVKTable
[
i
].
c
==
character
)
{
return
charToDeadVKTable
[
i
].
javaKey
;
}
}
}
// for the general case, use a bi-directional table
for
(
int
i
=
0
;
keyMapTable
[
i
].
windowsKey
!=
0
;
i
++
)
{
if
(
keyMapTable
[
i
].
windowsKey
==
windowsKey
)
{
...
...
@@ -3384,14 +3394,18 @@ AwtComponent::UpdateDynPrimaryKeymap(UINT wkey, UINT jkeyLegacy, jint keyLocatio
}
}
UINT
AwtComponent
::
WindowsKeyToJavaChar
(
UINT
wkey
,
UINT
modifiers
,
TransOps
ops
)
UINT
AwtComponent
::
WindowsKeyToJavaChar
(
UINT
wkey
,
UINT
modifiers
,
TransOps
ops
,
BOOL
&
isDeadKey
)
{
static
Hashtable
transTable
(
"VKEY translations"
);
static
Hashtable
deadKeyFlagTable
(
"Dead Key Flags"
);
isDeadKey
=
FALSE
;
// Try to translate using last saved translation
if
(
ops
==
LOAD
)
{
void
*
deadKeyFlag
=
deadKeyFlagTable
.
remove
(
reinterpret_cast
<
void
*>
(
static_cast
<
INT_PTR
>
(
wkey
)));
void
*
value
=
transTable
.
remove
(
reinterpret_cast
<
void
*>
(
static_cast
<
INT_PTR
>
(
wkey
)));
if
(
value
!=
NULL
)
{
isDeadKey
=
static_cast
<
BOOL
>
(
reinterpret_cast
<
INT_PTR
>
(
deadKeyFlag
));
return
static_cast
<
UINT
>
(
reinterpret_cast
<
INT_PTR
>
(
value
));
}
}
...
...
@@ -3484,12 +3498,13 @@ UINT AwtComponent::WindowsKeyToJavaChar(UINT wkey, UINT modifiers, TransOps ops)
// instead of creating our own conversion tables, I'll let Win32
// convert the character for me.
WORD
mbChar
;
WORD
wChar
[
2
]
;
UINT
scancode
=
::
MapVirtualKey
(
wkey
,
0
);
int
converted
=
::
To
Ascii
Ex
(
wkey
,
scancode
,
keyboardState
,
&
mbChar
,
0
,
GetKeyboardLayout
());
int
converted
=
::
To
Unicode
Ex
(
wkey
,
scancode
,
keyboardState
,
wChar
,
2
,
0
,
GetKeyboardLayout
());
UINT
translation
;
BOOL
deadKeyFlag
=
(
converted
==
2
);
// Dead Key
if
(
converted
<
0
)
{
...
...
@@ -3508,16 +3523,16 @@ UINT AwtComponent::WindowsKeyToJavaChar(UINT wkey, UINT modifiers, TransOps ops)
}
else
// the caller expects a Unicode character.
if
(
converted
>
0
)
{
WCHAR
unicodeChar
[
2
];
VERIFY
(
::
MultiByteToWideChar
(
GetCodePage
(),
MB_PRECOMPOSED
,
(
LPCSTR
)
&
mbChar
,
1
,
unicodeChar
,
1
));
translation
=
unicodeChar
[
0
];
translation
=
wChar
[
0
];
}
if
(
ops
==
SAVE
)
{
transTable
.
put
(
reinterpret_cast
<
void
*>
(
static_cast
<
INT_PTR
>
(
wkey
)),
reinterpret_cast
<
void
*>
(
static_cast
<
INT_PTR
>
(
translation
)));
deadKeyFlagTable
.
put
(
reinterpret_cast
<
void
*>
(
static_cast
<
INT_PTR
>
(
wkey
)),
reinterpret_cast
<
void
*>
(
static_cast
<
INT_PTR
>
(
deadKeyFlag
)));
}
isDeadKey
=
deadKeyFlag
;
return
translation
;
}
...
...
@@ -3537,8 +3552,9 @@ MsgRouting AwtComponent::WmKeyDown(UINT wkey, UINT repCnt,
UINT
modifiers
=
GetJavaModifiers
();
jint
keyLocation
=
GetKeyLocation
(
wkey
,
flags
);
UINT
jkey
=
WindowsKeyToJavaKey
(
wkey
,
modifiers
);
UINT
character
=
WindowsKeyToJavaChar
(
wkey
,
modifiers
,
SAVE
);
BOOL
isDeadKey
=
FALSE
;
UINT
character
=
WindowsKeyToJavaChar
(
wkey
,
modifiers
,
SAVE
,
isDeadKey
);
UINT
jkey
=
WindowsKeyToJavaKey
(
wkey
,
modifiers
,
character
,
isDeadKey
);
UpdateDynPrimaryKeymap
(
wkey
,
jkey
,
keyLocation
,
modifiers
);
...
...
@@ -3579,8 +3595,9 @@ MsgRouting AwtComponent::WmKeyUp(UINT wkey, UINT repCnt,
UINT
modifiers
=
GetJavaModifiers
();
jint
keyLocation
=
GetKeyLocation
(
wkey
,
flags
);
UINT
jkey
=
WindowsKeyToJavaKey
(
wkey
,
modifiers
);
UINT
character
=
WindowsKeyToJavaChar
(
wkey
,
modifiers
,
LOAD
);
BOOL
isDeadKey
=
FALSE
;
UINT
character
=
WindowsKeyToJavaChar
(
wkey
,
modifiers
,
LOAD
,
isDeadKey
);
UINT
jkey
=
WindowsKeyToJavaKey
(
wkey
,
modifiers
,
character
,
isDeadKey
);
UpdateDynPrimaryKeymap
(
wkey
,
jkey
,
keyLocation
,
modifiers
);
SendKeyEventToFocusOwner
(
java_awt_event_KeyEvent_KEY_RELEASED
,
...
...
@@ -5628,7 +5645,8 @@ void AwtComponent::_NativeHandleEvent(void *param)
}
}
modifiedChar
=
p
->
WindowsKeyToJavaChar
(
winKey
,
modifiers
,
AwtComponent
::
NONE
);
BOOL
isDeadKey
=
FALSE
;
modifiedChar
=
p
->
WindowsKeyToJavaChar
(
winKey
,
modifiers
,
AwtComponent
::
NONE
,
isDeadKey
);
bCharChanged
=
(
keyChar
!=
modifiedChar
);
}
break
;
...
...
@@ -7166,4 +7184,4 @@ void ReleaseDCList(HWND hwnd, DCList &list) {
removedDCs
=
removedDCs
->
next
;
delete
tmpDCList
;
}
}
}
\ No newline at end of file
src/windows/native/sun/windows/awt_Component.h
浏览文件 @
be5a175a
...
...
@@ -441,7 +441,7 @@ public:
static
jint
GetJavaModifiers
();
static
jint
GetButton
(
int
mouseButton
);
static
UINT
GetButtonMK
(
int
mouseButton
);
static
UINT
WindowsKeyToJavaKey
(
UINT
windowsKey
,
UINT
modifiers
);
static
UINT
WindowsKeyToJavaKey
(
UINT
windowsKey
,
UINT
modifiers
,
UINT
character
,
BOOL
isDeadKey
);
static
void
JavaKeyToWindowsKey
(
UINT
javaKey
,
UINT
*
windowsKey
,
UINT
*
modifiers
,
UINT
originalWindowsKey
);
static
void
UpdateDynPrimaryKeymap
(
UINT
wkey
,
UINT
jkeyLegacy
,
jint
keyLocation
,
UINT
modifiers
);
...
...
@@ -453,7 +453,7 @@ public:
enum
TransOps
{
NONE
,
LOAD
,
SAVE
};
UINT
WindowsKeyToJavaChar
(
UINT
wkey
,
UINT
modifiers
,
TransOps
ops
);
UINT
WindowsKeyToJavaChar
(
UINT
wkey
,
UINT
modifiers
,
TransOps
ops
,
BOOL
&
isDeadKey
);
/* routines used for input method support */
void
SetInputMethod
(
jobject
im
,
BOOL
useNativeCompWindow
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录