mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[win32k]
- For the Low Level Mouse Hook (WH_MOUSE_LL), input can come from the mouse driver or mouse_event. Both of which result in a call to UserSetCursorPos. UserMode SetCursorPos API also ends up here. Add BOOL parameter that can be used to determine if hooks are to be called. - Move the code related to calling the hook procedure from MsqInsertSystemMessage into UserSetCursorPos and call the hook procedure here if needed. If hook procedure returns non 0 value. Dont insert the system message. - Fixes a recursive call to the hook procedure resulting thread using to much stack exposed by user32 winetest for input. svn path=/trunk/; revision=47325
This commit is contained in:
parent
dcc025f6e3
commit
38734242d5
5 changed files with 42 additions and 36 deletions
|
@ -77,7 +77,7 @@ BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxW
|
|||
INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags);
|
||||
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon);
|
||||
|
||||
BOOL UserSetCursorPos( INT x, INT y);
|
||||
BOOL UserSetCursorPos( INT x, INT y, BOOL CallHooks);
|
||||
|
||||
int UserShowCursor(BOOL bShow);
|
||||
|
||||
|
|
|
@ -175,10 +175,12 @@ UserSetCursor(
|
|||
return hOldCursor;
|
||||
}
|
||||
|
||||
BOOL UserSetCursorPos( INT x, INT y)
|
||||
BOOL UserSetCursorPos( INT x, INT y, BOOL CallHooks)
|
||||
{
|
||||
PWINDOW_OBJECT DesktopWindow;
|
||||
PSYSTEM_CURSORINFO CurInfo;
|
||||
LARGE_INTEGER LargeTickCount;
|
||||
MSLLHOOKSTRUCT MouseHookData;
|
||||
HDC hDC;
|
||||
MSG Msg;
|
||||
|
||||
|
@ -221,6 +223,9 @@ BOOL UserSetCursorPos( INT x, INT y)
|
|||
gpsi->ptCursor.x = x;
|
||||
gpsi->ptCursor.y = y;
|
||||
|
||||
KeQueryTickCount(&LargeTickCount);
|
||||
Msg.time = MsqCalculateMessageTime(&LargeTickCount);
|
||||
|
||||
//Move the mouse pointer
|
||||
GreMovePointer(hDC, x, y);
|
||||
|
||||
|
@ -229,8 +234,39 @@ BOOL UserSetCursorPos( INT x, INT y)
|
|||
Msg.wParam = CurInfo->ButtonsDown;
|
||||
Msg.lParam = MAKELPARAM(x, y);
|
||||
Msg.pt = gpsi->ptCursor;
|
||||
MsqInsertSystemMessage(&Msg);
|
||||
|
||||
MouseHookData.pt.x = LOWORD(Msg.lParam);
|
||||
MouseHookData.pt.y = HIWORD(Msg.lParam);
|
||||
switch(Msg.message)
|
||||
{
|
||||
case WM_MOUSEWHEEL:
|
||||
MouseHookData.mouseData = MAKELONG(0, GET_WHEEL_DELTA_WPARAM(Msg.wParam));
|
||||
break;
|
||||
case WM_XBUTTONDOWN:
|
||||
case WM_XBUTTONUP:
|
||||
case WM_XBUTTONDBLCLK:
|
||||
case WM_NCXBUTTONDOWN:
|
||||
case WM_NCXBUTTONUP:
|
||||
case WM_NCXBUTTONDBLCLK:
|
||||
MouseHookData.mouseData = MAKELONG(0, HIWORD(Msg.wParam));
|
||||
break;
|
||||
default:
|
||||
MouseHookData.mouseData = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
MouseHookData.flags = 0;
|
||||
MouseHookData.time = Msg.time;
|
||||
MouseHookData.dwExtraInfo = 0;
|
||||
|
||||
if (CallHooks)
|
||||
{
|
||||
/* If the hook procedure returned non zero, dont send the message */
|
||||
if (co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg.message, (LPARAM) &MouseHookData))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MsqInsertSystemMessage(&Msg);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -814,7 +850,7 @@ NtUserClipCursor(
|
|||
CurInfo->CursorClipInfo.Right = min(Rect.right, DesktopWindow->Wnd->rcWindow.right);
|
||||
CurInfo->CursorClipInfo.Bottom = min(Rect.bottom, DesktopWindow->Wnd->rcWindow.bottom);
|
||||
|
||||
UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y);
|
||||
UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y, FALSE);
|
||||
|
||||
RETURN(TRUE);
|
||||
}
|
||||
|
|
|
@ -1128,7 +1128,7 @@ IntMouseInput(MOUSEINPUT *mi)
|
|||
|
||||
if(mi->dwFlags & MOUSEEVENTF_MOVE)
|
||||
{
|
||||
UserSetCursorPos(MousePos.x, MousePos.y);
|
||||
UserSetCursorPos(MousePos.x, MousePos.y, TRUE);
|
||||
}
|
||||
if(mi->dwFlags & MOUSEEVENTF_LEFTDOWN)
|
||||
{
|
||||
|
|
|
@ -171,38 +171,8 @@ MsqInitializeImpl(VOID)
|
|||
VOID FASTCALL
|
||||
MsqInsertSystemMessage(MSG* Msg)
|
||||
{
|
||||
LARGE_INTEGER LargeTickCount;
|
||||
KIRQL OldIrql;
|
||||
ULONG Prev;
|
||||
MSLLHOOKSTRUCT MouseHookData;
|
||||
|
||||
KeQueryTickCount(&LargeTickCount);
|
||||
Msg->time = MsqCalculateMessageTime(&LargeTickCount);
|
||||
|
||||
MouseHookData.pt.x = LOWORD(Msg->lParam);
|
||||
MouseHookData.pt.y = HIWORD(Msg->lParam);
|
||||
switch(Msg->message)
|
||||
{
|
||||
case WM_MOUSEWHEEL:
|
||||
MouseHookData.mouseData = MAKELONG(0, GET_WHEEL_DELTA_WPARAM(Msg->wParam));
|
||||
break;
|
||||
case WM_XBUTTONDOWN:
|
||||
case WM_XBUTTONUP:
|
||||
case WM_XBUTTONDBLCLK:
|
||||
case WM_NCXBUTTONDOWN:
|
||||
case WM_NCXBUTTONUP:
|
||||
case WM_NCXBUTTONDBLCLK:
|
||||
MouseHookData.mouseData = MAKELONG(0, HIWORD(Msg->wParam));
|
||||
break;
|
||||
default:
|
||||
MouseHookData.mouseData = 0;
|
||||
break;
|
||||
}
|
||||
MouseHookData.flags = 0;
|
||||
MouseHookData.time = Msg->time;
|
||||
MouseHookData.dwExtraInfo = 0;
|
||||
if( co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg->message, (LPARAM) &MouseHookData))
|
||||
return;
|
||||
|
||||
/*
|
||||
* If we got WM_MOUSEMOVE and there are already messages in the
|
||||
|
|
|
@ -440,7 +440,7 @@ NtUserCallTwoParam(
|
|||
RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
|
||||
|
||||
case TWOPARAM_ROUTINE_SETCURSORPOS:
|
||||
RETURN( (DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2));
|
||||
RETURN( (DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2, FALSE));
|
||||
|
||||
}
|
||||
DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
|
||||
|
|
Loading…
Reference in a new issue