294476 Impossible to give keyboard focus to minimized windows raised by opening a URL from another app. Activate windows being restored. Also fixes: popup windows not rolled up when windows are minimized with command-M; minimized windows sometimes retain focus even though they're hiding in the dock. r=josh sr=smfr

This commit is contained in:
mark%moxienet.com 2006-01-09 22:20:34 +00:00
parent bc068c1794
commit 3bce8a7dc3

View File

@ -573,7 +573,9 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
// to enable live resizing // to enable live resizing
{ kEventClassWindow, kEventWindowBoundsChanged }, { kEventClassWindow, kEventWindowBoundsChanged },
// to roll up popups when we're minimized // to roll up popups when we're minimized
{ kEventClassWindow, kEventWindowCollapse }, { kEventClassWindow, kEventWindowCollapsing },
// to activate when restoring
{ kEventClassWindow, kEventWindowExpanded },
// to keep invisible windows off the screen // to keep invisible windows off the screen
{ kEventClassWindow, kEventWindowConstrain }, { kEventClassWindow, kEventWindowConstrain },
// to handle update events // to handle update events
@ -700,14 +702,30 @@ nsMacWindow::WindowEventHandler ( EventHandlerCallRef inHandlerChain, EventRef i
break; break;
// roll up popups when we're minimized // roll up popups when we're minimized
case kEventWindowCollapse: case kEventWindowCollapsing:
{ {
if ( gRollupListener && gRollupWidget ) if ( gRollupListener && gRollupWidget )
gRollupListener->Rollup(); gRollupListener->Rollup();
nsMacWindow *self = NS_REINTERPRET_CAST(nsMacWindow *, userData);
if (self) {
gEventDispatchHandler.DispatchGuiEvent(self, NS_DEACTIVATE);
}
retVal = ::CallNextEventHandler(inHandlerChain, inEvent); retVal = ::CallNextEventHandler(inHandlerChain, inEvent);
} }
break; break;
// Activate when restoring from the minimized state. This ensures that
// the restored window will be able to take focus.
case kEventWindowExpanded:
{
nsMacWindow *self = NS_REINTERPRET_CAST(nsMacWindow *, userData);
if (self) {
gEventDispatchHandler.DispatchGuiEvent(self, NS_ACTIVATE);
}
retVal = ::CallNextEventHandler(inHandlerChain, inEvent);
}
break;
default: default:
// do nothing... // do nothing...
break; break;