From: Alexandros Frantzis alexandros.frantzis@collabora.com
--- dlls/user32/tests/input.c | 35 +++++++++++++++++++++++++++++++++++ server/queue.c | 5 +++-- 2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 0bcea006db1..f4d3b182ca7 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -1471,6 +1471,35 @@ static void test_SendInput_raw_key_messages( WORD vkey, WORD wch, HKL hkl ) {.vkey = VK_PACKET, .flags = KEYEVENTF_KEYUP, .expect = {RAW_KEY(2, RI_KEY_BREAK, VK_PACKET, WM_KEYUP), {0}}}, {0}, }; + struct send_input_keyboard_test raw_unicode_legacy[] = + { + {.scan = 0x3c0, .flags = KEYEVENTF_UNICODE, .expect_state = {[VK_PACKET] = 0x80}, + .expect = {KEY_MSG(WM_KEYDOWN, 0, VK_PACKET, .todo_value = TRUE), WIN_MSG(WM_CHAR, 0x3c0, 1), {0}}}, + {.scan = 0x3c0, .flags = KEYEVENTF_KEYUP | KEYEVENTF_UNICODE, + .expect = {KEY_MSG(WM_KEYUP, 0, VK_PACKET, .todo_value = TRUE), {0}}}, + {0}, + }; + struct send_input_keyboard_test raw_unicode_nolegacy[] = + { + {.scan = 0x3c0, .flags = KEYEVENTF_UNICODE}, + {.scan = 0x3c0, .flags = KEYEVENTF_KEYUP | KEYEVENTF_UNICODE}, + {0}, + }; + struct send_input_keyboard_test raw_unicode_vkey_ctrl_legacy[] = + { + {.scan = 0x3c0, .vkey = VK_CONTROL, .flags = KEYEVENTF_UNICODE, + .expect_state = {[VK_CONTROL] = 0x80, [VK_LCONTROL] = 0x80}, + .expect = {KEY_MSG(WM_KEYDOWN, 0xc0, VK_CONTROL), {0}}}, + {.scan = 0x3c0, .vkey = VK_CONTROL, .flags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP, + .expect = {KEY_MSG(WM_KEYUP, 0xc0, VK_CONTROL), {0}}}, + {0}, + }; + struct send_input_keyboard_test raw_unicode_vkey_ctrl_nolegacy[] = + { + {.scan = 0x3c0, .vkey = VK_CONTROL, .flags = KEYEVENTF_UNICODE}, + {.scan = 0x3c0, .vkey = VK_CONTROL, .flags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP}, + {0}, + }; #undef WIN_MSG #undef RAW_KEY #undef KEY_MSG @@ -1514,6 +1543,9 @@ static void test_SendInput_raw_key_messages( WORD vkey, WORD wch, HKL hkl ) /* get both WM_INPUT and legacy messages */ check_send_input_keyboard_test( raw_legacy, !receive ); check_send_input_keyboard_test( raw_vk_packet_legacy, !receive ); + /* no WM_INPUT message for unicode */ + check_send_input_keyboard_test( raw_unicode_legacy, !receive ); + check_send_input_keyboard_test( raw_unicode_vkey_ctrl_legacy, !receive );
rid.dwFlags = RIDEV_REMOVE; ok_ret( 1, RegisterRawInputDevices( &rid, 1, sizeof(rid) ) ); @@ -1524,6 +1556,9 @@ static void test_SendInput_raw_key_messages( WORD vkey, WORD wch, HKL hkl ) /* get only WM_INPUT messages */ check_send_input_keyboard_test( raw_nolegacy, !receive ); check_send_input_keyboard_test( raw_vk_packet_nolegacy, !receive ); + /* no WM_INPUT message for unicode */ + check_send_input_keyboard_test( raw_unicode_nolegacy, !receive ); + check_send_input_keyboard_test( raw_unicode_vkey_ctrl_nolegacy, !receive );
rid.dwFlags = RIDEV_REMOVE; ok_ret( 1, RegisterRawInputDevices( &rid, 1, sizeof(rid) ) ); diff --git a/server/queue.c b/server/queue.c index 7d1cf780837..4d48da1d484 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2099,6 +2099,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c unsigned int message_code, time; lparam_t lparam = input->kbd.scan << 16; unsigned int flags = 0; + BOOL unicode = input->kbd.flags & KEYEVENTF_UNICODE; int wait;
if (!(time = input->kbd.time)) time = get_tick_count(); @@ -2188,7 +2189,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c } }
- if ((foreground = get_foreground_thread( desktop, win ))) + if (!unicode && (foreground = get_foreground_thread( desktop, win ))) { struct rawinput_message raw_msg = {0}; raw_msg.foreground = foreground; @@ -2216,7 +2217,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c msg->msg = message_code; if (origin == IMO_INJECTED) msg_data->flags = LLKHF_INJECTED;
- if (input->kbd.flags & KEYEVENTF_UNICODE && !vkey) + if (unicode && !vkey) { vkey = hook_vkey = VK_PACKET; }