Bug 448767 - Make -moz-system-metric(mac-graphite-theme) live, r+sr=roc
authorMarkus Stange <mstange@themasta.com>
Wed, 17 Sep 2008 18:26:57 +0200
changeset 19344 c4147dd93eb9d0bd409b4474d271a7edbb3ce725
parent 19343 86c65d62602d434f9bca5847ff32fc74894e9d01
child 19345 2c1cb5185c2d2ef403c65b83ed4f61ddc121af49
push id2148
push usermstange@themasta.com
push dateWed, 17 Sep 2008 16:28:17 +0000
treeherdermozilla-central@c4147dd93eb9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs448767
milestone1.9.1b1pre
Bug 448767 - Make -moz-system-metric(mac-graphite-theme) live, r+sr=roc
widget/src/cocoa/nsChildView.mm
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -2243,16 +2243,20 @@ NSEvent* gLastDragEvent = nil;
                                                           NSStringPboardType,
                                                           NSURLPboardType,
                                                           NSFilesPromisePboardType,
                                                           kWildcardPboardType,
                                                           kCorePboardType_url,
                                                           kCorePboardType_urld,
                                                           kCorePboardType_urln,
                                                           nil]];
+  [[NSNotificationCenter defaultCenter] addObserver:self
+                                           selector:@selector(controlTintChanged)
+                                               name:NSControlTintDidChangeNotification
+                                             object:nil];
 
   return self;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 
 - (void)dealloc
@@ -2262,16 +2266,18 @@ NSEvent* gLastDragEvent = nil;
   [mPendingDirtyRects release];
   [mLastMouseDownEvent release];
   if (mPluginTSMDoc)
     ::DeleteTSMDocument(mPluginTSMDoc);
   
   if (sLastViewEntered == self)
     sLastViewEntered = nil;
 
+  [[NSNotificationCenter defaultCenter] removeObserver:self];
+
   [super dealloc];    
 
   // This sets the current port to _savePort.
   // todo: Only do if a Quickdraw plugin is present in the hierarchy!
   ::SetPort(NULL);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
@@ -2312,16 +2318,26 @@ NSEvent* gLastDragEvent = nil;
 // mozView method, set the NSWindow that this view is associated with (even when
 // not in the view hierarchy).
 - (void)setNativeWindow:(NSWindow*)aWindow
 {
   mWindow = aWindow;
 }
 
 
+- (void)controlTintChanged
+{
+  if (!mGeckoChild)
+    return;
+
+  nsGUIEvent guiEvent(PR_TRUE, NS_THEMECHANGED, mGeckoChild);
+  mGeckoChild->DispatchWindowEvent(guiEvent);
+}
+
+
 - (void)setNeedsPendingDisplay
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   mPendingFullDisplay = YES;
   [self performSelector:@selector(processPendingRedraws) withObject:nil afterDelay:0];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;