Commit c4e62f99 authored by Markus Stange's avatar Markus Stange
Browse files

Bug 1600430 - Observe changes to the full keyboard access system pref. r=emilio

parent ab5b2c09
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -624,6 +624,12 @@ bool nsLookAndFeel::NativeGetFont(FontID aID, nsString& aFontName, gfxFontStyle&
                    name:@"AppleAquaScrollBarVariantChanged"
                  object:nil
      suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
  [NSDistributedNotificationCenter.defaultCenter
             addObserver:self
                selector:@selector(cachedValuesChanged)
                    name:@"com.apple.KeyboardUIModeDidChange"
                  object:nil
      suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];

  [MOZGlobalAppearance.sharedInstance addObserver:self
                                       forKeyPath:@"effectiveAppearance"
@@ -661,4 +667,10 @@ bool nsLookAndFeel::NativeGetFont(FontID aID, nsString& aFontName, gfxFontStyle&
  LookAndFeel::NotifyChangedAllWindows(widget::ThemeChangeKind::Style);
}

- (void)cachedValuesChanged {
  // We only need to re-cache (and broadcast) updated LookAndFeel values, so that they're up-to-date
  // the next time they're queried. No further change handling is needed.
  // TODO: Add a change hint for this which avoids the unnecessary media query invalidation.
  LookAndFeel::NotifyChangedAllWindows(widget::ThemeChangeKind::MediaQueriesOnly);
}
@end