- Some more cleanup

svn path=/trunk/; revision=49610
This commit is contained in:
Giannis Adamopoulos 2010-11-18 13:57:21 +00:00
parent 83c94373d7
commit 2b843622b4
6 changed files with 65 additions and 88 deletions

View file

@ -121,13 +121,19 @@ MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue,
VOID FASTCALL
MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode);
BOOLEAN APIENTRY
co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
IN BOOLEAN Hardware,
IN BOOLEAN Remove,
IN PWND Window,
IN UINT MsgFilterLow,
IN UINT MsgFilterHigh,
OUT PMSG Message);
MsqPeekMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
IN BOOLEAN Remove,
IN PWND Window,
IN UINT MsgFilterLow,
IN UINT MsgFilterHigh,
OUT PMSG Message);
BOOL APIENTRY
co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
IN BOOL Remove,
IN PWND Window,
IN UINT MsgFilterLow,
IN UINT MsgFilterHigh,
OUT MSG* pMsg);
BOOLEAN FASTCALL
MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue);
VOID FASTCALL
@ -196,7 +202,7 @@ co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
VOID FASTCALL
MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam);
VOID FASTCALL
MsqInsertMouseMessage(MSG* Msg);
co_MsqInsertMouseMessage(MSG* Msg);
BOOL FASTCALL
MsqIsClkLck(LPMSG Msg, BOOL Remove);
BOOL FASTCALL

View file

@ -217,7 +217,7 @@ BOOL UserSetCursorPos( INT x, INT y, BOOL SendMouseMoveMsg)
Msg.wParam = CurInfo->ButtonsDown;
Msg.lParam = MAKELPARAM(x, y);
Msg.pt = pt;
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
/* Store the new cursor position */

View file

