From 1cba5e2e5e0c1974ddc9136779ac61af5c162013 Mon Sep 17 00:00:00 2001 From: "bsmedberg%covad.net" Date: Tue, 22 Jun 2004 19:22:00 +0000 Subject: [PATCH] Re-add logic for bug 239914: use the classic skin when OS accessibility is enabled, because it obeys system colors and preferences. --- toolkit/xre/nsAppRunner.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 0eba25fbf5a..bb0455f9be5 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -71,6 +71,7 @@ #include "nsIExtensionManager.h" #include "nsIIOService.h" #include "nsILocaleService.h" +#include "nsILookAndFeel.h" #include "nsIObserverService.h" #include "nsINativeAppSupport.h" #include "nsIPref.h" @@ -88,6 +89,7 @@ #include "nsCRT.h" #include "nsCOMPtr.h" #include "nsNetUtil.h" +#include "nsWidgetsCID.h" #include "nsXPCOM.h" #include "nsXPIDLString.h" @@ -867,6 +869,7 @@ public: nsresult RegisterProfileService(nsIToolkitProfileService* aProfileService); nsresult InitEventQueue(); nsresult SetWindowCreator(nsINativeAppSupport* native); + void CheckAccessibleSkin(); private: nsIServiceManager* mServiceManager; @@ -994,6 +997,33 @@ ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native) return wwatch->SetWindowCreator(creator); } +NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); + +void +ScopedXPCOMStartup::CheckAccessibleSkin() +{ + nsCOMPtr lookAndFeel (do_GetService(kLookAndFeelCID)); + + if (lookAndFeel) { + PRInt32 useAccessibilityTheme = 0; + + lookAndFeel->GetMetric(nsILookAndFeel::eMetric_UseAccessibilityTheme, + useAccessibilityTheme); + + if (useAccessibilityTheme) { + // If OS accessibility is active, use the classic skin, which obeys the + // system accessibility colors. + nsCOMPtr chromeRegistry + (do_GetService(NS_CHROMEREGISTRY_CONTRACTID)); + if (chromeRegistry) { + // Make change this session only + chromeRegistry->SetRuntimeProvider(PR_TRUE); + chromeRegistry->SelectSkin(NS_LITERAL_CSTRING("classic/1.0"), PR_TRUE); + } + } + } +} + // don't modify aAppDir directly... clone it first static int VerifyInstallation(nsIFile* aAppDir) @@ -1306,6 +1336,8 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc, NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); { //extra scoping is needed so we release these components before xpcom shutdown + xpcom.CheckAccessibleSkin(); + nsCOMPtr windowWatcher (do_GetService(NS_WINDOWWATCHER_CONTRACTID)); nsCOMPtr ioParamBlock @@ -1871,6 +1903,8 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData) io->SetOffline(PR_TRUE); } + xpcom.CheckAccessibleSkin(); + { NS_TIMELINE_ENTER("startupNotifier"); nsCOMPtr startupNotifier