Commit 132470a2 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Properly handle the case when last MDI child is being destroyed.

parent cbf4c5c6
...@@ -515,7 +515,7 @@ static void MDI_SwitchActiveChild( MDICLIENTINFO *ci, HWND hwndTo ) ...@@ -515,7 +515,7 @@ static void MDI_SwitchActiveChild( MDICLIENTINFO *ci, HWND hwndTo )
/********************************************************************** /**********************************************************************
* MDIDestroyChild * MDIDestroyChild
*/ */
static LRESULT MDIDestroyChild( HWND parent, MDICLIENTINFO *ci, static LRESULT MDIDestroyChild( HWND client, MDICLIENTINFO *ci,
HWND child, BOOL flagDestroy ) HWND child, BOOL flagDestroy )
{ {
UINT i; UINT i;
...@@ -528,7 +528,15 @@ static LRESULT MDIDestroyChild( HWND parent, MDICLIENTINFO *ci, ...@@ -528,7 +528,15 @@ static LRESULT MDIDestroyChild( HWND parent, MDICLIENTINFO *ci,
if (next) if (next)
MDI_SwitchActiveChild(ci, next); MDI_SwitchActiveChild(ci, next);
else else
ci->hwndActiveChild = 0; /* nothing to activate */ {
ShowWindow(child, SW_HIDE);
if (IsZoomed(child))
{
MDI_RestoreFrameMenu(GetParent(client), child);
MDI_UpdateFrameText(GetParent(client), client, NULL);
}
MDI_ChildActivate(client, 0);
}
} }
for (i = 0; i < ci->nActiveChildren; i++) for (i = 0; i < ci->nActiveChildren; i++)
...@@ -547,6 +555,8 @@ static LRESULT MDIDestroyChild( HWND parent, MDICLIENTINFO *ci, ...@@ -547,6 +555,8 @@ static LRESULT MDIDestroyChild( HWND parent, MDICLIENTINFO *ci,
} }
} }
SendMessageW(client, WM_MDIREFRESHMENU, 0, 0);
if (flagDestroy) if (flagDestroy)
{ {
MDI_PostUpdate(GetParent(child), ci, SB_BOTH+1); MDI_PostUpdate(GetParent(child), ci, SB_BOTH+1);
...@@ -561,7 +571,8 @@ static LRESULT MDIDestroyChild( HWND parent, MDICLIENTINFO *ci, ...@@ -561,7 +571,8 @@ static LRESULT MDIDestroyChild( HWND parent, MDICLIENTINFO *ci,
/********************************************************************** /**********************************************************************
* MDI_ChildActivate * MDI_ChildActivate
* *
* Called in response to WM_CHILDACTIVATE * Called in response to WM_CHILDACTIVATE, or when last MDI child
* is being deactivated.
*/ */
static LONG MDI_ChildActivate( HWND client, HWND child ) static LONG MDI_ChildActivate( HWND client, HWND child )
{ {
...@@ -872,6 +883,8 @@ static BOOL MDI_RestoreFrameMenu( HWND frame, HWND hChild ) ...@@ -872,6 +883,8 @@ static BOOL MDI_RestoreFrameMenu( HWND frame, HWND hChild )
TRACE("frame %p,child %p,nIt=%d,iId=%d\n",frame,hChild,nItems,iId); TRACE("frame %p,child %p,nIt=%d,iId=%d\n",frame,hChild,nItems,iId);
if( !menu ) return 0;
/* if there is no system buttons then nothing to do */ /* if there is no system buttons then nothing to do */
if(!(iId == SC_RESTORE || iId == SC_CLOSE) ) if(!(iId == SC_RESTORE || iId == SC_CLOSE) )
return 0; return 0;
...@@ -1058,10 +1071,12 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, ...@@ -1058,10 +1071,12 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
case WM_MDICREATE: case WM_MDICREATE:
if (lParam) if (lParam)
{ {
HWND child;
if (unicode) if (unicode)
{ {
MDICREATESTRUCTW *csW = (MDICREATESTRUCTW *)lParam; MDICREATESTRUCTW *csW = (MDICREATESTRUCTW *)lParam;
return (LRESULT)CreateWindowExW(WS_EX_MDICHILD, csW->szClass, child = CreateWindowExW(WS_EX_MDICHILD, csW->szClass,
csW->szTitle, csW->style, csW->szTitle, csW->style,
csW->x, csW->y, csW->cx, csW->cy, csW->x, csW->y, csW->cx, csW->cy,
hwnd, 0, csW->hOwner, hwnd, 0, csW->hOwner,
...@@ -1070,12 +1085,19 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, ...@@ -1070,12 +1085,19 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
else else
{ {
MDICREATESTRUCTA *csA = (MDICREATESTRUCTA *)lParam; MDICREATESTRUCTA *csA = (MDICREATESTRUCTA *)lParam;
return (LRESULT)CreateWindowExA(WS_EX_MDICHILD, csA->szClass, child = CreateWindowExA(WS_EX_MDICHILD, csA->szClass,
csA->szTitle, csA->style, csA->szTitle, csA->style,
csA->x, csA->y, csA->cx, csA->cy, csA->x, csA->y, csA->cx, csA->cy,
hwnd, 0, csA->hOwner, hwnd, 0, csA->hOwner,
(LPVOID)csA->lParam); (LPVOID)csA->lParam);
} }
if (IsZoomed(ci->hwndActiveChild))
{
MDI_AugmentFrameMenu(GetParent(hwnd), child);
MDI_UpdateFrameText(GetParent(hwnd), hwnd, NULL);
}
return (LRESULT)child;
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment