win32 only fix for 82534. focus goes wonky after minimizing a window. r=bryner, sr=jag
git-svn-id: svn://10.0.0.236/trunk@123675 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
92d37b3380
commit
eecbbc3392
@ -63,6 +63,7 @@ public:
|
||||
NS_IMETHOD GetControllers(nsIControllers** aResult)=0;
|
||||
|
||||
NS_IMETHOD MoveFocus(PRBool aForward, nsIDOMElement* aElt)=0;
|
||||
NS_IMETHOD RewindFocusState()=0;
|
||||
};
|
||||
|
||||
#endif // nsIFocusController_h__
|
||||
|
||||
@ -100,6 +100,7 @@ nsFocusController::GetFocusedWindow(nsIDOMWindowInternal** aWindow)
|
||||
NS_IMETHODIMP
|
||||
nsFocusController::SetFocusedElement(nsIDOMElement* aElement)
|
||||
{
|
||||
mPreviousElement = mCurrentElement;
|
||||
mCurrentElement = aElement;
|
||||
|
||||
if (!mSuppressFocus) {
|
||||
@ -111,6 +112,15 @@ nsFocusController::SetFocusedElement(nsIDOMElement* aElement)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFocusController::RewindFocusState()
|
||||
{
|
||||
mCurrentElement = mPreviousElement;
|
||||
mCurrentWindow = mPreviousWindow;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFocusController::SetFocusedWindow(nsIDOMWindowInternal* aWindow)
|
||||
{
|
||||
@ -124,6 +134,9 @@ nsFocusController::SetFocusedWindow(nsIDOMWindowInternal* aWindow)
|
||||
basewin->SetFocus();
|
||||
}
|
||||
}
|
||||
if(mCurrentWindow) mPreviousWindow = mCurrentWindow;
|
||||
else if (aWindow) mPreviousWindow = aWindow;
|
||||
|
||||
mCurrentWindow = aWindow;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -72,6 +72,7 @@ public:
|
||||
NS_IMETHOD GetControllers(nsIControllers** aResult);
|
||||
|
||||
NS_IMETHOD MoveFocus(PRBool aForward, nsIDOMElement* aElt);
|
||||
NS_IMETHOD RewindFocusState();
|
||||
|
||||
// nsIDOMFocusListener
|
||||
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
|
||||
@ -89,7 +90,9 @@ public:
|
||||
// Members
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMElement> mCurrentElement; // [OWNER]
|
||||
nsCOMPtr<nsIDOMElement> mPreviousElement; // [OWNER]
|
||||
nsCOMPtr<nsIDOMWindowInternal> mCurrentWindow; // [OWNER]
|
||||
nsCOMPtr<nsIDOMWindowInternal> mPreviousWindow; // [OWNER]
|
||||
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
|
||||
|
||||
PRUint32 mSuppressFocus;
|
||||
|
||||
@ -3920,6 +3920,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
||||
result = DispatchFocus(NS_GOTFOCUS, isMozWindowTakingFocus);
|
||||
if(gJustGotActivate) {
|
||||
gJustGotActivate = PR_FALSE;
|
||||
gJustGotDeactivate = PR_FALSE;
|
||||
result = DispatchFocus(NS_ACTIVATE, isMozWindowTakingFocus);
|
||||
}
|
||||
#ifdef ACCESSIBILITY
|
||||
@ -4035,6 +4036,22 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
||||
InitEvent(event, NS_SIZEMODE);
|
||||
|
||||
result = DispatchWindowEvent(&event);
|
||||
|
||||
if (pl.showCmd == SW_SHOWMINIMIZED) {
|
||||
// Deactivate
|
||||
char className[19];
|
||||
::GetClassName((HWND)wParam, className, 19);
|
||||
if(strcmp(className, WindowClass()))
|
||||
isMozWindowTakingFocus = PR_FALSE;
|
||||
|
||||
gJustGotDeactivate = PR_FALSE;
|
||||
result = DispatchFocus(NS_DEACTIVATE, isMozWindowTakingFocus);
|
||||
} else if (pl.showCmd == SW_SHOWNORMAL){
|
||||
// Make sure we're active
|
||||
result = DispatchFocus(NS_GOTFOCUS, PR_TRUE);
|
||||
result = DispatchFocus(NS_ACTIVATE, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_RELEASE(event.widget);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -450,6 +450,25 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent)
|
||||
// the state and pass the event on to the OS. The day is coming
|
||||
// when we'll handle the event here, and the return result will
|
||||
// then need to be different.
|
||||
#ifdef XP_WIN
|
||||
// This is a nasty hack to get around the fact that win32 sends the kill focus
|
||||
// event in a different sequence than the deactivate depending on if you're
|
||||
// minimizing the window vs. just clicking in a different window to cause
|
||||
// the deactivation. Bug #82534
|
||||
if(modeEvent->mSizeMode = nsSizeMode_Minimized) {
|
||||
nsCOMPtr<nsIDOMWindowInternal> domWindow;
|
||||
eventWindow->ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow));
|
||||
if (domWindow) {
|
||||
nsCOMPtr<nsPIDOMWindow> privateDOMWindow = do_QueryInterface(domWindow);
|
||||
if(privateDOMWindow) {
|
||||
nsCOMPtr<nsIFocusController> focusController;
|
||||
privateDOMWindow->GetRootFocusController(getter_AddRefs(focusController));
|
||||
if (focusController)
|
||||
focusController->RewindFocusState();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case NS_OS_TOOLBAR: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user