Bug 551597 - Selecting a tab preview for a minimized window un-maximize the window. r=robarnold.

This commit is contained in:
Jim Mathies 2010-04-28 13:56:55 -05:00
parent 847a6fa05d
commit e69692acc9

View File

@ -167,22 +167,40 @@ TaskbarTabPreview::WndProc(UINT nMsg, WPARAM wParam, LPARAM lParam) {
return 0;
case WM_ACTIVATE:
if (LOWORD(wParam) == WA_ACTIVE) {
// Activate the tab the user selected then restore the main window,
// keeping normal/max window state intact.
PRBool activateWindow;
nsresult rv = mController->OnActivate(&activateWindow);
if (NS_SUCCEEDED(rv) && activateWindow) {
::SetActiveWindow(mWnd);
if (::IsIconic(mWnd))
::ShowWindow(mWnd, SW_RESTORE);
else
::BringWindowToTop(mWnd);
nsWindow* win = nsWindow::GetNSWindowPtr(mWnd);
if (win) {
nsWindow * parent = win->GetTopLevelWindow(true);
if (parent) {
parent->Show(true);
}
}
}
}
return 0;
case WM_GETICON:
return (LRESULT)mIcon;
case WM_SYSCOMMAND:
// Forward syscommands like restore/minimize/maximize to the container
// window. Do not forward close since that's intended for the tab.
// Send activation events to the top level window and select the proper
// tab through the controller.
if (wParam == SC_RESTORE || wParam == SC_MAXIMIZE) {
PRBool activateWindow;
nsresult rv = mController->OnActivate(&activateWindow);
if (NS_SUCCEEDED(rv) && activateWindow) {
// Note, restoring an iconic, maximized window here will only
// activate the maximized window. This is not a bug, it's default
// windows behavior.
::SendMessageW(mWnd, WM_SYSCOMMAND, wParam, lParam);
}
return 0;
}
// Forward everything else to the top level window. Do not forward
// close since that's intended for the tab. When the preview proxy
// closes, we'll close the tab above.
return wParam == SC_CLOSE
? ::DefWindowProcW(mProxyWindow, WM_SYSCOMMAND, wParam, lParam)
: ::SendMessageW(mWnd, WM_SYSCOMMAND, wParam, lParam);