mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:33:10 +00:00
[win32k]
- Simplify co_IntPeekMessage even more svn path=/trunk/; revision=49580
This commit is contained in:
parent
31efb355c9
commit
4ac999a033
4 changed files with 40 additions and 39 deletions
|
@ -127,7 +127,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
|
||||||
IN PWND Window,
|
IN PWND Window,
|
||||||
IN UINT MsgFilterLow,
|
IN UINT MsgFilterLow,
|
||||||
IN UINT MsgFilterHigh,
|
IN UINT MsgFilterHigh,
|
||||||
OUT PUSER_MESSAGE* Message);
|
OUT PMSG Message);
|
||||||
BOOLEAN FASTCALL
|
BOOLEAN FASTCALL
|
||||||
MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue);
|
MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue);
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
|
|
|
@ -11,8 +11,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#define INTERNAL_CALL APIENTRY
|
#define INTERNAL_CALL APIENTRY
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
#define PLACE_IN_SECTION(s) __attribute__((section(s)))
|
#define PLACE_IN_SECTION(s) __attribute__((section(s)))
|
||||||
#define INIT_FUNCTION PLACE_IN_SECTION("INIT")
|
#define INIT_FUNCTION PLACE_IN_SECTION("INIT")
|
||||||
|
#else
|
||||||
|
#define INIT_FUNCTION
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Internal Win32k Headers */
|
/* Internal Win32k Headers */
|
||||||
#include <include/accelerator.h>
|
#include <include/accelerator.h>
|
||||||
|
|
|
@ -887,7 +887,7 @@ BOOL ProcessHardwareMessage(MSG* Msg, BOOLEAN RemoveMessages)
|
||||||
* Internal version of PeekMessage() doing all the work
|
* Internal version of PeekMessage() doing all the work
|
||||||
*/
|
*/
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_IntPeekMessage( PUSER_MESSAGE Msg,
|
co_IntPeekMessage( PMSG Msg,
|
||||||
PWND Window,
|
PWND Window,
|
||||||
UINT MsgFilterMin,
|
UINT MsgFilterMin,
|
||||||
UINT MsgFilterMax,
|
UINT MsgFilterMax,
|
||||||
|
@ -896,7 +896,6 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
|
||||||
PTHREADINFO pti;
|
PTHREADINFO pti;
|
||||||
LARGE_INTEGER LargeTickCount;
|
LARGE_INTEGER LargeTickCount;
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
PUSER_MESSAGE Message;
|
|
||||||
BOOL RemoveMessages;
|
BOOL RemoveMessages;
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
pti = PsGetCurrentThreadWin32Thread();
|
||||||
|
@ -920,10 +919,10 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
|
||||||
{
|
{
|
||||||
/* According to the PSDK, WM_QUIT messages are always returned, regardless
|
/* According to the PSDK, WM_QUIT messages are always returned, regardless
|
||||||
of the filter specified */
|
of the filter specified */
|
||||||
Msg->Msg.hwnd = NULL;
|
Msg->hwnd = NULL;
|
||||||
Msg->Msg.message = WM_QUIT;
|
Msg->message = WM_QUIT;
|
||||||
Msg->Msg.wParam = ThreadQueue->QuitExitCode;
|
Msg->wParam = ThreadQueue->QuitExitCode;
|
||||||
Msg->Msg.lParam = 0;
|
Msg->lParam = 0;
|
||||||
if (RemoveMessages)
|
if (RemoveMessages)
|
||||||
{
|
{
|
||||||
ThreadQueue->QuitPosted = FALSE;
|
ThreadQueue->QuitPosted = FALSE;
|
||||||
|
@ -939,14 +938,9 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
|
||||||
Window,
|
Window,
|
||||||
MsgFilterMin,
|
MsgFilterMin,
|
||||||
MsgFilterMax,
|
MsgFilterMax,
|
||||||
&Message ))
|
Msg ))
|
||||||
{
|
{
|
||||||
RtlCopyMemory(Msg, Message, sizeof(USER_MESSAGE));
|
return TRUE;
|
||||||
if (RemoveMessages)
|
|
||||||
{
|
|
||||||
MsqDestroyMessage(Message);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for hardware events. */
|
/* Check for hardware events. */
|
||||||
|
@ -956,18 +950,13 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
|
||||||
Window,
|
Window,
|
||||||
MsgFilterMin,
|
MsgFilterMin,
|
||||||
MsgFilterMax,
|
MsgFilterMax,
|
||||||
&Message ))
|
Msg ))
|
||||||
{
|
{
|
||||||
RtlCopyMemory(Msg, Message, sizeof(USER_MESSAGE));
|
|
||||||
if (RemoveMessages)
|
|
||||||
{
|
|
||||||
MsqDestroyMessage(Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!ProcessHardwareMessage(&Msg->Msg, RemoveMessages))
|
if(!ProcessHardwareMessage(Msg, RemoveMessages))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
break;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for sent messages again. */
|
/* Check for sent messages again. */
|
||||||
|
@ -979,10 +968,10 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
|
||||||
MsgFilterMin,
|
MsgFilterMin,
|
||||||
MsgFilterMax,
|
MsgFilterMax,
|
||||||
pti,
|
pti,
|
||||||
&Msg->Msg,
|
Msg,
|
||||||
RemoveMessages))
|
RemoveMessages))
|
||||||
{
|
{
|
||||||
break;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PostTimerMessages(Window))
|
if (PostTimerMessages(Window))
|
||||||
|
@ -1099,7 +1088,7 @@ co_IntWaitMessage( PWND Window,
|
||||||
PTHREADINFO pti;
|
PTHREADINFO pti;
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
USER_MESSAGE Msg;
|
MSG Msg;
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
pti = PsGetCurrentThreadWin32Thread();
|
||||||
ThreadQueue = pti->MessageQueue;
|
ThreadQueue = pti->MessageQueue;
|
||||||
|
@ -1142,7 +1131,6 @@ co_IntGetPeekMessage( PMSG pMsg,
|
||||||
BOOL bGMSG )
|
BOOL bGMSG )
|
||||||
{
|
{
|
||||||
PWND Window;
|
PWND Window;
|
||||||
USER_MESSAGE Msg;
|
|
||||||
BOOL Present = FALSE;
|
BOOL Present = FALSE;
|
||||||
|
|
||||||
if ( hWnd == HWND_TOPMOST || hWnd == HWND_BROADCAST )
|
if ( hWnd == HWND_TOPMOST || hWnd == HWND_BROADCAST )
|
||||||
|
@ -1170,19 +1158,15 @@ co_IntGetPeekMessage( PMSG pMsg,
|
||||||
MsgFilterMax = 0;
|
MsgFilterMax = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(&Msg, sizeof(USER_MESSAGE));
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Present = co_IntPeekMessage( &Msg,
|
Present = co_IntPeekMessage( pMsg,
|
||||||
Window,
|
Window,
|
||||||
MsgFilterMin,
|
MsgFilterMin,
|
||||||
MsgFilterMax,
|
MsgFilterMax,
|
||||||
RemoveMsg );
|
RemoveMsg );
|
||||||
if (Present)
|
if (Present)
|
||||||
{
|
{
|
||||||
RtlCopyMemory( pMsg, &Msg.Msg, sizeof(MSG));
|
|
||||||
|
|
||||||
// The WH_GETMESSAGE hook enables an application to monitor messages about to
|
// The WH_GETMESSAGE hook enables an application to monitor messages about to
|
||||||
// be returned by the GetMessage or PeekMessage function.
|
// be returned by the GetMessage or PeekMessage function.
|
||||||
|
|
||||||
|
@ -2764,7 +2748,7 @@ NtUserWaitForInputIdle( IN HANDLE hProcess,
|
||||||
|
|
||||||
case STATUS_WAIT_2:
|
case STATUS_WAIT_2:
|
||||||
{
|
{
|
||||||
USER_MESSAGE Msg;
|
MSG Msg;
|
||||||
co_IntPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE );
|
co_IntPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE );
|
||||||
DPRINT1("WFII: WAIT 2\n");
|
DPRINT1("WFII: WAIT 2\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -535,7 +535,7 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
|
co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
|
||||||
UINT FilterLow, UINT FilterHigh, BOOL Remove,
|
UINT FilterLow, UINT FilterHigh, BOOL Remove,
|
||||||
PUSER_MESSAGE* Message)
|
PMSG Message)
|
||||||
{
|
{
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
POINT ScreenPoint;
|
POINT ScreenPoint;
|
||||||
|
@ -587,14 +587,15 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
|
||||||
DesktopWindow, &ScreenPoint, FALSE, &CurrentEntry);
|
DesktopWindow, &ScreenPoint, FALSE, &CurrentEntry);
|
||||||
if (Accept)
|
if (Accept)
|
||||||
{
|
{
|
||||||
|
*Message = Current->Msg;
|
||||||
if (Remove)
|
if (Remove)
|
||||||
{
|
{
|
||||||
RemoveEntryList(&Current->ListEntry);
|
RemoveEntryList(&Current->ListEntry);
|
||||||
|
MsqDestroyMessage(Current);
|
||||||
}
|
}
|
||||||
IntUnLockHardwareMessageQueue(MessageQueue);
|
IntUnLockHardwareMessageQueue(MessageQueue);
|
||||||
IntUnLockSystemHardwareMessageQueueLock(FALSE);
|
IntUnLockSystemHardwareMessageQueueLock(FALSE);
|
||||||
*Message = Current;
|
|
||||||
|
|
||||||
if (Desk)
|
if (Desk)
|
||||||
Desk->LastInputWasKbd = FALSE;
|
Desk->LastInputWasKbd = FALSE;
|
||||||
|
|
||||||
|
@ -604,13 +605,14 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*Message = Current->Msg;
|
||||||
if (Remove)
|
if (Remove)
|
||||||
{
|
{
|
||||||
RemoveEntryList(&Current->ListEntry);
|
RemoveEntryList(&Current->ListEntry);
|
||||||
|
MsqDestroyMessage(Current);
|
||||||
}
|
}
|
||||||
IntUnLockHardwareMessageQueue(MessageQueue);
|
IntUnLockHardwareMessageQueue(MessageQueue);
|
||||||
IntUnLockSystemHardwareMessageQueueLock(FALSE);
|
IntUnLockSystemHardwareMessageQueueLock(FALSE);
|
||||||
*Message = Current;
|
|
||||||
|
|
||||||
RETURN(TRUE);
|
RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
@ -693,7 +695,12 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
|
||||||
IntUnLockHardwareMessageQueue(MessageQueue);
|
IntUnLockHardwareMessageQueue(MessageQueue);
|
||||||
}
|
}
|
||||||
IntUnLockSystemHardwareMessageQueueLock(FALSE);
|
IntUnLockSystemHardwareMessageQueueLock(FALSE);
|
||||||
*Message = Current;
|
*Message = Current->Msg;
|
||||||
|
|
||||||
|
if (Remove)
|
||||||
|
{
|
||||||
|
MsqDestroyMessage(Current);
|
||||||
|
}
|
||||||
|
|
||||||
RETURN(TRUE);
|
RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
@ -1325,7 +1332,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
|
||||||
IN PWND Window,
|
IN PWND Window,
|
||||||
IN UINT MsgFilterLow,
|
IN UINT MsgFilterLow,
|
||||||
IN UINT MsgFilterHigh,
|
IN UINT MsgFilterHigh,
|
||||||
OUT PUSER_MESSAGE* Message)
|
OUT PMSG Message)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY CurrentEntry;
|
PLIST_ENTRY CurrentEntry;
|
||||||
PUSER_MESSAGE CurrentMessage;
|
PUSER_MESSAGE CurrentMessage;
|
||||||
|
@ -1359,7 +1366,13 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
|
||||||
RemoveEntryList(&CurrentMessage->ListEntry);
|
RemoveEntryList(&CurrentMessage->ListEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
*Message = CurrentMessage;
|
*Message= CurrentMessage->Msg;
|
||||||
|
|
||||||
|
if (Remove)
|
||||||
|
{
|
||||||
|
MsqDestroyMessage(CurrentMessage);
|
||||||
|
}
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
CurrentEntry = CurrentEntry->Flink;
|
CurrentEntry = CurrentEntry->Flink;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue