Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
b63d6e22
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b63d6e22
编写于
7月 07, 2021
作者:
M
Matej Knopp
提交者:
GitHub
7月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not expect WM_CHAR if control or windows key is pressed (#27064)
上级
1bce28c9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
2 deletion
+31
-2
shell/platform/windows/window_win32.cc
shell/platform/windows/window_win32.cc
+9
-2
shell/platform/windows/window_win32_unittests.cc
shell/platform/windows/window_win32_unittests.cc
+22
-0
未找到文件。
shell/platform/windows/window_win32.cc
浏览文件 @
b63d6e22
...
...
@@ -371,11 +371,18 @@ WindowWin32::HandleMessage(UINT const message,
// Check if this key produces a character. If so, the key press should
// be sent with the character produced at WM_CHAR. Store the produced
// keycode (it's not accessible from WM_CHAR) to be used in WM_CHAR.
const
unsigned
int
character
=
MapVirtualKey
(
wparam
,
MAPVK_VK_TO_CHAR
);
if
(
character
>
0
&&
is_keydown_message
)
{
//
// Messages with Control or Win modifiers down are never considered as
// character messages. This allows key combinations such as "CTRL + Digit"
// to properly produce key down events even though `MapVirtualKey` returns
// a valid character. See https://github.com/flutter/flutter/issues/85587.
unsigned
int
character
=
MapVirtualKey
(
wparam
,
MAPVK_VK_TO_CHAR
);
if
(
character
>
0
&&
is_keydown_message
&&
GetKeyState
(
VK_CONTROL
)
==
0
&&
GetKeyState
(
VK_LWIN
)
==
0
&&
GetKeyState
(
VK_RWIN
)
==
0
)
{
keycode_for_char_message_
=
wparam
;
break
;
}
character
=
0
;
unsigned
int
keyCode
(
wparam
);
const
unsigned
int
scancode
=
(
lparam
>>
16
)
&
0xff
;
const
bool
extended
=
((
lparam
>>
24
)
&
0x01
)
==
0x01
;
...
...
shell/platform/windows/window_win32_unittests.cc
浏览文件 @
b63d6e22
...
...
@@ -84,5 +84,27 @@ TEST(MockWin32Window, KeyDownPrintable) {
window
.
InjectWindowMessage
(
WM_CHAR
,
65
,
lparam
);
}
TEST
(
MockWin32Window
,
KeyDownWithCtrl
)
{
MockWin32Window
window
;
// Simulate CONTROL pressed
BYTE
keyboard_state
[
256
];
memset
(
keyboard_state
,
0
,
256
);
keyboard_state
[
VK_CONTROL
]
=
-
1
;
SetKeyboardState
(
keyboard_state
);
LPARAM
lparam
=
CreateKeyEventLparam
(
30
);
// Expect OnKey, but not OnText, because Control + Key is not followed by
// WM_CHAR
EXPECT_CALL
(
window
,
OnKey
(
65
,
30
,
WM_KEYDOWN
,
0
,
false
,
true
)).
Times
(
1
);
EXPECT_CALL
(
window
,
OnText
(
_
)).
Times
(
0
);
window
.
InjectWindowMessage
(
WM_KEYDOWN
,
65
,
lparam
);
memset
(
keyboard_state
,
0
,
256
);
SetKeyboardState
(
keyboard_state
);
}
}
// namespace testing
}
// namespace flutter
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录