mirror of
https://github.com/reactos/reactos.git
synced 2025-05-13 14:20:31 +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
|
* 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: 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
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: Mouse
|
* PURPOSE: Mouse
|
||||||
|
@ -311,7 +311,7 @@ MouseMoveCursor(LONG X, LONG Y)
|
||||||
Msg.time = TickCount;
|
Msg.time = TickCount;
|
||||||
Msg.pt.x = X;
|
Msg.pt.x = X;
|
||||||
Msg.pt.y = Y;
|
Msg.pt.y = Y;
|
||||||
MsqInsertSystemMessage(&Msg);
|
MsqInsertSystemMessage(&Msg, TRUE);
|
||||||
/* move cursor */
|
/* move cursor */
|
||||||
CurInfo->x = X;
|
CurInfo->x = X;
|
||||||
CurInfo->y = Y;
|
CurInfo->y = Y;
|
||||||
|
@ -413,7 +413,7 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
|
|
||||||
if ((0 != Data[i].LastX) || (0 != Data[i].LastY))
|
if ((0 != Data[i].LastX) || (0 != Data[i].LastY))
|
||||||
{
|
{
|
||||||
MsqInsertSystemMessage(&Msg);
|
MsqInsertSystemMessage(&Msg, FALSE);
|
||||||
MouseMoveAdded = TRUE;
|
MouseMoveAdded = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
Msg.message = WM_RBUTTONUP;
|
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.pt.y = CurInfo->y;
|
||||||
Msg.time = TickCount;
|
Msg.time = TickCount;
|
||||||
Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y);
|
Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y);
|
||||||
MsqInsertSystemMessage(&Msg);
|
MsqInsertSystemMessage(&Msg, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CurInfo->SafetySwitch && !CurInfo->SafetySwitch2 &&
|
if (!CurInfo->SafetySwitch && !CurInfo->SafetySwitch2 &&
|
||||||
|
@ -532,7 +532,8 @@ EnableMouse(HDC hDisplayDC)
|
||||||
CurInfo);
|
CurInfo);
|
||||||
|
|
||||||
PointerStatus = SurfGDI->SetPointerShape(SurfObj, MouseSurf, NULL, NULL,
|
PointerStatus = SurfGDI->SetPointerShape(SurfObj, MouseSurf, NULL, NULL,
|
||||||
0, 0,
|
SysCursor->hx,
|
||||||
|
SysCursor->hy,
|
||||||
CurInfo->x,
|
CurInfo->x,
|
||||||
CurInfo->y,
|
CurInfo->y,
|
||||||
&MouseRect,
|
&MouseRect,
|
||||||
|
|
|
@ -128,7 +128,7 @@ IntSendMessage(HWND hWnd,
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
MsqInsertSystemMessage(MSG* Msg);
|
MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg);
|
||||||
|
|
||||||
inline BOOL MsqIsSignaled( PUSER_MESSAGE_QUEUE queue );
|
inline BOOL MsqIsSignaled( PUSER_MESSAGE_QUEUE queue );
|
||||||
inline VOID MsqSetQueueBits( PUSER_MESSAGE_QUEUE queue, WORD bits );
|
inline VOID MsqSetQueueBits( PUSER_MESSAGE_QUEUE queue, WORD bits );
|
||||||
|
|
|
@ -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: 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -48,6 +48,7 @@ static MSG SystemMessageQueue[SYSTEM_MESSAGE_QUEUE_SIZE];
|
||||||
static ULONG SystemMessageQueueHead = 0;
|
static ULONG SystemMessageQueueHead = 0;
|
||||||
static ULONG SystemMessageQueueTail = 0;
|
static ULONG SystemMessageQueueTail = 0;
|
||||||
static ULONG SystemMessageQueueCount = 0;
|
static ULONG SystemMessageQueueCount = 0;
|
||||||
|
static ULONG SystemMessageQueueMouseMove = -1;
|
||||||
static KSPIN_LOCK SystemMessageQueueLock;
|
static KSPIN_LOCK SystemMessageQueueLock;
|
||||||
|
|
||||||
static ULONG HardwareMessageQueueStamp = 0;
|
static ULONG HardwareMessageQueueStamp = 0;
|
||||||
|
@ -124,52 +125,8 @@ MsqInitializeImpl(VOID)
|
||||||
return(STATUS_SUCCESS);
|
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
|
VOID FASTCALL
|
||||||
MsqInsertSystemMessage(MSG* Msg)
|
MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg)
|
||||||
{
|
{
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
ULONG mmov = (ULONG)-1;
|
ULONG mmov = (ULONG)-1;
|
||||||
|
@ -177,16 +134,17 @@ MsqInsertSystemMessage(MSG* Msg)
|
||||||
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql);
|
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql);
|
||||||
|
|
||||||
/* only insert WM_MOUSEMOVE messages if not already in system message queue */
|
/* only insert WM_MOUSEMOVE messages if not already in system message queue */
|
||||||
//if(Msg->message == WM_MOUSEMOVE)
|
if((Msg->message == WM_MOUSEMOVE) && RemMouseMoveMsg)
|
||||||
// mmov = MsgFindSystemMouseMoveMessage();
|
mmov = SystemMessageQueueMouseMove;
|
||||||
|
|
||||||
if(mmov != (ULONG)-1)
|
if(mmov != (ULONG)-1)
|
||||||
{
|
{
|
||||||
/* insert message at the queue head */
|
/* insert message at the queue head */
|
||||||
while(mmov > SystemMessageQueueHead)
|
while (mmov != SystemMessageQueueHead )
|
||||||
{
|
{
|
||||||
SystemMessageQueue[mmov] = SystemMessageQueue[mmov - 1];
|
ULONG prev = mmov ? mmov - 1 : SYSTEM_MESSAGE_QUEUE_SIZE - 1;
|
||||||
mmov--;
|
SystemMessageQueue[mmov] = SystemMessageQueue[prev];
|
||||||
|
mmov = prev;
|
||||||
}
|
}
|
||||||
SystemMessageQueue[SystemMessageQueueHead] = *Msg;
|
SystemMessageQueue[SystemMessageQueueHead] = *Msg;
|
||||||
}
|
}
|
||||||
|
@ -198,6 +156,8 @@ MsqInsertSystemMessage(MSG* Msg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SystemMessageQueue[SystemMessageQueueTail] = *Msg;
|
SystemMessageQueue[SystemMessageQueueTail] = *Msg;
|
||||||
|
if(Msg->message == WM_MOUSEMOVE)
|
||||||
|
SystemMessageQueueMouseMove = SystemMessageQueueTail;
|
||||||
SystemMessageQueueTail =
|
SystemMessageQueueTail =
|
||||||
(SystemMessageQueueTail + 1) % SYSTEM_MESSAGE_QUEUE_SIZE;
|
(SystemMessageQueueTail + 1) % SYSTEM_MESSAGE_QUEUE_SIZE;
|
||||||
SystemMessageQueueCount++;
|
SystemMessageQueueCount++;
|
||||||
|
@ -381,6 +341,11 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
|
||||||
InsertTailList(&HardwareMessageQueueHead, &UserMsg->ListEntry);
|
InsertTailList(&HardwareMessageQueueHead, &UserMsg->ListEntry);
|
||||||
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql);
|
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);
|
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql);
|
||||||
HardwareMessageQueueStamp++;
|
HardwareMessageQueueStamp++;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue