- Update DispathMessage and fix time stamp for system and standard timers. Tested...
authorJames Tabor <james.tabor@reactos.org>
Sat, 17 Jan 2009 01:03:03 +0000 (01:03 +0000)
committerJames Tabor <james.tabor@reactos.org>
Sat, 17 Jan 2009 01:03:03 +0000 (01:03 +0000)
svn path=/trunk/; revision=38803

reactos/dll/win32/user32/windows/message.c
reactos/include/reactos/win32k/ntuser.h
reactos/subsystems/win32/win32k/ntuser/message.c

index 2594148..b1828ad 100644 (file)
@@ -1335,6 +1335,7 @@ LRESULT WINAPI
 DispatchMessageA(CONST MSG *lpmsg)
 {
     LRESULT Ret = 0;
+    MSG UnicodeMsg;
     PWINDOW Wnd;
 
     if (lpmsg->hwnd != NULL)
@@ -1349,6 +1350,10 @@ DispatchMessageA(CONST MSG *lpmsg)
     if ((lpmsg->message == WM_TIMER || lpmsg->message == WM_SYSTIMER) && lpmsg->lParam != 0)
     {
         WNDPROC WndProc = (WNDPROC)lpmsg->lParam;
+
+        if ( lpmsg->message == WM_SYSTIMER )
+           return NtUserDispatchMessage( (PMSG)lpmsg );
+
         Ret = WndProc(lpmsg->hwnd,
                       lpmsg->message,
                       lpmsg->wParam,
@@ -1356,16 +1361,33 @@ DispatchMessageA(CONST MSG *lpmsg)
     }
     else if (Wnd != NULL)
     {
-        /* FIXME: WM_PAINT needs special handling */
-        Ret = IntCallMessageProc(Wnd,
-                                 lpmsg->hwnd,
-                                 lpmsg->message,
-                                 lpmsg->wParam,
-                                 lpmsg->lParam,
-                                 TRUE);
-    }
+       // FIXME Need to test for calling proc inside win32k!
+       if ( (lpmsg->message != WM_PAINT) ) // && !(Wnd->flags & WNDF_CALLPROC) )
+       {
+           Ret = IntCallMessageProc(Wnd,
+                                    lpmsg->hwnd,
+                                    lpmsg->message,
+                                    lpmsg->wParam,
+                                    lpmsg->lParam,
+                                    TRUE);
+       }
+       else
+       {
+          if (!MsgiAnsiToUnicodeMessage(&UnicodeMsg, (LPMSG)lpmsg))
+          {
+             return FALSE;
+          }
 
-    return Ret;}
+          Ret = NtUserDispatchMessage(&UnicodeMsg);
+
+          if (!MsgiAnsiToUnicodeReply(&UnicodeMsg, (LPMSG)lpmsg, &Ret))
+          {
+             return FALSE;
+          }
+       }
+    }
+    return Ret;
+}
 
 
 /*
@@ -1389,6 +1411,10 @@ DispatchMessageW(CONST MSG *lpmsg)
     if ((lpmsg->message == WM_TIMER || lpmsg->message == WM_SYSTIMER) && lpmsg->lParam != 0)
     {
         WNDPROC WndProc = (WNDPROC)lpmsg->lParam;
+
+        if ( lpmsg->message == WM_SYSTIMER )
+           return NtUserDispatchMessage( (PMSG) lpmsg );
+
         Ret = WndProc(lpmsg->hwnd,
                       lpmsg->message,
                       lpmsg->wParam,
@@ -1396,13 +1422,18 @@ DispatchMessageW(CONST MSG *lpmsg)
     }
     else if (Wnd != NULL)
     {
-        /* FIXME: WM_PAINT needs special handling */
-        Ret = IntCallMessageProc(Wnd,
-                                 lpmsg->hwnd,
-                                 lpmsg->message,
-                                 lpmsg->wParam,
-                                 lpmsg->lParam,
-                                 FALSE);
+       // FIXME Need to test for calling proc inside win32k!
+       if ( (lpmsg->message != WM_PAINT) ) // && !(Wnd->flags & W32K_CALLPROC) )
+       {
+           Ret = IntCallMessageProc(Wnd,
+                                    lpmsg->hwnd,
+                                    lpmsg->message,
+                                    lpmsg->wParam,
+                                    lpmsg->lParam,
+                                    FALSE);
+       }
+       else
+         Ret = NtUserDispatchMessage( (PMSG) lpmsg );
     }
 
     return Ret;
index b31528e..01aa115 100644 (file)
@@ -136,6 +136,10 @@ typedef struct _WINDOWCLASS
     UINT NotUsed : 27;
 } WINDOWCLASS, *PWINDOWCLASS;
 
+
+// Flags !Not Implemented!
+#define WNDF_CALLPROC 0x0004 // Call proc inside win32k.
+
 typedef struct _WINDOW
 {
     USER_OBJHDR hdr; /* FIXME: Move out of the structure once new handle manager is implemented */
index efb0495..c4c02d3 100644 (file)
@@ -345,6 +345,8 @@ LRESULT
 FASTCALL
 IntDispatchMessage(PMSG pMsg)
 {
+  LARGE_INTEGER TickCount;
+  LONG Time;
   LRESULT retval;
   PWINDOW_OBJECT Window = NULL;
 
@@ -362,12 +364,14 @@ IntDispatchMessage(PMSG pMsg)
      {
         if (ValidateTimerCallback(PsGetCurrentThreadWin32Thread(),Window,pMsg->wParam,pMsg->lParam))
         {
+           KeQueryTickCount(&TickCount);
+           Time = MsqCalculateMessageTime(&TickCount);
            return co_IntCallWindowProc((WNDPROC)pMsg->lParam,
                                         TRUE,
                                         pMsg->hwnd,
                                         WM_TIMER,
                                         pMsg->wParam,
-                                        (LPARAM)EngGetTickCount(),
+                                        (LPARAM)Time,
                                         sizeof(LPARAM));
         }
         return 0;        
@@ -377,7 +381,9 @@ IntDispatchMessage(PMSG pMsg)
         PTIMER pTimer = FindSystemTimer(pMsg);
         if (pTimer && pTimer->pfn)
         {
-           pTimer->pfn(pMsg->hwnd, WM_SYSTIMER, (UINT)pMsg->wParam, (DWORD)EngGetTickCount());
+           KeQueryTickCount(&TickCount);
+           Time = MsqCalculateMessageTime(&TickCount);
+           pTimer->pfn(pMsg->hwnd, WM_SYSTIMER, (UINT)pMsg->wParam, Time);
         }
         return 0;
      }