Skip to content

Commit fe3ecd7

Browse files
authored
[Win32, Keyboard] Fix AltGr's forged ControlLeft (flutter#31848)
1 parent 621c88d commit fe3ecd7

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

shell/platform/windows/keyboard_manager_win32.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void KeyboardManagerWin32::OnKey(std::unique_ptr<PendingEvent> event,
176176
(1 /* repeat_count */ << 0) | (ctrl_left_scancode << 16) |
177177
(0 /* extended */ << 24) | (1 /* prev_state */ << 30) |
178178
(1 /* transition */ << 31);
179-
window_delegate_->Win32DispatchMessage(WM_KEYUP, VK_LCONTROL, lParam);
179+
window_delegate_->Win32DispatchMessage(WM_KEYUP, VK_CONTROL, lParam);
180180
}
181181
}
182182

shell/platform/windows/keyboard_win32_unittests.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ TEST(KeyboardTest, AltGrModifiedKey) {
12031203
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
12041204
KeyStateChange{VK_LCONTROL, false, true},
12051205
ExpectForgedMessage{
1206-
WmKeyUpInfo{VK_LCONTROL, kScanCodeControl, kNotExtended}.Build(
1206+
WmKeyUpInfo{VK_CONTROL, kScanCodeControl, kNotExtended}.Build(
12071207
kWmResultZero)},
12081208
KeyStateChange{VK_RMENU, false, true},
12091209
WmSysKeyUpInfo{VK_MENU, kScanCodeAlt, kExtended}.Build(
@@ -1243,7 +1243,7 @@ TEST(KeyboardTest, AltGrTwice) {
12431243
// AltLeft) down.
12441244
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
12451245
KeyStateChange{VK_LCONTROL, true, true},
1246-
WmKeyDownInfo{VK_LCONTROL, kScanCodeControl, kNotExtended, kWasUp}.Build(
1246+
WmKeyDownInfo{VK_CONTROL, kScanCodeControl, kNotExtended, kWasUp}.Build(
12471247
kWmResultZero),
12481248
KeyStateChange{VK_RMENU, true, true},
12491249
WmKeyDownInfo{VK_MENU, kScanCodeAlt, kExtended, kWasUp}.Build(
@@ -1265,7 +1265,7 @@ TEST(KeyboardTest, AltGrTwice) {
12651265
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
12661266
KeyStateChange{VK_LCONTROL, false, true},
12671267
ExpectForgedMessage{
1268-
WmKeyUpInfo{VK_LCONTROL, kScanCodeControl, kNotExtended}.Build(
1268+
WmKeyUpInfo{VK_CONTROL, kScanCodeControl, kNotExtended}.Build(
12691269
kWmResultZero)},
12701270
KeyStateChange{VK_RMENU, false, true},
12711271
WmSysKeyUpInfo{VK_MENU, kScanCodeAlt, kExtended}.Build(
@@ -1284,7 +1284,7 @@ TEST(KeyboardTest, AltGrTwice) {
12841284

12851285
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
12861286
KeyStateChange{VK_LCONTROL, true, false},
1287-
WmKeyDownInfo{VK_LCONTROL, kScanCodeControl, kNotExtended, kWasUp}.Build(
1287+
WmKeyDownInfo{VK_CONTROL, kScanCodeControl, kNotExtended, kWasUp}.Build(
12881288
kWmResultZero),
12891289
KeyStateChange{VK_RMENU, true, true},
12901290
WmKeyDownInfo{VK_MENU, kScanCodeAlt, kExtended, kWasUp}.Build(
@@ -1306,7 +1306,7 @@ TEST(KeyboardTest, AltGrTwice) {
13061306
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
13071307
KeyStateChange{VK_LCONTROL, false, false},
13081308
ExpectForgedMessage{
1309-
WmKeyUpInfo{VK_LCONTROL, kScanCodeControl, kNotExtended}.Build(
1309+
WmKeyUpInfo{VK_CONTROL, kScanCodeControl, kNotExtended}.Build(
13101310
kWmResultZero)},
13111311
KeyStateChange{VK_RMENU, false, false},
13121312
WmSysKeyUpInfo{VK_MENU, kScanCodeAlt, kExtended}.Build(
@@ -1323,7 +1323,7 @@ TEST(KeyboardTest, AltGrTwice) {
13231323

13241324
// 5. For key sequence 2: a real ControlLeft up.
13251325
tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
1326-
WmKeyUpInfo{VK_LCONTROL, kScanCodeControl, kNotExtended}.Build(
1326+
WmKeyUpInfo{VK_CONTROL, kScanCodeControl, kNotExtended}.Build(
13271327
kWmResultZero)});
13281328
EXPECT_EQ(key_calls.size(), 1);
13291329
EXPECT_CALL_IS_EVENT(key_calls[0], kFlutterKeyEventTypeDown, 0, 0, "",

0 commit comments

Comments
 (0)