Author: gadamopoulos Date: Sun Nov 14 09:01:17 2010 New Revision: 49580
URL: http://svn.reactos.org/svn/reactos?rev=49580&view=rev Log: [win32k] - Simplify co_IntPeekMessage even more
Modified: trunk/reactos/subsystems/win32/win32k/include/msgqueue.h trunk/reactos/subsystems/win32/win32k/include/win32kp.h trunk/reactos/subsystems/win32/win32k/ntuser/message.c trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/subsystems/win32/win32k/include/msgqueue.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] Sun Nov 14 09:01:17 2010 @@ -127,7 +127,7 @@ IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, - OUT PUSER_MESSAGE* Message); + OUT PMSG Message); BOOLEAN FASTCALL MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue); VOID FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/include/win32kp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/win32kp.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/win32kp.h [iso-8859-1] Sun Nov 14 09:01:17 2010 @@ -11,8 +11,12 @@ #pragma once #define INTERNAL_CALL APIENTRY
+#ifndef _MSC_VER #define PLACE_IN_SECTION(s) __attribute__((section(s))) #define INIT_FUNCTION PLACE_IN_SECTION("INIT") +#else +#define INIT_FUNCTION +#endif
/* Internal Win32k Headers */ #include <include/accelerator.h>
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Sun Nov 14 09:01:17 2010 @@ -887,7 +887,7 @@ * Internal version of PeekMessage() doing all the work */ BOOL FASTCALL -co_IntPeekMessage( PUSER_MESSAGE Msg, +co_IntPeekMessage( PMSG Msg, PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, @@ -896,7 +896,6 @@ PTHREADINFO pti; LARGE_INTEGER LargeTickCount; PUSER_MESSAGE_QUEUE ThreadQueue; - PUSER_MESSAGE Message; BOOL RemoveMessages;
pti = PsGetCurrentThreadWin32Thread(); @@ -920,10 +919,10 @@ { /* According to the PSDK, WM_QUIT messages are always returned, regardless of the filter specified */ - Msg->Msg.hwnd = NULL; - Msg->Msg.message = WM_QUIT; - Msg->Msg.wParam = ThreadQueue->QuitExitCode; - Msg->Msg.lParam = 0; + Msg->hwnd = NULL; + Msg->message = WM_QUIT; + Msg->wParam = ThreadQueue->QuitExitCode; + Msg->lParam = 0; if (RemoveMessages) { ThreadQueue->QuitPosted = FALSE; @@ -939,14 +938,9 @@ Window, MsgFilterMin, MsgFilterMax, - &Message )) - { - RtlCopyMemory(Msg, Message, sizeof(USER_MESSAGE)); - if (RemoveMessages) - { - MsqDestroyMessage(Message); - } - break; + Msg )) + { + return TRUE; }
/* Check for hardware events. */ @@ -956,18 +950,13 @@ Window, MsgFilterMin, MsgFilterMax, - &Message )) - { - RtlCopyMemory(Msg, Message, sizeof(USER_MESSAGE)); - if (RemoveMessages) - { - MsqDestroyMessage(Message); - } - - if(!ProcessHardwareMessage(&Msg->Msg, RemoveMessages)) + Msg )) + { + + if(!ProcessHardwareMessage(Msg, RemoveMessages)) continue;
- break; + return TRUE; }
/* Check for sent messages again. */ @@ -979,10 +968,10 @@ MsgFilterMin, MsgFilterMax, pti, - &Msg->Msg, + Msg, RemoveMessages)) { - break; + return TRUE; }
if (PostTimerMessages(Window)) @@ -1099,7 +1088,7 @@ PTHREADINFO pti; PUSER_MESSAGE_QUEUE ThreadQueue; NTSTATUS Status = STATUS_SUCCESS; - USER_MESSAGE Msg; + MSG Msg;
pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; @@ -1142,7 +1131,6 @@ BOOL bGMSG ) { PWND Window; - USER_MESSAGE Msg; BOOL Present = FALSE;
if ( hWnd == HWND_TOPMOST || hWnd == HWND_BROADCAST ) @@ -1170,19 +1158,15 @@ MsgFilterMax = 0; }
- RtlZeroMemory(&Msg, sizeof(USER_MESSAGE)); - do { - Present = co_IntPeekMessage( &Msg, + Present = co_IntPeekMessage( pMsg, Window, MsgFilterMin, MsgFilterMax, RemoveMsg ); if (Present) { - RtlCopyMemory( pMsg, &Msg.Msg, sizeof(MSG)); - // The WH_GETMESSAGE hook enables an application to monitor messages about to // be returned by the GetMessage or PeekMessage function.
@@ -2764,7 +2748,7 @@
case STATUS_WAIT_2: { - USER_MESSAGE Msg; + MSG Msg; co_IntPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE ); DPRINT1("WFII: WAIT 2\n"); }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Sun Nov 14 09:01:17 2010 @@ -535,7 +535,7 @@ BOOL APIENTRY co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window, UINT FilterLow, UINT FilterHigh, BOOL Remove, - PUSER_MESSAGE* Message) + PMSG Message) { KIRQL OldIrql; POINT ScreenPoint; @@ -587,14 +587,15 @@ DesktopWindow, &ScreenPoint, FALSE, &CurrentEntry); if (Accept) { + *Message = Current->Msg; if (Remove) { RemoveEntryList(&Current->ListEntry); + MsqDestroyMessage(Current); } IntUnLockHardwareMessageQueue(MessageQueue); IntUnLockSystemHardwareMessageQueueLock(FALSE); - *Message = Current; - + if (Desk) Desk->LastInputWasKbd = FALSE;
@@ -604,13 +605,14 @@ } else { + *Message = Current->Msg; if (Remove) { RemoveEntryList(&Current->ListEntry); + MsqDestroyMessage(Current); } IntUnLockHardwareMessageQueue(MessageQueue); IntUnLockSystemHardwareMessageQueueLock(FALSE); - *Message = Current;
RETURN(TRUE); } @@ -693,7 +695,12 @@ IntUnLockHardwareMessageQueue(MessageQueue); } IntUnLockSystemHardwareMessageQueueLock(FALSE); - *Message = Current; + *Message = Current->Msg; + + if (Remove) + { + MsqDestroyMessage(Current); + }
RETURN(TRUE); } @@ -1325,7 +1332,7 @@ IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, - OUT PUSER_MESSAGE* Message) + OUT PMSG Message) { PLIST_ENTRY CurrentEntry; PUSER_MESSAGE CurrentMessage; @@ -1359,7 +1366,13 @@ RemoveEntryList(&CurrentMessage->ListEntry); }
- *Message = CurrentMessage; + *Message= CurrentMessage->Msg; + + if (Remove) + { + MsqDestroyMessage(CurrentMessage); + } + return(TRUE); } CurrentEntry = CurrentEntry->Flink;