remove app-specific code from tier-9 code. add a pref to handle native popup windows on Mac OS X instead. b=323062 r=smorgan sr=bsmedberg

This commit is contained in:
joshmoz@gmail.com 2007-03-30 12:51:51 -07:00
Родитель 0fcc24926a
Коммит ed5252f114
2 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -1471,8 +1471,8 @@ nsComboboxControlFrame::RestoreState(nsPresState* aState)
PRBool
nsComboboxControlFrame::ToolkitHasNativePopup()
{
#ifdef MOZ_MACBROWSER
return PR_TRUE;
#ifdef XP_MACOSX
return nsContentUtils::GetBoolPref("ui.use_native_popup_windows");
#else
return PR_FALSE;
#endif

Просмотреть файл

@ -49,6 +49,8 @@
#include "nsIBaseWindow.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIXULWindow.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
// defined in nsMenuBarX.mm
extern NSMenu* sApplicationMenu; // Application menu shared by all menubars
@ -186,10 +188,15 @@ nsresult nsCocoaWindow::StandardCreate(nsIWidget *aParent,
mWindowType = eWindowType_toplevel;
}
#ifdef MOZ_MACBROWSER
if (mWindowType == eWindowType_popup)
// Some applications like Camino use native popup windows
// (native context menus, native tooltips)
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRBool useNativeContextMenus;
nsresult rv = prefs->GetBoolPref("ui.use_native_popup_windows", &useNativeContextMenus);
if (NS_SUCCEEDED(rv) && useNativeContextMenus && mWindowType == eWindowType_popup)
return NS_OK;
#endif
}
// we default to NSBorderlessWindowMask, add features if needed
unsigned int features = NSBorderlessWindowMask;