fix for 49975. r=pinkerton and hyatt

This commit is contained in:
saari%netscape.com 2000-09-15 06:28:26 +00:00
parent c3fa1f92e7
commit 8c69e9f876
7 changed files with 39 additions and 11 deletions

View File

@ -56,7 +56,7 @@ static PRLogModuleInfo* gLog;
////////////////////////////////////////////////////////////////////////
nsXULCommandDispatcher::nsXULCommandDispatcher(void)
: mScriptObject(nsnull), mSuppressFocus(PR_FALSE),
: mScriptObject(nsnull), mSuppressFocus(0),
mActive(PR_FALSE), mFocusInitialized(PR_FALSE), mUpdaters(nsnull)
{
NS_INIT_REFCNT();
@ -618,18 +618,26 @@ nsXULCommandDispatcher::SetSuppressFocusScroll(PRBool aSuppressFocusScroll)
NS_IMETHODIMP
nsXULCommandDispatcher::GetSuppressFocus(PRBool* aSuppressFocus)
{
*aSuppressFocus = mSuppressFocus;
if(mSuppressFocus)
*aSuppressFocus = PR_TRUE;
else
*aSuppressFocus = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::SetSuppressFocus(PRBool aSuppressFocus)
{
mSuppressFocus = aSuppressFocus;
if(aSuppressFocus)
++mSuppressFocus;
else if(mSuppressFocus > 0)
--mSuppressFocus;
//printf("mSuppressFocus == %d\n", mSuppressFocus);
// we are unsuppressing after activating, so update focus-related commands
// we need this to update commands in the case where an element is focussed.
if (!aSuppressFocus && mCurrentElement)
if (!mSuppressFocus && mCurrentElement)
UpdateCommands(NS_LITERAL_STRING("focus"));
return NS_OK;

View File

@ -87,7 +87,8 @@ protected:
nsCOMPtr<nsIDOMElement> mCurrentElement; // [OWNER]
nsCOMPtr<nsIDOMWindowInternal> mCurrentWindow; // [OWNER]
PRBool mSuppressFocus;
//PRBool mSuppressFocus;
PRUint32 mSuppressFocus;
PRBool mSuppressFocusScroll;
PRBool mActive;
PRBool mFocusInitialized;

View File

@ -56,7 +56,7 @@ static PRLogModuleInfo* gLog;
////////////////////////////////////////////////////////////////////////
nsXULCommandDispatcher::nsXULCommandDispatcher(void)
: mScriptObject(nsnull), mSuppressFocus(PR_FALSE),
: mScriptObject(nsnull), mSuppressFocus(0),
mActive(PR_FALSE), mFocusInitialized(PR_FALSE), mUpdaters(nsnull)
{
NS_INIT_REFCNT();
@ -618,18 +618,26 @@ nsXULCommandDispatcher::SetSuppressFocusScroll(PRBool aSuppressFocusScroll)
NS_IMETHODIMP
nsXULCommandDispatcher::GetSuppressFocus(PRBool* aSuppressFocus)
{
*aSuppressFocus = mSuppressFocus;
if(mSuppressFocus)
*aSuppressFocus = PR_TRUE;
else
*aSuppressFocus = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::SetSuppressFocus(PRBool aSuppressFocus)
{
mSuppressFocus = aSuppressFocus;
if(aSuppressFocus)
++mSuppressFocus;
else if(mSuppressFocus > 0)
--mSuppressFocus;
//printf("mSuppressFocus == %d\n", mSuppressFocus);
// we are unsuppressing after activating, so update focus-related commands
// we need this to update commands in the case where an element is focussed.
if (!aSuppressFocus && mCurrentElement)
if (!mSuppressFocus && mCurrentElement)
UpdateCommands(NS_LITERAL_STRING("focus"));
return NS_OK;

View File

@ -87,7 +87,8 @@ protected:
nsCOMPtr<nsIDOMElement> mCurrentElement; // [OWNER]
nsCOMPtr<nsIDOMWindowInternal> mCurrentWindow; // [OWNER]
PRBool mSuppressFocus;
//PRBool mSuppressFocus;
PRUint32 mSuppressFocus;
PRBool mSuppressFocusScroll;
PRBool mActive;
PRBool mFocusInitialized;

View File

@ -1054,8 +1054,12 @@ PRBool nsMacEventHandler::HandleActivateEvent(EventRecord& aOSEvent)
#endif
PRBool active;
mTopLevelWidget->IsActive(&active);
nsWindow* focusedWidget = mTopLevelWidget;
gEventDispatchHandler.SetActivated(focusedWidget);
if(!active) {
gEventDispatchHandler.SetActivated(focusedWidget);
}
// Twiddle menu bars
nsIMenuBar* menuBar = focusedWidget->GetMenuBar();

View File

@ -910,3 +910,8 @@ NS_IMETHODIMP nsMacWindow::PasswordFieldInit()
// to be implemented
return NS_OK;
}
void nsMacWindow::IsActive(PRBool* aActive)
{
*aActive = NS_REINTERPRET_CAST(WindowPeek, mWindowPtr)->hilited;
}

View File

@ -105,6 +105,7 @@ public:
void MoveToGlobalPoint(PRInt32 aX, PRInt32 aY);
void IsActive(PRBool* aActive);
protected:
pascal static OSErr DragTrackingHandler ( DragTrackingMessage theMessage, WindowPtr theWindow,