@ -1156,7 +1156,7 @@ IntMouseInput(MOUSEINPUT *mi)
Msg.message = SwapBtnMsg[0][SwapButtons];
CurInfo->ButtonsDown |= SwapBtn[SwapButtons];
Msg.wParam |= CurInfo->ButtonsDown;
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
else if(mi->dwFlags & MOUSEEVENTF_LEFTUP)
{
@ -1164,7 +1164,7 @@ IntMouseInput(MOUSEINPUT *mi)
Msg.message = SwapBtnMsg[1][SwapButtons];
CurInfo->ButtonsDown &= ~SwapBtn[SwapButtons];
Msg.wParam |= CurInfo->ButtonsDown;
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
if(mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN)
{
@ -1172,7 +1172,7 @@ IntMouseInput(MOUSEINPUT *mi)
Msg.message = WM_MBUTTONDOWN;
CurInfo->ButtonsDown |= MK_MBUTTON;
Msg.wParam |= CurInfo->ButtonsDown;
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
else if(mi->dwFlags & MOUSEEVENTF_MIDDLEUP)
{
@ -1180,7 +1180,7 @@ IntMouseInput(MOUSEINPUT *mi)
Msg.message = WM_MBUTTONUP;
CurInfo->ButtonsDown &= ~MK_MBUTTON;
Msg.wParam |= CurInfo->ButtonsDown;
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
if(mi->dwFlags & MOUSEEVENTF_RIGHTDOWN)
{
@ -1188,7 +1188,7 @@ IntMouseInput(MOUSEINPUT *mi)
Msg.message = SwapBtnMsg[0][!SwapButtons];
CurInfo->ButtonsDown |= SwapBtn[!SwapButtons];
Msg.wParam |= CurInfo->ButtonsDown;
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
else if(mi->dwFlags & MOUSEEVENTF_RIGHTUP)
{
@ -1196,7 +1196,7 @@ IntMouseInput(MOUSEINPUT *mi)
Msg.message = SwapBtnMsg[1][!SwapButtons];
CurInfo->ButtonsDown &= ~SwapBtn[!SwapButtons];
Msg.wParam |= CurInfo->ButtonsDown;
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
if((mi->dwFlags & (MOUSEEVENTF_XDOWN | MOUSEEVENTF_XUP)) &&
@ -1214,14 +1214,14 @@ IntMouseInput(MOUSEINPUT *mi)
gQueueKeyStateTable[VK_XBUTTON1] |= 0xc0;
CurInfo->ButtonsDown |= MK_XBUTTON1;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1);
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
if(mi->mouseData & XBUTTON2)
{
gQueueKeyStateTable[VK_XBUTTON2] |= 0xc0;
CurInfo->ButtonsDown |= MK_XBUTTON2;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2);
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
}
else if(mi->dwFlags & MOUSEEVENTF_XUP)
@ -1232,21 +1232,21 @@ IntMouseInput(MOUSEINPUT *mi)
gQueueKeyStateTable[VK_XBUTTON1] &= ~0x80;
CurInfo->ButtonsDown &= ~MK_XBUTTON1;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1);
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
if(mi->mouseData & XBUTTON2)
{
gQueueKeyStateTable[VK_XBUTTON2] &= ~0x80;
CurInfo->ButtonsDown &= ~MK_XBUTTON2;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2);
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
}
if(mi->dwFlags & MOUSEEVENTF_WHEEL)
{
Msg.message = WM_MOUSEWHEEL;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, mi->mouseData);
MsqInsertMouseMessage(&Msg);
co_MsqInsertMouseMessage(&Msg);
}
return TRUE;

View file

@ -932,25 +932,23 @@ co_IntPeekMessage( PMSG Msg,
}
/* Now check for normal messages. */
if (co_MsqFindMessage( ThreadQueue,
FALSE,
RemoveMessages,
Window,
MsgFilterMin,
MsgFilterMax,
Msg ))
if (MsqPeekMessage( ThreadQueue,
RemoveMessages,
Window,
MsgFilterMin,
MsgFilterMax,
Msg ))
{
return TRUE;
}
/* Check for hardware events. */
if(co_MsqFindMessage( ThreadQueue,
TRUE,
RemoveMessages,
Window,
MsgFilterMin,
MsgFilterMax,
Msg ))
if(co_MsqPeekHardwareMessage( ThreadQueue,
RemoveMessages,
Window,
MsgFilterMin,
MsgFilterMax,
Msg))
{
if(!ProcessHardwareMessage(Msg, RemoveMessages))

View file

@ -97,14 +97,20 @@ IntMsqClearWakeMask(VOID)
return TRUE;
}
VOID FASTCALL
MsqWakeQueue(PUSER_MESSAGE_QUEUE Queue, DWORD MessageBits)
{
Queue->QueueBits |= MessageBits;
Queue->ChangedBits |= MessageBits;
if (Queue->WakeMask & MessageBits)
KeSetEvent(Queue->NewMessages, IO_NO_INCREMENT, FALSE);
}
VOID FASTCALL
MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue)
{
Queue->PaintCount++;
Queue->QueueBits |= QS_PAINT;
Queue->ChangedBits |= QS_PAINT;
if (Queue->WakeMask & QS_PAINT)
KeSetEvent(Queue->NewMessages, IO_NO_INCREMENT, FALSE);
MsqWakeQueue(Queue, QS_PAINT);
}
VOID FASTCALL
@ -137,7 +143,7 @@ MsqInitializeImpl(VOID)
}
VOID FASTCALL
MsqInsertMouseMessage(MSG* Msg)
co_MsqInsertMouseMessage(MSG* Msg)
{
LARGE_INTEGER LargeTickCount;
KIRQL OldIrql;
@ -425,17 +431,11 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT
/* save the pointer to the WM_MOUSEMOVE message in the new queue */
CaptureWindow->head.pti->MessageQueue->MouseMoveMsg = Message;
CaptureWindow->head.pti->MessageQueue->QueueBits |= QS_MOUSEMOVE;
CaptureWindow->head.pti->MessageQueue->ChangedBits |= QS_MOUSEMOVE;
if (CaptureWindow->head.pti->MessageQueue->WakeMask & QS_MOUSEMOVE)
KeSetEvent(CaptureWindow->head.pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
MsqWakeQueue(CaptureWindow->head.pti->MessageQueue, QS_MOUSEMOVE);
}
else
{
CaptureWindow->head.pti->MessageQueue->QueueBits |= QS_MOUSEBUTTON;
CaptureWindow->head.pti->MessageQueue->ChangedBits |= QS_MOUSEBUTTON;
if (CaptureWindow->head.pti->MessageQueue->WakeMask & QS_MOUSEBUTTON)
KeSetEvent(CaptureWindow->head.pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
MsqWakeQueue(CaptureWindow->head.pti->MessageQueue, QS_MOUSEBUTTON);
}
IntUnLockHardwareMessageQueue(CaptureWindow->head.pti->MessageQueue);
@ -533,9 +533,12 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT
}
BOOL APIENTRY
co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
UINT FilterLow, UINT FilterHigh, BOOL Remove,
PMSG Message)
co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
IN BOOL Remove,
IN PWND Window,
IN UINT FilterLow,
IN UINT FilterHigh,
OUT PMSG Message)
{
KIRQL OldIrql;
POINT ScreenPoint;
@ -852,9 +855,6 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
UserDereferenceObject(Window);
ObDereferenceObject (Thread);
// InsertHeadList(&pThread->MessageQueue->PostedMessagesListHead,
// &Message->ListEntry);
// KeSetEvent(pThread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
}
PUSER_MESSAGE FASTCALL
@ -1097,10 +1097,7 @@ MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
{
InsertTailList(&MessageQueue->NotifyMessagesListHead,
&NotifyMessage->ListEntry);
MessageQueue->QueueBits |= QS_SENDMESSAGE;
MessageQueue->ChangedBits |= QS_SENDMESSAGE;
if (MessageQueue->WakeMask & QS_SENDMESSAGE)
KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
MsqWakeQueue(MessageQueue, QS_SENDMESSAGE);
}
NTSTATUS FASTCALL
@ -1155,10 +1152,7 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
/* queue it in the destination's message queue */
InsertTailList(&MessageQueue->SentMessagesListHead, &Message->ListEntry);
MessageQueue->QueueBits |= QS_SENDMESSAGE;
MessageQueue->ChangedBits |= QS_SENDMESSAGE;
if (MessageQueue->WakeMask & QS_SENDMESSAGE)
KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
MsqWakeQueue(MessageQueue, QS_SENDMESSAGE);
/* we can't access the Message anymore since it could have already been deleted! */
@ -1308,10 +1302,7 @@ MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg, BOOLEAN HardwareMessa
InsertTailList(&MessageQueue->HardwareMessagesListHead,
&Message->ListEntry);
}
MessageQueue->QueueBits |= MessageBits;
MessageQueue->ChangedBits |= MessageBits;
if (MessageQueue->WakeMask & MessageBits)
KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
MsqWakeQueue(MessageQueue, MessageBits);
}
VOID FASTCALL
@ -1319,15 +1310,11 @@ MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode)
{
MessageQueue->QuitPosted = TRUE;
MessageQueue->QuitExitCode = ExitCode;
MessageQueue->QueueBits |= QS_POSTMESSAGE;
MessageQueue->ChangedBits |= QS_POSTMESSAGE;
if (MessageQueue->WakeMask & QS_POSTMESSAGE)
KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
MsqWakeQueue(MessageQueue, QS_POSTMESSAGE);
}
BOOLEAN APIENTRY
co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
IN BOOLEAN Hardware,
MsqPeekMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
IN BOOLEAN Remove,
IN PWND Window,
IN UINT MsgFilterLow,
@ -1337,17 +1324,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
PLIST_ENTRY CurrentEntry;
PUSER_MESSAGE CurrentMessage;
PLIST_ENTRY ListHead;
if (Hardware)
{
return(co_MsqPeekHardwareMessage( MessageQueue,
Window,
MsgFilterLow,
MsgFilterHigh,
Remove,
Message));
}
CurrentEntry = MessageQueue->PostedMessagesListHead.Flink;
ListHead = &MessageQueue->PostedMessagesListHead;
while (CurrentEntry != ListHead)
@ -1361,15 +1338,11 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
( MsgFilterLow <= CurrentMessage->Msg.message &&
MsgFilterHigh >= CurrentMessage->Msg.message ) ) )
{
if (Remove)
{
RemoveEntryList(&CurrentMessage->ListEntry);
}
*Message= CurrentMessage->Msg;
if (Remove)
{
RemoveEntryList(&CurrentMessage->ListEntry);
MsqDestroyMessage(CurrentMessage);
}

View file

@ -2567,7 +2567,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWND Window)
msg.wParam = IntGetSysCursorInfo()->ButtonsDown;
msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
msg.pt = gpsi->ptCursor;
MsqInsertMouseMessage(&msg);
co_MsqInsertMouseMessage(&msg);
if (!IntIsWindow(Window->head.h))
{