[ros-diffs] [jimtabor] 34270: Bug 972: - Fixes the problem of selecting Explorer START menu than mouse over and clicking another application. - Doesn't fix the problem of selecting Explorer START menu than mouse over to the opened file Explorer and clicking on it. - Why, one might ask? The file Explorer shares the same TID.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Thu Jul 3 06:51:51 CEST 2008


Author: jimtabor
Date: Wed Jul  2 23:51:51 2008
New Revision: 34270

URL: http://svn.reactos.org/svn/reactos?rev=34270&view=rev
Log:
Bug 972:
- Fixes the problem of selecting Explorer START menu than mouse over and clicking another application.
- Doesn't fix the problem of selecting Explorer START menu than mouse over to the opened file Explorer and clicking on it.
- Why, one might ask? The file Explorer shares the same TID.



Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/focus.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/focus.c?rev=34270&r1=34269&r2=34270&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Wed Jul  2 23:51:51 2008
@@ -96,6 +96,42 @@
                               MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE,
                                          UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE),
                               (LPARAM)hWndPrev);
+
+      if (Window && hWndPrev)
+      {
+         PWINDOW_OBJECT cWindow;
+         HWND *List, *phWnd;
+         HANDLE OldTID = IntGetWndThreadId(UserGetWindowObject(hWndPrev));
+         HANDLE NewTID = IntGetWndThreadId(Window);
+
+ DPRINT("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID);
+
+         if (OldTID != NewTID)
+         {
+            if ((List = IntWinListChildren(UserGetWindowObject(IntGetDesktopWindow()))))
+            {
+               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_IntSendMessage(*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_IntSendMessage(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID);
+                  }
+               }
+               ExFreePool(List);
+            }
+         }
+      }
    }
 }
 



More information about the Ros-diffs mailing list