[ros-diffs] [gadamopoulos] 49610: [win32k] - Some more cleanup

gadamopoulos at svn.reactos.org gadamopoulos at svn.reactos.org
Thu Nov 18 13:57:22 UTC 2010


Author: gadamopoulos
Date: Thu Nov 18 13:57:21 2010
New Revision: 49610

URL: http://svn.reactos.org/svn/reactos?rev=49610&view=rev
Log:
[win32k]
- Some more cleanup

Modified:
    trunk/reactos/subsystems/win32/win32k/include/msgqueue.h
    trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
    trunk/reactos/subsystems/win32/win32k/ntuser/input.c
    trunk/reactos/subsystems/win32/win32k/ntuser/message.c
    trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
    trunk/reactos/subsystems/win32/win32k/ntuser/window.c

Modified: trunk/reactos/subsystems/win32/win32k/include/msgqueue.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/msgqueue.h?rev=49610&r1=49609&r2=49610&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] Thu Nov 18 13:57:21 2010
@@ -121,13 +121,19 @@
 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 @@
 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

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c?rev=49610&r1=49609&r2=49610&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Thu Nov 18 13:57:21 2010
@@ -217,7 +217,7 @@
         Msg.wParam = CurInfo->ButtonsDown;
         Msg.lParam = MAKELPARAM(x, y);
         Msg.pt = pt;
-        MsqInsertMouseMessage(&Msg);
+        co_MsqInsertMouseMessage(&Msg);
     }
 
     /* Store the new cursor position */

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/input.c?rev=49610&r1=49609&r2=49610&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Thu Nov 18 13:57:21 2010
@@ -1156,7 +1156,7 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
          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 @@
          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;

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/message.c?rev=49610&r1=49609&r2=49610&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Thu Nov 18 13:57:21 2010
@@ -932,25 +932,23 @@
         }
 
         /* 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))

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c?rev=49610&r1=49609&r2=49610&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Thu Nov 18 13:57:21 2010
@@ -98,13 +98,19 @@
 }
 
 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 @@
 }
 
 VOID FASTCALL
-MsqInsertMouseMessage(MSG* Msg)
+co_MsqInsertMouseMessage(MSG* Msg)
 {
    LARGE_INTEGER LargeTickCount;
    KIRQL OldIrql;
@@ -425,17 +431,11 @@
          /* 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 @@
 }
 
 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 @@
    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 @@
 {
    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 @@
    /* 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 @@
        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 @@
 {
    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 @@
    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 @@
               ( MsgFilterLow <= CurrentMessage->Msg.message &&
                 MsgFilterHigh >= CurrentMessage->Msg.message ) ) )
       {
+         *Message= CurrentMessage->Msg;
+
          if (Remove)
          {
-            RemoveEntryList(&CurrentMessage->ListEntry);
-         }
-
-         *Message= CurrentMessage->Msg;
-
-         if (Remove)
-         {
+             RemoveEntryList(&CurrentMessage->ListEntry);
              MsqDestroyMessage(CurrentMessage);
          }
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/window.c?rev=49610&r1=49609&r2=49610&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Thu Nov 18 13:57:21 2010
@@ -2567,7 +2567,7 @@
     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))
    {




More information about the Ros-diffs mailing list