Bug 448767 - Make -moz-system-metric(mac-graphite-theme) live, r+sr=roc
--- 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;