Andrew Eikum : winex11: Support KEYEVENTF_UNICODE in SendInput.
Alexandre Julliard
julliard at winehq.org
Wed Aug 19 11:31:40 CDT 2009
Module: wine
Branch: master
Commit: 55736136e2111377dd682af2dab94a4ecbfdd8ec
URL: http://source.winehq.org/git/wine.git/?a=commit;h=55736136e2111377dd682af2dab94a4ecbfdd8ec
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Tue Aug 18 11:29:01 2009 -0500
winex11: Support KEYEVENTF_UNICODE in SendInput.
---
dlls/user32/spy.c | 2 +-
dlls/winex11.drv/keyboard.c | 46 ++++++++++++++++++++++++++++---------------
include/winuser.h | 5 +++-
3 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/spy.c b/dlls/user32/spy.c
index 3301ac1..eb126e3 100644
--- a/dlls/user32/spy.c
+++ b/dlls/user32/spy.c
@@ -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 */
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index 3ffa13c..3da7183 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -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;
diff --git a/include/winuser.h b/include/winuser.h
index 3f202b1..9707b2c 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -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
More information about the wine-cvs
mailing list