зеркало из https://github.com/mozilla/pjs.git
Fix bug # 127763: on Mac OS X, sheets shouldn't deactivate their parent window's frame. r=pink sr=sfraser a=roc+moz
This commit is contained in:
Родитель
e16382e587
Коммит
33c5ddd832
|
@ -941,9 +941,26 @@ void nsMacMessagePump::DoActivate(EventRecord &anEvent)
|
|||
WindowPtr whichWindow = (WindowPtr)anEvent.message;
|
||||
nsGraphicsUtils::SafeSetPortWindowPort(whichWindow);
|
||||
if (anEvent.modifiers & activeFlag)
|
||||
{
|
||||
::HiliteWindow(whichWindow,TRUE);
|
||||
}
|
||||
else
|
||||
::HiliteWindow(whichWindow,FALSE);
|
||||
{
|
||||
PRBool ignoreDeactivate = PR_FALSE;
|
||||
nsCOMPtr<nsIWidget> windowWidget;
|
||||
nsToolkit::GetTopWidget ( whichWindow, getter_AddRefs(windowWidget));
|
||||
if (windowWidget)
|
||||
{
|
||||
nsCOMPtr<nsPIWidgetMac> window ( do_QueryInterface(windowWidget) );
|
||||
if (window)
|
||||
{
|
||||
window->GetIgnoreDeactivate(&ignoreDeactivate);
|
||||
window->SetIgnoreDeactivate(PR_FALSE);
|
||||
}
|
||||
}
|
||||
if (!ignoreDeactivate)
|
||||
::HiliteWindow(whichWindow,FALSE);
|
||||
}
|
||||
|
||||
DispatchOSEventToRaptor(anEvent, whichWindow);
|
||||
}
|
||||
|
|
|
@ -188,6 +188,7 @@ nsMacWindow::nsMacWindow() : Inherited()
|
|||
, mWindowMadeHere(PR_FALSE)
|
||||
, mIsDialog(PR_FALSE)
|
||||
, mIsSheet(PR_FALSE)
|
||||
, mIgnoreDeactivate(PR_FALSE)
|
||||
, mMacEventHandler(nsnull)
|
||||
, mAcceptsActivation(PR_TRUE)
|
||||
, mIsActive(PR_FALSE)
|
||||
|
@ -803,6 +804,7 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool bState)
|
|||
#if TARGET_CARBON
|
||||
// Mac OS X sheet support
|
||||
nsIWidget *parentWidget = mParent;
|
||||
nsCOMPtr<nsPIWidgetMac> piParentWidget ( do_QueryInterface(parentWidget) );
|
||||
WindowRef parentWindowRef = (parentWidget) ?
|
||||
reinterpret_cast<WindowRef>(parentWidget->GetNativeData(NS_NATIVE_DISPLAY)) : nsnull;
|
||||
#endif
|
||||
|
@ -816,6 +818,8 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool bState)
|
|||
#if TARGET_CARBON
|
||||
if ( mIsSheet && parentWindowRef ) {
|
||||
WindowPtr top = GetWindowTop(parentWindowRef);
|
||||
if (piParentWidget)
|
||||
piParentWidget->SetIgnoreDeactivate(PR_TRUE);
|
||||
::ShowSheetWindow(mWindowPtr, top);
|
||||
UpdateWindowMenubar(parentWindowRef, PR_FALSE);
|
||||
gEventDispatchHandler.DispatchGuiEvent(this, NS_GOTFOCUS);
|
||||
|
@ -849,6 +853,8 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool bState)
|
|||
#if TARGET_CARBON
|
||||
// Mac OS X sheet support
|
||||
if (mIsSheet) {
|
||||
if (piParentWidget)
|
||||
piParentWidget->SetIgnoreDeactivate(PR_FALSE);
|
||||
::HideSheetWindow(mWindowPtr);
|
||||
|
||||
gEventDispatchHandler.DispatchGuiEvent(this, NS_DEACTIVATE);
|
||||
|
@ -1295,6 +1301,26 @@ nsMacWindow::GetMenuBar(nsIMenuBar **_retval)
|
|||
return(NS_OK);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// getter/setter for window to ignore the next deactivate event received
|
||||
// if a Mac OS X sheet is being opened
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsMacWindow::GetIgnoreDeactivate(PRBool *_retval)
|
||||
{
|
||||
*_retval = mIgnoreDeactivate;
|
||||
return(NS_OK);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacWindow::SetIgnoreDeactivate(PRBool ignoreDeactivate)
|
||||
{
|
||||
mIgnoreDeactivate = ignoreDeactivate;
|
||||
return(NS_OK);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -151,6 +151,7 @@ protected:
|
|||
PRBool mWindowMadeHere; // true if we created the window
|
||||
PRBool mIsDialog; // true if the window is a dialog
|
||||
PRBool mIsSheet; // true if the window is a sheet (Mac OS X)
|
||||
PRBool mIgnoreDeactivate; // true if this window has a (Mac OS X) sheet opening
|
||||
auto_ptr<nsMacEventHandler> mMacEventHandler;
|
||||
nsIWidget *mOffsetParent;
|
||||
PRBool mAcceptsActivation;
|
||||
|
|
|
@ -42,6 +42,9 @@ interface nsPIWidgetMac : nsISupports
|
|||
|
||||
// Obtain the menubar for a window
|
||||
nsIMenuBar GetMenuBar ( );
|
||||
|
||||
// True if window should ignore the next deactivate event it receives
|
||||
attribute boolean ignoreDeactivate;
|
||||
|
||||
}; // nsPIWidgetMac
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче