mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
another fix to message queues and fixed handling of WM_XBUTTONDOWN messages
svn path=/trunk/; revision=7068
This commit is contained in:
parent
d4dd1a3915
commit
c9edcad72d
1 changed files with 27 additions and 25 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: msgqueue.c,v 1.45 2003/12/14 19:04:51 weiden Exp $
|
/* $Id: msgqueue.c,v 1.46 2003/12/14 22:14:45 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -177,7 +177,7 @@ MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg)
|
||||||
|
|
||||||
BOOL STATIC STDCALL
|
BOOL STATIC STDCALL
|
||||||
MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
PUSER_MESSAGE Message, BOOL Remove,
|
PUSER_MESSAGE Message, BOOL Remove, PBOOL Freed,
|
||||||
PWINDOW_OBJECT ScopeWin, PUSHORT HitTest,
|
PWINDOW_OBJECT ScopeWin, PUSHORT HitTest,
|
||||||
PPOINT ScreenPoint, PBOOL MouseClick)
|
PPOINT ScreenPoint, PBOOL MouseClick)
|
||||||
{
|
{
|
||||||
|
@ -206,19 +206,19 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
Message->Msg.hwnd = Wnd;
|
Message->Msg.hwnd = Wnd;
|
||||||
Message->Msg.lParam = MAKELONG(Message->Msg.pt.x, Message->Msg.pt.y);
|
Message->Msg.lParam = MAKELONG(Message->Msg.pt.x, Message->Msg.pt.y);
|
||||||
}
|
}
|
||||||
|
*Freed = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(Message);
|
ExFreePool(Message);
|
||||||
|
*Freed = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Handle WM_XBUTTONDOWN messages differently too. We need to check to see
|
|
||||||
**if the cursor is above an inactive window.
|
|
||||||
*/
|
|
||||||
if (Msg == WM_LBUTTONDOWN ||
|
if (Msg == WM_LBUTTONDOWN ||
|
||||||
Msg == WM_MBUTTONDOWN ||
|
Msg == WM_MBUTTONDOWN ||
|
||||||
Msg == WM_RBUTTONDOWN )
|
Msg == WM_RBUTTONDOWN ||
|
||||||
|
Msg == WM_XBUTTONDOWN)
|
||||||
{
|
{
|
||||||
*ScreenPoint = Message->Msg.pt;
|
*ScreenPoint = Message->Msg.pt;
|
||||||
Wnd = NtUserWindowFromPoint(ScreenPoint->x, ScreenPoint->y);
|
Wnd = NtUserWindowFromPoint(ScreenPoint->x, ScreenPoint->y);
|
||||||
|
@ -239,11 +239,13 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
switch (Result)
|
switch (Result)
|
||||||
{
|
{
|
||||||
case MA_NOACTIVATEANDEAT:
|
case MA_NOACTIVATEANDEAT:
|
||||||
|
*Freed = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case MA_NOACTIVATE:
|
case MA_NOACTIVATE:
|
||||||
break;
|
break;
|
||||||
case MA_ACTIVATEANDEAT:
|
case MA_ACTIVATEANDEAT:
|
||||||
NtUserSetFocus(Wnd);
|
NtUserSetFocus(Wnd);
|
||||||
|
*Freed = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
/* case MA_ACTIVATE:
|
/* case MA_ACTIVATE:
|
||||||
case 0:*/
|
case 0:*/
|
||||||
|
@ -255,6 +257,7 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExFreePool(Message);
|
ExFreePool(Message);
|
||||||
|
*Freed = TRUE;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,6 +279,7 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
if (Window == NULL)
|
if (Window == NULL)
|
||||||
{
|
{
|
||||||
ExFreePool(Message);
|
ExFreePool(Message);
|
||||||
|
*Freed = TRUE;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,12 +290,19 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
&Message->ListEntry);
|
&Message->ListEntry);
|
||||||
ExReleaseFastMutex(&Window->MessageQueue->HardwareLock);
|
ExReleaseFastMutex(&Window->MessageQueue->HardwareLock);
|
||||||
KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
|
KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
|
||||||
|
*Freed = FALSE;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hWnd != NULL && Window->Self != hWnd &&
|
if (hWnd != NULL && Window->Self != hWnd &&
|
||||||
!IntIsChildWindow(hWnd, Window->Self))
|
!IntIsChildWindow(hWnd, Window->Self))
|
||||||
{
|
{
|
||||||
|
ExAcquireFastMutex(&Window->MessageQueue->HardwareLock);
|
||||||
|
InsertTailList(&Window->MessageQueue->HardwareMessagesListHead,
|
||||||
|
&Message->ListEntry);
|
||||||
|
ExReleaseFastMutex(&Window->MessageQueue->HardwareLock);
|
||||||
|
KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
|
||||||
|
*Freed = FALSE;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,17 +327,8 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
|
|
||||||
if ((*HitTest) != HTCLIENT)
|
if ((*HitTest) != HTCLIENT)
|
||||||
{
|
{
|
||||||
switch(Msg)
|
Msg += WM_NCMOUSEMOVE - WM_MOUSEMOVE;
|
||||||
{
|
Message->Msg.wParam = *HitTest;
|
||||||
case WM_XBUTTONDOWN:
|
|
||||||
case WM_XBUTTONUP:
|
|
||||||
case WM_XBUTTONDBLCLK:
|
|
||||||
return FALSE;
|
|
||||||
default:
|
|
||||||
Msg += WM_NCMOUSEMOVE - WM_MOUSEMOVE;
|
|
||||||
Message->Msg.wParam = *HitTest;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -342,7 +344,8 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
Message->Msg.message = Msg;
|
Message->Msg.message = Msg;
|
||||||
Message->Msg.lParam = MAKELONG(Point.x, Point.y);
|
Message->Msg.lParam = MAKELONG(Point.x, Point.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*Freed = FALSE;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +357,7 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
USHORT HitTest;
|
USHORT HitTest;
|
||||||
POINT ScreenPoint;
|
POINT ScreenPoint;
|
||||||
BOOL Accept;
|
BOOL Accept, Freed;
|
||||||
BOOL MouseClick;
|
BOOL MouseClick;
|
||||||
PLIST_ENTRY CurrentEntry;
|
PLIST_ENTRY CurrentEntry;
|
||||||
PWINDOW_OBJECT DesktopWindow;
|
PWINDOW_OBJECT DesktopWindow;
|
||||||
|
@ -379,7 +382,7 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
|
||||||
Current->Msg.message <= WM_MOUSELAST)
|
Current->Msg.message <= WM_MOUSELAST)
|
||||||
{
|
{
|
||||||
Accept = MsqTranslateMouseMessage(hWnd, FilterLow, FilterHigh,
|
Accept = MsqTranslateMouseMessage(hWnd, FilterLow, FilterHigh,
|
||||||
Current, Remove,
|
Current, Remove, &Freed,
|
||||||
DesktopWindow, &HitTest,
|
DesktopWindow, &HitTest,
|
||||||
&ScreenPoint, &MouseClick);
|
&ScreenPoint, &MouseClick);
|
||||||
if (Accept)
|
if (Accept)
|
||||||
|
@ -393,10 +396,9 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
|
||||||
IntReleaseWindowObject(DesktopWindow);
|
IntReleaseWindowObject(DesktopWindow);
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if(Freed)
|
||||||
RemoveEntryList(&Current->ListEntry);
|
RemoveEntryList(&Current->ListEntry);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExReleaseFastMutex(&MessageQueue->HardwareLock);
|
ExReleaseFastMutex(&MessageQueue->HardwareLock);
|
||||||
|
@ -447,7 +449,7 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
|
||||||
ExReleaseFastMutex(&HardwareMessageQueueLock);
|
ExReleaseFastMutex(&HardwareMessageQueueLock);
|
||||||
/* Translate the message. */
|
/* Translate the message. */
|
||||||
Accept = MsqTranslateMouseMessage(hWnd, FilterLow, FilterHigh,
|
Accept = MsqTranslateMouseMessage(hWnd, FilterLow, FilterHigh,
|
||||||
Current, Remove,
|
Current, Remove, &Freed,
|
||||||
DesktopWindow, &HitTest,
|
DesktopWindow, &HitTest,
|
||||||
&ScreenPoint, &MouseClick);
|
&ScreenPoint, &MouseClick);
|
||||||
ExAcquireFastMutex(&HardwareMessageQueueLock);
|
ExAcquireFastMutex(&HardwareMessageQueueLock);
|
||||||
|
|
Loading…
Reference in a new issue