mirror of
https://github.com/reactos/reactos.git
synced 2025-05-12 13:58:16 +00:00
1. finally fixed handling the WM_MOUSEMOVE messages, credits go to Royce :)
2. Now passing cursor's hotspot position to SetPointerShape svn path=/trunk/; revision=5874
This commit is contained in:
parent
d239b6fbb7
commit
51b70de9b7
3 changed files with 57 additions and 91 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: mouse.c,v 1.35 2003/08/26 00:33:53 weiden Exp $
|
||||
/* $Id: mouse.c,v 1.36 2003/08/26 19:26:02 weiden Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Mouse
|
||||
|
@ -311,7 +311,7 @@ MouseMoveCursor(LONG X, LONG Y)
|
|||
Msg.time = TickCount;
|
||||
Msg.pt.x = X;
|
||||
Msg.pt.y = Y;
|
||||
MsqInsertSystemMessage(&Msg);
|
||||
MsqInsertSystemMessage(&Msg, TRUE);
|
||||
/* move cursor */
|
||||
CurInfo->x = X;
|
||||
CurInfo->y = Y;
|
||||
|
@ -413,7 +413,7 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
|||
|
||||
if ((0 != Data[i].LastX) || (0 != Data[i].LastY))
|
||||
{
|
||||
MsqInsertSystemMessage(&Msg);
|
||||
MsqInsertSystemMessage(&Msg, FALSE);
|
||||
MouseMoveAdded = TRUE;
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
|||
Msg.message = WM_RBUTTONUP;
|
||||
}
|
||||
|
||||
MsqInsertSystemMessage(&Msg);
|
||||
MsqInsertSystemMessage(&Msg, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -467,7 +467,7 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
|||
Msg.pt.y = CurInfo->y;
|
||||
Msg.time = TickCount;
|
||||
Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y);
|
||||
MsqInsertSystemMessage(&Msg);
|
||||
MsqInsertSystemMessage(&Msg, TRUE);
|
||||
}
|
||||
|
||||
if (!CurInfo->SafetySwitch && !CurInfo->SafetySwitch2 &&
|
||||
|
@ -532,7 +532,8 @@ EnableMouse(HDC hDisplayDC)
|
|||
CurInfo);
|
||||
|
||||
PointerStatus = SurfGDI->SetPointerShape(SurfObj, MouseSurf, NULL, NULL,
|
||||
0, 0,
|
||||
SysCursor->hx,
|
||||
SysCursor->hy,
|
||||
CurInfo->x,
|
||||
CurInfo->y,
|
||||
&MouseRect,
|
||||
|
|
|
@ -128,7 +128,7 @@ IntSendMessage(HWND hWnd,
|
|||
VOID STDCALL
|
||||
MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
VOID FASTCALL
|
||||
MsqInsertSystemMessage(MSG* Msg);
|
||||
MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg);
|
||||
|
||||
inline BOOL MsqIsSignaled( PUSER_MESSAGE_QUEUE queue );
|
||||
inline VOID MsqSetQueueBits( PUSER_MESSAGE_QUEUE queue, WORD bits );
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: msgqueue.c,v 1.19 2003/08/26 00:06:16 weiden Exp $
|
||||
/* $Id: msgqueue.c,v 1.20 2003/08/26 19:26:02 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -48,6 +48,7 @@ static MSG SystemMessageQueue[SYSTEM_MESSAGE_QUEUE_SIZE];
|
|||
static ULONG SystemMessageQueueHead = 0;
|
||||
static ULONG SystemMessageQueueTail = 0;
|
||||
static ULONG SystemMessageQueueCount = 0;
|
||||
static ULONG SystemMessageQueueMouseMove = -1;
|
||||
static KSPIN_LOCK SystemMessageQueueLock;
|
||||
|
||||
static ULONG HardwareMessageQueueStamp = 0;
|
||||
|
@ -124,52 +125,8 @@ MsqInitializeImpl(VOID)
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
ULONG FASTCALL
|
||||
MsgFindSystemMouseMoveMessage()
|
||||
{
|
||||
LPMSG Msg, Msg2;
|
||||
ULONG QueuePos;
|
||||
|
||||
if(SystemMessageQueueCount > 0)
|
||||
{
|
||||
QueuePos = SystemMessageQueueTail;
|
||||
while(QueuePos >= SystemMessageQueueHead)
|
||||
{
|
||||
Msg = &SystemMessageQueue[QueuePos];
|
||||
if(Msg->message == WM_MOUSEMOVE)
|
||||
{
|
||||
if(SystemMessageQueueHead == QueuePos)
|
||||
return QueuePos;
|
||||
|
||||
/* if there is one of the following messages after a
|
||||
WM_MOUSEMOVE message then skip it */
|
||||
Msg2 = &SystemMessageQueue[QueuePos - 1];
|
||||
switch(Msg2->message)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_MBUTTONUP:
|
||||
#if 0
|
||||
case WM_XBUTTONDOWN:
|
||||
case WM_XBUTTONUP:
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
return QueuePos;
|
||||
}
|
||||
}
|
||||
QueuePos--;
|
||||
}
|
||||
}
|
||||
|
||||
return (ULONG)-1;
|
||||
}
|
||||
|
||||
VOID FASTCALL
|
||||
MsqInsertSystemMessage(MSG* Msg)
|
||||
MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
ULONG mmov = (ULONG)-1;
|
||||
|
@ -177,16 +134,17 @@ MsqInsertSystemMessage(MSG* Msg)
|
|||
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql);
|
||||
|
||||
/* only insert WM_MOUSEMOVE messages if not already in system message queue */
|
||||
//if(Msg->message == WM_MOUSEMOVE)
|
||||
// mmov = MsgFindSystemMouseMoveMessage();
|
||||
if((Msg->message == WM_MOUSEMOVE) && RemMouseMoveMsg)
|
||||
mmov = SystemMessageQueueMouseMove;
|
||||
|
||||
if(mmov != (ULONG)-1)
|
||||
{
|
||||
/* insert message at the queue head */
|
||||
while(mmov > SystemMessageQueueHead)
|
||||
while (mmov != SystemMessageQueueHead )
|
||||
{
|
||||
SystemMessageQueue[mmov] = SystemMessageQueue[mmov - 1];
|
||||
mmov--;
|
||||
ULONG prev = mmov ? mmov - 1 : SYSTEM_MESSAGE_QUEUE_SIZE - 1;
|
||||
SystemMessageQueue[mmov] = SystemMessageQueue[prev];
|
||||
mmov = prev;
|
||||
}
|
||||
SystemMessageQueue[SystemMessageQueueHead] = *Msg;
|
||||
}
|
||||
|
@ -198,6 +156,8 @@ MsqInsertSystemMessage(MSG* Msg)
|
|||
return;
|
||||
}
|
||||
SystemMessageQueue[SystemMessageQueueTail] = *Msg;
|
||||
if(Msg->message == WM_MOUSEMOVE)
|
||||
SystemMessageQueueMouseMove = SystemMessageQueueTail;
|
||||
SystemMessageQueueTail =
|
||||
(SystemMessageQueueTail + 1) % SYSTEM_MESSAGE_QUEUE_SIZE;
|
||||
SystemMessageQueueCount++;
|
||||
|
@ -381,6 +341,11 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
|
|||
InsertTailList(&HardwareMessageQueueHead, &UserMsg->ListEntry);
|
||||
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql);
|
||||
}
|
||||
/*
|
||||
* we could set this to -1 conditionally if we find one, but
|
||||
* this is more efficient and just as effective.
|
||||
*/
|
||||
SystemMessageQueueMouseMove = -1;
|
||||
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql);
|
||||
HardwareMessageQueueStamp++;
|
||||
|
||||
|
|
Loading…
Reference in a new issue