Author: tkreuzer
Date: Thu Jun 5 11:57:27 2008
New Revision: 33860
URL: http://svn.reactos.org/svn/reactos?rev=33860&view=rev
Log:
co_MsqTranslateMouseMessage:
- add a comment about who removes a message from a queue
- fix filter handling (typo)
- correct the callers next list entry, if it might have been deleted. Yes, it's ugly, but the only way I could currently think of without rewriting everything and it was already ugly before. This fixes bug 2317 and some random crashes with FF.
See issue #2317 for more details.
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Thu Jun 5 11:57:27 2008
@@ -262,7 +262,7 @@
BOOL static STDCALL
co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT FilterLow, UINT FilterHigh,
PUSER_MESSAGE Message, BOOL Remove, PBOOL Freed,
- PWINDOW_OBJECT ScopeWin, PPOINT ScreenPoint, BOOL FromGlobalQueue)
+ PWINDOW_OBJECT ScopeWin, PPOINT ScreenPoint, BOOL FromGlobalQueue, PLIST_ENTRY *Next)
{
USHORT Msg = Message->Msg.message;
PWINDOW_OBJECT Window = NULL;
@@ -319,6 +319,7 @@
MessageQueue->MouseMoveMsg = NULL;
}
}
+ // when FromGlobalQueue is true, the caller has already removed the Message
ExFreePool(Message);
*Freed = TRUE;
return(FALSE);
@@ -386,7 +387,7 @@
*ScreenPoint = Message->Msg.pt;
if((hWnd != NULL && Window->hSelf != hWnd) ||
- ((FilterLow != 0 || FilterLow != 0) && (Msg < FilterLow || Msg > FilterHigh)))
+ ((FilterLow != 0 || FilterHigh != 0) && (Msg < FilterLow || Msg > FilterHigh)))
{
/* Reject the message because it doesn't match the filter */
@@ -410,6 +411,11 @@
/* delete the old message */
RemoveEntryList(&Window->MessageQueue->MouseMoveMsg->ListEntry);
ExFreePool(Window->MessageQueue->MouseMoveMsg);
+ if (!FromGlobalQueue)
+ {
+ // We might have deleted the next one in our queue, so fix next
+ *Next = Message->ListEntry.Flink;
+ }
}
/* always save a pointer to this WM_MOUSEMOVE message here because we're
sure that the message is in the private queue */
@@ -521,7 +527,7 @@
Accept = co_MsqTranslateMouseMessage(MessageQueue, hWnd, FilterLow, FilterHigh,
Current, Remove, &Freed,
- DesktopWindow, &ScreenPoint, FALSE);
+ DesktopWindow, &ScreenPoint, FALSE, &CurrentEntry);
if (Accept)
{
if (Remove)
@@ -621,7 +627,7 @@
/* Translate the message. */
Accept = co_MsqTranslateMouseMessage(MessageQueue, hWnd, FilterLow, FilterHigh,
Current, Remove, &Freed,
- DesktopWindow, &ScreenPoint, TRUE);
+ DesktopWindow, &ScreenPoint, TRUE, NULL);
if (Accept)
{
/* Check for no more messages in the system queue. */