[win32k]
authorMichael Martin <michael.martin@reactos.org>
Sat, 15 May 2010 18:30:05 +0000 (18:30 +0000)
committerMichael Martin <michael.martin@reactos.org>
Sat, 15 May 2010 18:30:05 +0000 (18:30 +0000)
- The description and changes made regarding WM_ACTIVATEAPP messages in r47126 were partially incorrect, the code was mostly correct.

svn path=/trunk/; revision=47224

reactos/subsystems/win32/win32k/ntuser/focus.c

index 7a8eeeb..10bea03 100644 (file)
@@ -105,19 +105,43 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
 
       if (Window && WindowPrev)
       {
+         PWINDOW_OBJECT cWindow;
+         HWND *List, *phWnd;
          HANDLE OldTID = IntGetWndThreadId(WindowPrev);
          HANDLE NewTID = IntGetWndThreadId(Window);
 
          DPRINT1("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID);
          if (Window->Wnd->style & WS_MINIMIZE)
          {
-            DPRINT1("Widow was nminimized\n");
+            DPRINT("Widow was minimized\n");
          }
 
          if (OldTID != NewTID)
          {
-            co_IntSendMessageNoWait(hWndPrev, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID);
-            co_IntSendMessageNoWait(hWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID);
+            List = IntWinListChildren(UserGetWindowObject(IntGetDesktopWindow()));
+            if (List)
+            {
+               for (phWnd = List; *phWnd; ++phWnd)
+               {
+                  cWindow = UserGetWindowObject(*phWnd);
+
+                  if (cWindow && (IntGetWndThreadId(cWindow) == OldTID))
+                  {  // FALSE if the window is being deactivated,
+                     // ThreadId that owns the window being activated.
+                    co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID);
+                  }
+               }
+               for (phWnd = List; *phWnd; ++phWnd)
+               {
+                  cWindow = UserGetWindowObject(*phWnd);
+                  if (cWindow && (IntGetWndThreadId(cWindow) == NewTID))
+                  { // TRUE if the window is being activated,
+                    // ThreadId that owns the window being deactivated.
+                    co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID);
+                  }
+               }
+               ExFreePool(List);
+            }
          }
          UserDerefObjectCo(WindowPrev); // Now allow the previous window to die.
       }