[Win32, Keyboard] Fix AltGr's forged ControlLeft (flutter/engine#31848)

This commit is contained in:
Tong Mu 2022-03-08 18:20:03 -08:00 committed by GitHub
parent 8f9a241e78
commit 809d01034b
2 changed files with 7 additions and 7 deletions

View File

@ -176,7 +176,7 @@ void KeyboardManagerWin32::OnKey(std::unique_ptr<PendingEvent> event,
(1 /* repeat_count */ << 0) | (ctrl_left_scancode << 16) |
(0 /* extended */ << 24) | (1 /* prev_state */ << 30) |
(1 /* transition */ << 31);
window_delegate_->Win32DispatchMessage(WM_KEYUP, VK_LCONTROL, lParam);
window_delegate_->Win32DispatchMessage(WM_KEYUP, VK_CONTROL, lParam);
}
}

View File

@ -1203,7 +1203,7 @@ TEST(KeyboardTest, AltGrModifiedKey) {
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
KeyStateChange{VK_LCONTROL, false, true},
ExpectForgedMessage{
WmKeyUpInfo{VK_LCONTROL, kScanCodeControl, kNotExtended}.Build(
WmKeyUpInfo{VK_CONTROL, kScanCodeControl, kNotExtended}.Build(
kWmResultZero)},
KeyStateChange{VK_RMENU, false, true},
WmSysKeyUpInfo{VK_MENU, kScanCodeAlt, kExtended}.Build(
@ -1243,7 +1243,7 @@ TEST(KeyboardTest, AltGrTwice) {
// AltLeft) down.
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
KeyStateChange{VK_LCONTROL, true, true},
WmKeyDownInfo{VK_LCONTROL, kScanCodeControl, kNotExtended, kWasUp}.Build(
WmKeyDownInfo{VK_CONTROL, kScanCodeControl, kNotExtended, kWasUp}.Build(
kWmResultZero),
KeyStateChange{VK_RMENU, true, true},
WmKeyDownInfo{VK_MENU, kScanCodeAlt, kExtended, kWasUp}.Build(
@ -1265,7 +1265,7 @@ TEST(KeyboardTest, AltGrTwice) {
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
KeyStateChange{VK_LCONTROL, false, true},
ExpectForgedMessage{
WmKeyUpInfo{VK_LCONTROL, kScanCodeControl, kNotExtended}.Build(
WmKeyUpInfo{VK_CONTROL, kScanCodeControl, kNotExtended}.Build(
kWmResultZero)},
KeyStateChange{VK_RMENU, false, true},
WmSysKeyUpInfo{VK_MENU, kScanCodeAlt, kExtended}.Build(
@ -1284,7 +1284,7 @@ TEST(KeyboardTest, AltGrTwice) {
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
KeyStateChange{VK_LCONTROL, true, false},
WmKeyDownInfo{VK_LCONTROL, kScanCodeControl, kNotExtended, kWasUp}.Build(
WmKeyDownInfo{VK_CONTROL, kScanCodeControl, kNotExtended, kWasUp}.Build(
kWmResultZero),
KeyStateChange{VK_RMENU, true, true},
WmKeyDownInfo{VK_MENU, kScanCodeAlt, kExtended, kWasUp}.Build(
@ -1306,7 +1306,7 @@ TEST(KeyboardTest, AltGrTwice) {
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
KeyStateChange{VK_LCONTROL, false, false},
ExpectForgedMessage{
WmKeyUpInfo{VK_LCONTROL, kScanCodeControl, kNotExtended}.Build(
WmKeyUpInfo{VK_CONTROL, kScanCodeControl, kNotExtended}.Build(
kWmResultZero)},
KeyStateChange{VK_RMENU, false, false},
WmSysKeyUpInfo{VK_MENU, kScanCodeAlt, kExtended}.Build(
@ -1323,7 +1323,7 @@ TEST(KeyboardTest, AltGrTwice) {
// 5. For key sequence 2: a real ControlLeft up.
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
WmKeyUpInfo{VK_LCONTROL, kScanCodeControl, kNotExtended}.Build(
WmKeyUpInfo{VK_CONTROL, kScanCodeControl, kNotExtended}.Build(
kWmResultZero)});
EXPECT_EQ(key_calls.size(), 1);
EXPECT_CALL_IS_EVENT(key_calls[0], kFlutterKeyEventTypeDown, 0, 0, "",