winex11: Support KEYEVENTF_UNICODE in SendInput.

This commit is contained in:
Andrew Eikum 2009-08-18 11:29:01 -05:00 committed by Alexandre Julliard
parent dad00cce44
commit 55736136e2
3 changed files with 35 additions and 18 deletions

View File

@ -1370,7 +1370,7 @@ static const char * const VK_KeyNames[SPY_MAX_VKKEYSNUM + 1] =
"VK_ICO_00", /* 0xE4 */
"VK_PROCESSKEY", /* 0xE5 */
NULL, /* 0xE6 */
NULL, /* 0xE7 */
"VK_PACKET", /* 0xE7 */
NULL, /* 0xE8 */
NULL, /* 0xE9 */
NULL, /* 0xEA */

View File

@ -1155,6 +1155,7 @@ void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD event_flags, DWORD
UINT message;
KBDLLHOOKSTRUCT hook;
WORD flags, wVkStripped, wVkL, wVkR, vk_hook = wVk;
LPARAM lParam = 0;
wVk = LOBYTE(wVk);
flags = LOBYTE(wScan);
@ -1216,11 +1217,16 @@ void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD event_flags, DWORD
message = WM_SYSKEYDOWN;
TrackSysKey = wVkStripped;
}
if (key_state_table[wVk] & 0x80) flags |= KF_REPEAT;
if (!(event_flags & KEYEVENTF_UNICODE) && key_state_table[wVk] & 0x80) flags |= KF_REPEAT;
}
TRACE_(key)(" wParam=%04x, lParam=%08lx, InputKeyState=%x\n",
wVk, MAKELPARAM( 1, flags ), key_state_table[wVk] );
if (event_flags & KEYEVENTF_UNICODE)
{
vk_hook = wVk = VK_PACKET;
lParam = MAKELPARAM(1 /* repeat count */, wScan);
TRACE_(key)(" message=0x%04x wParam=0x%04x lParam=0x%08lx\n",
message, wVk, lParam);
}
/* Hook gets whatever key was sent. */
hook.vkCode = vk_hook;
@ -1230,21 +1236,29 @@ void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD event_flags, DWORD
hook.dwExtraInfo = dwExtraInfo;
if (HOOK_CallHooks( WH_KEYBOARD_LL, HC_ACTION, message, (LPARAM)&hook, TRUE )) return;
if (event_flags & KEYEVENTF_KEYUP)
if (!(event_flags & KEYEVENTF_UNICODE))
{
key_state_table[wVk] &= ~0x80;
key_state_table[wVkStripped] = key_state_table[wVkL] | key_state_table[wVkR];
}
else
{
if (!(key_state_table[wVk] & 0x80)) key_state_table[wVk] ^= 0x01;
key_state_table[wVk] |= 0xc0;
key_state_table[wVkStripped] = key_state_table[wVkL] | key_state_table[wVkR];
}
if (event_flags & KEYEVENTF_KEYUP)
{
key_state_table[wVk] &= ~0x80;
key_state_table[wVkStripped] = key_state_table[wVkL] | key_state_table[wVkR];
}
else
{
if (!(key_state_table[wVk] & 0x80)) key_state_table[wVk] ^= 0x01;
key_state_table[wVk] |= 0xc0;
key_state_table[wVkStripped] = key_state_table[wVkL] | key_state_table[wVkR];
}
if (key_state_table[VK_MENU] & 0x80) flags |= KF_ALTDOWN;
if (key_state_table[VK_MENU] & 0x80) flags |= KF_ALTDOWN;
if (wVkStripped == VK_SHIFT) flags &= ~KF_EXTENDED;
if (wVkStripped == VK_SHIFT) flags &= ~KF_EXTENDED;
lParam = MAKELPARAM(1 /* repeat count */, flags);
TRACE_(key)(" message=0x%04x wParam=0x%04x, lParam=0x%08lx, InputKeyState=0x%x\n",
message, wVk, lParam, key_state_table[wVk]);
}
SERVER_START_REQ( send_hardware_message )
{
@ -1252,7 +1266,7 @@ void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD event_flags, DWORD
req->win = 0;
req->msg = message;
req->wparam = wVk;
req->lparam = MAKELPARAM( 1 /* repeat count */, flags );
req->lparam = lParam;
req->x = cursor_pos.x;
req->y = cursor_pos.y;
req->time = time;

View File

@ -2822,6 +2822,8 @@ typedef struct tagCBTACTIVATESTRUCT
/* keybd_event flags */
#define KEYEVENTF_EXTENDEDKEY 0x0001
#define KEYEVENTF_KEYUP 0x0002
#define KEYEVENTF_UNICODE 0x0004
#define KEYEVENTF_SCANCODE 0x0008
/* mouse_event flags */
#define MOUSEEVENTF_MOVE 0x0001
@ -3813,7 +3815,8 @@ typedef struct tagCOMPAREITEMSTRUCT
#define VK_PROCESSKEY 0xE5
/* 0xE6 OEM specific */
/* 0xE7-0xE8 Unassigned */
#define VK_PACKET 0xE7
/* 0xE8 Unassigned */
/* 0xE9-0xF5 OEM specific */
#define VK_ATTN 0xF6