mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[WIN32K/NTUSER]
* Allow WM_ACTIVATEAPP to be sent to the deactivated windows. Fixes the start menu not closing when clicking outside the taskbar. Patch by Huw (Frontier). CORE-8235 #resolve #comment Included in shell-experiments branch. Thanks. svn path=/branches/shell-experiments/; revision=63350
This commit is contained in:
parent
7a09d4a028
commit
4242fb21c0
1 changed files with 51 additions and 49 deletions
|
@ -101,10 +101,10 @@ co_IntSendActivateMessages(PWND WindowPrev, PWND Window, BOOL MouseActivate, BOO
|
|||
HANDLE OldTID, NewTID;
|
||||
PTHREADINFO pti, ptiOld, ptiNew;
|
||||
BOOL InAAPM = FALSE;
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
|
||||
if (Window)
|
||||
{
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
|
||||
UserRefObjectCo(Window, &Ref);
|
||||
|
||||
|
@ -164,55 +164,7 @@ co_IntSendActivateMessages(PWND WindowPrev, PWND Window, BOOL MouseActivate, BOO
|
|||
}
|
||||
}
|
||||
////
|
||||
OldTID = WindowPrev ? IntGetWndThreadId(WindowPrev) : NULL;
|
||||
NewTID = IntGetWndThreadId(Window);
|
||||
ptiOld = WindowPrev ? WindowPrev->head.pti : NULL;
|
||||
ptiNew = Window->head.pti;
|
||||
|
||||
//ERR("SendActivateMessage Old -> %x, New -> %x\n", OldTID, NewTID);
|
||||
|
||||
if (!(pti->TIF_flags & TIF_INACTIVATEAPPMSG) &&
|
||||
(!WindowPrev || OldTID != NewTID) )
|
||||
{
|
||||
PWND cWindow;
|
||||
HWND *List, *phWnd;
|
||||
|
||||
List = IntWinListChildren(UserGetDesktopWindow());
|
||||
if ( List )
|
||||
{
|
||||
if ( OldTID )
|
||||
{
|
||||
ptiOld->TIF_flags |= TIF_INACTIVATEAPPMSG;
|
||||
// Note: Do not set pci flags, this does crash!
|
||||
for (phWnd = List; *phWnd; ++phWnd)
|
||||
{
|
||||
cWindow = ValidateHwndNoErr(*phWnd);
|
||||
if (cWindow && cWindow->head.pti == ptiOld)
|
||||
{ // FALSE if the window is being deactivated,
|
||||
// ThreadId that owns the window being activated.
|
||||
co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID);
|
||||
}
|
||||
}
|
||||
ptiOld->TIF_flags &= ~TIF_INACTIVATEAPPMSG;
|
||||
}
|
||||
if ( NewTID )
|
||||
{ //// Prevents a resource crash due to reentrance!
|
||||
InAAPM = TRUE;
|
||||
pti->TIF_flags |= TIF_INACTIVATEAPPMSG;
|
||||
////
|
||||
for (phWnd = List; *phWnd; ++phWnd)
|
||||
{
|
||||
cWindow = ValidateHwndNoErr(*phWnd);
|
||||
if (cWindow && cWindow->head.pti == ptiNew)
|
||||
{ // TRUE if the window is being activated,
|
||||
// ThreadId that owns the window being deactivated.
|
||||
co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID);
|
||||
}
|
||||
}
|
||||
}
|
||||
ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
|
||||
}
|
||||
}
|
||||
if (WindowPrev)
|
||||
UserDerefObjectCo(WindowPrev); // Now allow the previous window to die.
|
||||
|
||||
|
@ -256,6 +208,56 @@ co_IntSendActivateMessages(PWND WindowPrev, PWND Window, BOOL MouseActivate, BOO
|
|||
|
||||
UserDerefObjectCo(Window);
|
||||
}
|
||||
|
||||
OldTID = WindowPrev ? IntGetWndThreadId(WindowPrev) : NULL;
|
||||
NewTID = Window ? IntGetWndThreadId(Window) : NULL;
|
||||
ptiOld = WindowPrev ? WindowPrev->head.pti : NULL;
|
||||
ptiNew = Window ? Window->head.pti : NULL;
|
||||
|
||||
//ERR("SendActivateMessage WindowPrev -> %x, Old -> %x, New -> %x\n", WindowPrev, OldTID, NewTID);
|
||||
|
||||
if (!(pti->TIF_flags & TIF_INACTIVATEAPPMSG) &&
|
||||
(OldTID != NewTID) )
|
||||
{
|
||||
PWND cWindow;
|
||||
HWND *List, *phWnd;
|
||||
|
||||
List = IntWinListChildren(UserGetDesktopWindow());
|
||||
if ( List )
|
||||
{
|
||||
if ( OldTID )
|
||||
{
|
||||
ptiOld->TIF_flags |= TIF_INACTIVATEAPPMSG;
|
||||
// Note: Do not set pci flags, this does crash!
|
||||
for (phWnd = List; *phWnd; ++phWnd)
|
||||
{
|
||||
cWindow = ValidateHwndNoErr(*phWnd);
|
||||
if (cWindow && cWindow->head.pti == ptiOld)
|
||||
{ // FALSE if the window is being deactivated,
|
||||
// ThreadId that owns the window being activated.
|
||||
co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID);
|
||||
}
|
||||
}
|
||||
ptiOld->TIF_flags &= ~TIF_INACTIVATEAPPMSG;
|
||||
}
|
||||
if ( NewTID )
|
||||
{ //// Prevents a resource crash due to reentrance!
|
||||
InAAPM = TRUE;
|
||||
pti->TIF_flags |= TIF_INACTIVATEAPPMSG;
|
||||
////
|
||||
for (phWnd = List; *phWnd; ++phWnd)
|
||||
{
|
||||
cWindow = ValidateHwndNoErr(*phWnd);
|
||||
if (cWindow && cWindow->head.pti == ptiNew)
|
||||
{ // TRUE if the window is being activated,
|
||||
// ThreadId that owns the window being deactivated.
|
||||
co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID);
|
||||
}
|
||||
}
|
||||
}
|
||||
ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
|
||||
}
|
||||
}
|
||||
return InAAPM;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue