Bug 754866 - Make mozilla.widget.disable-native-theme export shared bool across widgets. r=roc

This commit is contained in:
Oleg Romashin
2012-05-15 09:01:48 -04:00
parent 47b7e7d752
commit e318d2e79b
4 changed files with 11 additions and 18 deletions

View File

@@ -302,9 +302,6 @@ typedef struct _GdkDisplay GdkDisplay;
// cursor cache // cursor cache
static GdkCursor *gCursorCache[eCursorCount]; static GdkCursor *gCursorCache[eCursorCount];
// imported in nsWidgetFactory.cpp
bool gDisableNativeTheme = false;
static GtkWidget *gInvisibleContainer = NULL; static GtkWidget *gInvisibleContainer = NULL;
// Sometimes this actually also includes the state of the modifier keys, but // Sometimes this actually also includes the state of the modifier keys, but
@@ -5763,8 +5760,6 @@ initialize_prefs(void)
{ {
gRaiseWindows = gRaiseWindows =
Preferences::GetBool("mozilla.widget.raise-on-setfocus", true); Preferences::GetBool("mozilla.widget.raise-on-setfocus", true);
gDisableNativeTheme =
Preferences::GetBool("mozilla.widget.disable-native-theme", false);
return NS_OK; return NS_OK;
} }

View File

@@ -156,9 +156,6 @@ extern "C" {
using namespace mozilla; using namespace mozilla;
using namespace mozilla::widget; using namespace mozilla::widget;
// imported in nsWidgetFactory.cpp
bool gDisableNativeTheme = false;
// Cached offscreen surface // Cached offscreen surface
static nsRefPtr<gfxASurface> gBufferSurface; static nsRefPtr<gfxASurface> gBufferSurface;
#ifdef MOZ_HAVE_SHMIMAGE #ifdef MOZ_HAVE_SHMIMAGE
@@ -2597,10 +2594,6 @@ nsresult
initialize_prefs(void) initialize_prefs(void)
{ {
// check to see if we should set our raise pref // check to see if we should set our raise pref
gDisableNativeTheme =
Preferences::GetBool("mozilla.widget.disable-native-theme",
gDisableNativeTheme);
return NS_OK; return NS_OK;
} }

View File

@@ -301,10 +301,6 @@ PRLogModuleInfo* gWindowsLog = nsnull;
// Kbd layout. Used throughout character processing. // Kbd layout. Used throughout character processing.
static KeyboardLayout gKbdLayout; static KeyboardLayout gKbdLayout;
// Global user preference for disabling native theme. Used
// in NativeWindowTheme.
bool gDisableNativeTheme = false;
// Global used in Show window enumerations. // Global used in Show window enumerations.
static bool gWindowsVisible = false; static bool gWindowsVisible = false;
@@ -650,8 +646,6 @@ nsWindow::Create(nsIWidget *aParent,
(WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)) ? 1 : 0; (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)) ? 1 : 0;
sSwitchKeyboardLayout = sSwitchKeyboardLayout =
Preferences::GetBool("intl.keyboard.per_window_layout", false); Preferences::GetBool("intl.keyboard.per_window_layout", false);
gDisableNativeTheme =
Preferences::GetBool("mozilla.widget.disable-native-theme", false);
} }
return NS_OK; return NS_OK;

View File

@@ -77,6 +77,9 @@ using base::Thread;
using mozilla::ipc::AsyncChannel; using mozilla::ipc::AsyncChannel;
nsIContent* nsBaseWidget::mLastRollup = nsnull; nsIContent* nsBaseWidget::mLastRollup = nsnull;
// Global user preference for disabling native theme. Used
// in NativeWindowTheme.
bool gDisableNativeTheme = false;
// nsBaseWidget // nsBaseWidget
NS_IMPL_ISUPPORTS1(nsBaseWidget, nsIWidget) NS_IMPL_ISUPPORTS1(nsBaseWidget, nsIWidget)
@@ -204,6 +207,14 @@ void nsBaseWidget::BaseCreate(nsIWidget *aParent,
nsDeviceContext *aContext, nsDeviceContext *aContext,
nsWidgetInitData *aInitData) nsWidgetInitData *aInitData)
{ {
static bool gDisableNativeThemeCached = false;
if (!gDisableNativeThemeCached) {
mozilla::Preferences::AddBoolVarCache(&gDisableNativeTheme,
"mozilla.widget.disable-native-theme",
gDisableNativeTheme);
gDisableNativeThemeCached = true;
}
// save the event callback function // save the event callback function
mEventCallback = aHandleEventFunction; mEventCallback = aHandleEventFunction;