mirror of
https://github.com/reactos/reactos.git
synced 2024-09-09 12:20:21 +00:00
modified MsqInsertSystemMessage() so it prevents the system message queue from having more than one WM_MOUSEMOVE message. This should improve moving windows and reduce sending unnecessary WM_MOUSEMOVE messages to applications
svn path=/trunk/; revision=5852
This commit is contained in:
parent
7b2f150c3c
commit
9acc460ae1
|
@ -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.15 2003/08/19 11:48:49 weiden Exp $
|
/* $Id: msgqueue.c,v 1.16 2003/08/25 14:26:30 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -124,12 +124,50 @@ MsqInitializeImpl(VOID)
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LPMSG FASTCALL
|
||||||
|
MsgFindSystemMessage(UINT message)
|
||||||
|
{
|
||||||
|
ULONG QueuePos;
|
||||||
|
LPMSG Result = NULL;
|
||||||
|
MSG Msg;
|
||||||
|
|
||||||
|
if(SystemMessageQueueCount > 0)
|
||||||
|
{
|
||||||
|
QueuePos = SystemMessageQueueTail;
|
||||||
|
while(QueuePos >= SystemMessageQueueHead)
|
||||||
|
{
|
||||||
|
Msg = SystemMessageQueue[QueuePos];
|
||||||
|
if(Msg.message == message)
|
||||||
|
{
|
||||||
|
Result = &Msg;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
QueuePos--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
MsqInsertSystemMessage(MSG* Msg)
|
MsqInsertSystemMessage(MSG* Msg)
|
||||||
{
|
{
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
LPMSG mmov = NULL;
|
||||||
|
|
||||||
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql);
|
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql);
|
||||||
|
|
||||||
|
/* only insert WM_MOUSEMOVE messages if not already in system message queue */
|
||||||
|
if(Msg->message == WM_MOUSEMOVE)
|
||||||
|
mmov = MsgFindSystemMessage(WM_MOUSEMOVE);
|
||||||
|
|
||||||
|
if(mmov)
|
||||||
|
{
|
||||||
|
/* overwrite the existing WM_MOUSEMOVE message */
|
||||||
|
*mmov = *Msg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (SystemMessageQueueCount == SYSTEM_MESSAGE_QUEUE_SIZE)
|
if (SystemMessageQueueCount == SYSTEM_MESSAGE_QUEUE_SIZE)
|
||||||
{
|
{
|
||||||
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql);
|
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql);
|
||||||
|
@ -139,6 +177,7 @@ MsqInsertSystemMessage(MSG* Msg)
|
||||||
SystemMessageQueueTail =
|
SystemMessageQueueTail =
|
||||||
(SystemMessageQueueTail + 1) % SYSTEM_MESSAGE_QUEUE_SIZE;
|
(SystemMessageQueueTail + 1) % SYSTEM_MESSAGE_QUEUE_SIZE;
|
||||||
SystemMessageQueueCount++;
|
SystemMessageQueueCount++;
|
||||||
|
}
|
||||||
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql);
|
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql);
|
||||||
KeSetEvent(&HardwareMessageEvent, IO_NO_INCREMENT, FALSE);
|
KeSetEvent(&HardwareMessageEvent, IO_NO_INCREMENT, FALSE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue