mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 17:14:32 +00:00
moved NtUserTranslateMessage() to message.c
svn path=/trunk/; revision=7291
This commit is contained in:
parent
39ed4e8db9
commit
ce1768d3c3
3 changed files with 38 additions and 21 deletions
|
@ -147,6 +147,8 @@ IntSendMessage(HWND hWnd,
|
||||||
LPARAM lParam);
|
LPARAM lParam);
|
||||||
LRESULT FASTCALL
|
LRESULT FASTCALL
|
||||||
IntDispatchMessage(MSG* Msg);
|
IntDispatchMessage(MSG* Msg);
|
||||||
|
BOOL FASTCALL
|
||||||
|
IntTranslateKbdMessage(LPMSG lpMsg, HKL dwhkl);
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: keyboard.c,v 1.20 2003/12/13 06:19:59 arty Exp $
|
/* $Id: keyboard.c,v 1.21 2003/12/28 14:21:03 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -574,42 +574,38 @@ PKBDTABLES W32kGetDefaultKeyLayout() {
|
||||||
return pkKeyboardLayout;
|
return pkKeyboardLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL FASTCALL
|
||||||
NtUserTranslateMessage(LPMSG lpMsg,
|
IntTranslateKbdMessage(LPMSG lpMsg,
|
||||||
HKL dwhkl) /* Used to pass the kbd layout */
|
HKL dwhkl)
|
||||||
{
|
{
|
||||||
static INT dead_char = 0;
|
static INT dead_char = 0;
|
||||||
LONG UState = 0;
|
LONG UState = 0;
|
||||||
WCHAR wp[2] = { 0 };
|
WCHAR wp[2] = { 0 };
|
||||||
MSG NewMsg = { 0 };
|
MSG NewMsg = { 0 };
|
||||||
MSG InMsg = { 0 };
|
|
||||||
PUSER_MESSAGE UMsg;
|
PUSER_MESSAGE UMsg;
|
||||||
PKBDTABLES keyLayout;
|
PKBDTABLES keyLayout;
|
||||||
BOOL Result = FALSE;
|
BOOL Result = FALSE;
|
||||||
DWORD ScanCode = 0;
|
DWORD ScanCode = 0;
|
||||||
|
|
||||||
if( !NT_SUCCESS(MmCopyFromCaller(&InMsg, lpMsg, sizeof(InMsg))) ) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
keyLayout = PsGetWin32Thread()->KeyboardLayout;
|
keyLayout = PsGetWin32Thread()->KeyboardLayout;
|
||||||
if( !keyLayout )
|
if( !keyLayout )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (InMsg.message != WM_KEYDOWN && InMsg.message != WM_SYSKEYDOWN)
|
if (lpMsg->message != WM_KEYDOWN && lpMsg->message != WM_SYSKEYDOWN)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ScanCode = (InMsg.lParam >> 16) & 0xff;
|
ScanCode = (lpMsg->lParam >> 16) & 0xff;
|
||||||
|
|
||||||
ExAcquireFastMutex(&QueueStateLock);
|
ExAcquireFastMutex(&QueueStateLock);
|
||||||
|
|
||||||
UState = ToUnicodeInner(InMsg.wParam, HIWORD(InMsg.lParam) & 0xff,
|
UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff,
|
||||||
QueueKeyStateTable, wp, 2, 0,
|
QueueKeyStateTable, wp, 2, 0,
|
||||||
keyLayout );
|
keyLayout );
|
||||||
|
|
||||||
if (UState == 1)
|
if (UState == 1)
|
||||||
{
|
{
|
||||||
NewMsg.message = (InMsg.message == WM_KEYDOWN) ? WM_CHAR : WM_SYSCHAR;
|
NewMsg.message = (lpMsg->message == WM_KEYDOWN) ? WM_CHAR : WM_SYSCHAR;
|
||||||
if (dead_char)
|
if (dead_char)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
@ -632,20 +628,20 @@ NtUserTranslateMessage(LPMSG lpMsg,
|
||||||
}
|
}
|
||||||
if (dead_char)
|
if (dead_char)
|
||||||
{
|
{
|
||||||
NewMsg.hwnd = InMsg.hwnd;
|
NewMsg.hwnd = lpMsg->hwnd;
|
||||||
NewMsg.wParam = dead_char;
|
NewMsg.wParam = dead_char;
|
||||||
NewMsg.lParam = InMsg.lParam;
|
NewMsg.lParam = lpMsg->lParam;
|
||||||
UMsg = MsqCreateMessage(&NewMsg);
|
UMsg = MsqCreateMessage(&NewMsg);
|
||||||
dead_char = 0;
|
dead_char = 0;
|
||||||
if (UMsg)
|
if (UMsg)
|
||||||
MsqPostMessage(PsGetWin32Thread()->MessageQueue, UMsg);
|
MsqPostMessage(PsGetWin32Thread()->MessageQueue, UMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewMsg.hwnd = InMsg.hwnd;
|
NewMsg.hwnd = lpMsg->hwnd;
|
||||||
NewMsg.wParam = wp[0];
|
NewMsg.wParam = wp[0];
|
||||||
NewMsg.lParam = InMsg.lParam;
|
NewMsg.lParam = lpMsg->lParam;
|
||||||
UMsg = MsqCreateMessage(&NewMsg);
|
UMsg = MsqCreateMessage(&NewMsg);
|
||||||
DPRINT( "CHAR='%c' %04x %08x\n", wp[0], wp[0], InMsg.lParam );
|
DPRINT( "CHAR='%c' %04x %08x\n", wp[0], wp[0], lpMsg->lParam );
|
||||||
if (UMsg)
|
if (UMsg)
|
||||||
MsqPostMessage(PsGetWin32Thread()->MessageQueue, UMsg);
|
MsqPostMessage(PsGetWin32Thread()->MessageQueue, UMsg);
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
|
@ -653,10 +649,10 @@ NtUserTranslateMessage(LPMSG lpMsg,
|
||||||
else if (UState == -1)
|
else if (UState == -1)
|
||||||
{
|
{
|
||||||
NewMsg.message =
|
NewMsg.message =
|
||||||
(InMsg.message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR;
|
(lpMsg->message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR;
|
||||||
NewMsg.hwnd = InMsg.hwnd;
|
NewMsg.hwnd = lpMsg->hwnd;
|
||||||
NewMsg.wParam = wp[0];
|
NewMsg.wParam = wp[0];
|
||||||
NewMsg.lParam = InMsg.lParam;
|
NewMsg.lParam = lpMsg->lParam;
|
||||||
dead_char = wp[0];
|
dead_char = wp[0];
|
||||||
UMsg = MsqCreateMessage(&NewMsg);
|
UMsg = MsqCreateMessage(&NewMsg);
|
||||||
if (UMsg)
|
if (UMsg)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: message.c,v 1.44 2003/12/28 13:53:14 weiden Exp $
|
/* $Id: message.c,v 1.45 2003/12/28 14:21:03 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -149,6 +149,25 @@ NtUserDispatchMessage(CONST MSG* UnsafeMsg)
|
||||||
return IntDispatchMessage(&Msg);
|
return IntDispatchMessage(&Msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
NtUserTranslateMessage(LPMSG lpMsg,
|
||||||
|
HKL dwhkl)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
MSG SafeMsg;
|
||||||
|
|
||||||
|
Status = MmCopyFromCaller(&SafeMsg, lpMsg, sizeof(MSG));
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IntTranslateKbdMessage(&SafeMsg, dwhkl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
IntSendSpecialMessages(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg)
|
IntSendSpecialMessages(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue