Bug 550672 - Provide disable native theme preference for Qt port. r=dougt

This commit is contained in:
Oleg Romashin 2010-03-07 13:04:40 +02:00
Родитель 24c5ff1ebc
Коммит 1742dec3e1
2 изменённых файлов: 33 добавлений и 27 удалений

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

@ -53,13 +53,6 @@
#include "nsLookAndFeel.h" #include "nsLookAndFeel.h"
#include "nsAppShellSingleton.h" #include "nsAppShellSingleton.h"
#include "nsScreenManagerQt.h" #include "nsScreenManagerQt.h"
// #include "nsIComponentRegistrar.h"
// #include "nsComponentManagerUtils.h"
// #include "nsAutoPtr.h"
//
#include "nsFilePicker.h" #include "nsFilePicker.h"
#include "nsClipboard.h" #include "nsClipboard.h"
#include "nsClipboardHelper.h" #include "nsClipboardHelper.h"
@ -68,16 +61,9 @@
#include "nsSound.h" #include "nsSound.h"
#include "nsBidiKeyboard.h" #include "nsBidiKeyboard.h"
#include "nsNativeThemeQt.h" #include "nsNativeThemeQt.h"
// #include "nsScrollbar.h"
// // from nsWindow.cpp
// #include "nsGUIEvent.h" extern PRBool gDisableNativeTheme;
// #include "nsQtEventDispatcher.h"
// #include "nsIRenderingContext.h"
// #include "nsIServiceManager.h"
// #include "nsGfxCIID.h"
// #include "nsIPrefBranch.h"
// #include "nsIPrefService.h"
//
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsChildWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsChildWindow)
@ -87,23 +73,38 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable) NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel) NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerQt) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerQt)
/*
static NS_DEFINE_CID(kNativeScrollCID, NS_NATIVESCROLLBAR_CID);
*/
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard) NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper) NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard) NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIdleServiceQt) NS_GENERIC_FACTORY_CONSTRUCTOR(nsIdleServiceQt)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound) NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeQt)
//NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeScrollbar)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
static NS_IMETHODIMP
nsNativeThemeQtConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{
nsresult rv;
nsNativeThemeQt *inst;
if (gDisableNativeTheme)
return NS_ERROR_NO_INTERFACE;
*aResult = NULL;
if (NULL != aOuter)
return NS_ERROR_NO_AGGREGATION;
NS_NEWXPCOM(inst, nsNativeThemeQt);
if (NULL == inst)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(inst);
rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
return rv;
}
static const nsModuleComponentInfo components[] = static const nsModuleComponentInfo components[] =
{ {

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

@ -91,6 +91,9 @@
#include "gfxContext.h" #include "gfxContext.h"
#include "gfxSharedImageSurface.h" #include "gfxSharedImageSurface.h"
// imported in nsWidgetFactory.cpp
PRBool gDisableNativeTheme = PR_FALSE;
// Buffered Pixmap stuff // Buffered Pixmap stuff
static QPixmap *gBufferPixmap = nsnull; static QPixmap *gBufferPixmap = nsnull;
static int gBufferPixmapUsageCount = 0; static int gBufferPixmapUsageCount = 0;
@ -1869,7 +1872,9 @@ initialize_prefs(void)
PRBool val = PR_TRUE; PRBool val = PR_TRUE;
nsresult rv; nsresult rv;
rv = prefs->GetBoolPref("mozilla.widget.raise-on-setfocus", &val); rv = prefs->GetBoolPref("mozilla.widget.disable-native-theme", &val);
if (NS_SUCCEEDED(rv))
gDisableNativeTheme = val;
return NS_OK; return NS_OK;
} }