bug 794038 pt 2.2 - don't attempt to change HiDPI mode on-the-fly in response to prefs or configuration changes. r=smichaud
authorJonathan Kew <jkew@mozilla.com>
Tue, 16 Oct 2012 20:41:20 +0100
changeset 110590 0cedf8847b2d426862e134e0beb87f209fc99ca7
parent 110589 1ee9ac5c2a0a0a02b904a55d5c4ec1fbd9652225
child 110591 eaccb5bb50c05ecbed2b7b301ca3d44e458cefe3
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewerssmichaud
bugs794038
milestone19.0a1
bug 794038 pt 2.2 - don't attempt to change HiDPI mode on-the-fly in response to prefs or configuration changes. r=smichaud
widget/cocoa/nsCocoaUtils.mm
--- a/widget/cocoa/nsCocoaUtils.mm
+++ b/widget/cocoa/nsCocoaUtils.mm
@@ -558,79 +558,23 @@ nsCocoaUtils::ConvertToCarbonModifier(NS
 //       1 : HiDPI enabled provided all screens have the same backing resolution
 //     > 1 : HiDPI enabled even if there are a mixture of screen modes
 
 // All the following code is to be removed once HiDPI work is more complete.
 
 static bool sHiDPIEnabled = false;
 static bool sHiDPIPrefInitialized = false;
 
-@interface ScreenParamChangeWatcher : NSObject
-- (id)init;
-@end
-
-@implementation ScreenParamChangeWatcher
-- (id)init
-{
-  [super init];
-  [[NSNotificationCenter defaultCenter]
-    addObserver:self
-       selector:@selector(applicationDidChangeScreenParameters:)
-           name:NSApplicationDidChangeScreenParametersNotification
-         object:NSApp];
-  return self;
-}
-
-- (void)applicationDidChangeScreenParameters:(NSNotification *)notification
-{
-  // reset flags so that the next call to HiDPIEnabled() will re-evaluate
-  sHiDPIEnabled = false;
-  sHiDPIPrefInitialized = false;
-}
-@end
-
-class HiDPIPrefObserver MOZ_FINAL : public nsIObserver {
-  public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIOBSERVER
-};
-
-NS_IMPL_ISUPPORTS1(HiDPIPrefObserver, nsIObserver)
-
-NS_IMETHODIMP
-HiDPIPrefObserver::Observe(nsISupports* aSubject, const char* aTopic,
-                           const PRUnichar* aData)
-{
-  // reset flags so that the next call to HiDPIEnabled() will re-evaluate
-  sHiDPIEnabled = false;
-  sHiDPIPrefInitialized = false;
-  return NS_OK;
-}
-
 // static
 bool
 nsCocoaUtils::HiDPIEnabled()
 {
-  static ScreenParamChangeWatcher* sChangeWatcher = nil;
-
   if (!sHiDPIPrefInitialized) {
     sHiDPIPrefInitialized = true;
 
-    if (!sChangeWatcher) {
-      // Create an object to watch for changes in screen configuration.
-      // Note that we'll leak this object at shutdown;
-      // this is all a temporary hack until we have multi-screen HiDPI working
-      // properly and can dispense with this code.
-      sChangeWatcher = [[ScreenParamChangeWatcher alloc] init];
-
-      // And create an observer for changes to the preference.
-      nsCOMPtr<nsIObserver> obs(new HiDPIPrefObserver());
-      Preferences::AddStrongObserver(obs, "gfx.hidpi.enabled");
-    }
-
     int prefSetting = Preferences::GetInt("gfx.hidpi.enabled", 1);
     if (prefSetting <= 0) {
       return false;
     }
 
     // prefSetting is at least 1, need to check attached screens...
 
     int scaleFactors = 0; // used as a bitset to track the screen types found