Commit a7adbf78 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Reimplement accelerator functions to use 32-bit user handles instead of 16-bit functions.

parent a187b43d
......@@ -5344,52 +5344,26 @@ static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARA
*/
INT WINAPI TranslateAcceleratorA( HWND hWnd, HACCEL hAccel, LPMSG msg )
{
/* YES, Accel16! */
LPACCEL16 lpAccelTbl;
int i;
WPARAM wParam;
if (!hWnd || !msg) return 0;
if (!hAccel || !(lpAccelTbl = (LPACCEL16) LockResource16(HACCEL_16(hAccel))))
{
WARN_(accel)("invalid accel handle=%p\n", hAccel);
return 0;
}
wParam = msg->wParam;
switch (msg->message)
{
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
break;
return TranslateAcceleratorW( hWnd, hAccel, msg );
case WM_CHAR:
case WM_SYSCHAR:
{
char ch = LOWORD(wParam);
MSG msgW = *msg;
char ch = LOWORD(msg->wParam);
WCHAR wch;
MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wch, 1);
wParam = MAKEWPARAM(wch, HIWORD(wParam));
msgW.wParam = MAKEWPARAM(wch, HIWORD(msg->wParam));
return TranslateAcceleratorW( hWnd, hAccel, &msgW );
}
break;
default:
return 0;
}
TRACE_(accel)("hAccel %p, hWnd %p, msg->hwnd %p, msg->message %04x, wParam %08lx, lParam %08lx\n",
hAccel,hWnd,msg->hwnd,msg->message,msg->wParam,msg->lParam);
i = 0;
do
{
if (translate_accelerator( hWnd, msg->message, wParam, msg->lParam,
lpAccelTbl[i].fVirt, lpAccelTbl[i].key, lpAccelTbl[i].cmd))
return 1;
} while ((lpAccelTbl[i++].fVirt & 0x80) == 0);
return 0;
}
/**********************************************************************
......@@ -5397,39 +5371,32 @@ INT WINAPI TranslateAcceleratorA( HWND hWnd, HACCEL hAccel, LPMSG msg )
*/
INT WINAPI TranslateAcceleratorW( HWND hWnd, HACCEL hAccel, LPMSG msg )
{
/* YES, Accel16! */
LPACCEL16 lpAccelTbl;
int i;
if (!hWnd || !msg) return 0;
if (!hAccel || !(lpAccelTbl = (LPACCEL16) LockResource16(HACCEL_16(hAccel))))
{
WARN_(accel)("invalid accel handle=%p\n", hAccel);
return 0;
}
ACCEL data[32], *ptr = data;
int i, count;
switch (msg->message)
{
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_CHAR:
case WM_SYSCHAR:
break;
if (!hWnd) return 0;
default:
if (msg->message != WM_KEYDOWN &&
msg->message != WM_SYSKEYDOWN &&
msg->message != WM_CHAR &&
msg->message != WM_SYSCHAR)
return 0;
}
TRACE_(accel)("hAccel %p, hWnd %p, msg->hwnd %p, msg->message %04x, wParam %08lx, lParam %08lx\n",
hAccel,hWnd,msg->hwnd,msg->message,msg->wParam,msg->lParam);
i = 0;
do
if (!(count = CopyAcceleratorTableW( hAccel, NULL, 0 ))) return 0;
if (count > sizeof(data)/sizeof(data[0]))
{
if (!(ptr = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*ptr) ))) return 0;
}
count = CopyAcceleratorTableW( hAccel, ptr, count );
for (i = 0; i < count; i++)
{
if (translate_accelerator( hWnd, msg->message, msg->wParam, msg->lParam,
lpAccelTbl[i].fVirt, lpAccelTbl[i].key, lpAccelTbl[i].cmd))
return 1;
} while ((lpAccelTbl[i++].fVirt & 0x80) == 0);
return 0;
ptr[i].fVirt, ptr[i].key, ptr[i].cmd))
break;
}
if (ptr != data) HeapFree( GetProcessHeap(), 0, ptr );
return (i < count);
}
......@@ -128,6 +128,7 @@ enum user_obj_type
{
USER_WINDOW = 1, /* window */
USER_MENU, /* menu */
USER_ACCEL, /* accelerator */
USER_DWP /* DeferWindowPos structure */
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment