Index: /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEInvertingTextFieldCell.m
===================================================================
--- /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEInvertingTextFieldCell.m	(revision 432)
+++ /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEInvertingTextFieldCell.m	(revision 433)
@@ -20,6 +20,5 @@
 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
 {
-    // XXX note cast to ICeCoffEEMenuOutlineView *; this is not general-purpose
-    if ([self isHighlighted] && [(ICeCoffEEMenuOutlineView *)controlView shouldUseActiveHighlight]) {
+    if ([self isHighlighted] && ICCF_ViewHasKeyboardFocus(controlView)) {
 	NSMutableAttributedString *astr = [[self attributedStringValue] mutableCopy];
 	unsigned location = 0, length = [astr length];
Index: /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEMenuOutlineView.h
===================================================================
--- /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEMenuOutlineView.h	(revision 432)
+++ /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEMenuOutlineView.h	(revision 433)
@@ -9,10 +9,9 @@
 #import <Cocoa/Cocoa.h>
 
+BOOL ICCF_ViewHasKeyboardFocus(NSView *view);
 
 @interface ICeCoffEEMenuOutlineView : NSOutlineView {
-    NSWindow *mainWindow; // not retained
+
 }
 
-- (BOOL)shouldUseActiveHighlight;
-
 @end
Index: /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEMenuOutlineView.m
===================================================================
--- /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEMenuOutlineView.m	(revision 432)
+++ /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEMenuOutlineView.m	(revision 433)
@@ -10,4 +10,32 @@
 #import <Carbon/Carbon.h>
 
+// Tiger or later, indicates whether highlighted row should draw as active
+@interface NSWindow (IC_KeyboardFocus)
+- (BOOL)_isKeyWindowIgnoringFocus;
+@end
+
+BOOL ICCF_ViewHasKeyboardFocus(NSView *view) {
+    NSWindow *window = [view window];
+    if ([window firstResponder] != view)
+	return NO;
+    
+    if ([window respondsToSelector: @selector(_isKeyWindowIgnoringFocus)])
+	return [window _isKeyWindowIgnoringFocus];
+    
+    // XXX is there a documented way to do this?
+    // see <http://lists.apple.com/archives/cocoa-dev/2008/Mar/msg00036.html>
+    
+    // test cases:
+    // - About System Preferences...
+    // - focused character palette
+    // - Help menu search (Shortcut)
+    // - menu extras
+    NSWindow *keyWindow = [NSApp keyWindow];
+    if (window != keyWindow && (keyWindow == nil || [keyWindow isKindOfClass: [NSPanel class]]))
+	return NO; // exclude NSCarbonMenuWindow
+    
+    return YES;
+}
+
 @implementation ICeCoffEEMenuOutlineView
 
@@ -18,24 +46,8 @@
 }
 
-// maintains main window (e.g., window to which sheet is attached) for use by shouldUseActiveHighlight
-- (void)viewDidMoveToWindow;
-{
-    mainWindow = [NSApp mainWindow];
-    [super viewDidMoveToWindow];
-}
-
 - (BOOL)shouldUseActiveHighlight;
 {
     return NO;
-    // test cases: - XXX there should be a better way to do this
-    // see <http://lists.apple.com/archives/cocoa-dev/2008/Mar/msg00036.html>
-    // - About System Preferences...
-    // - focused character palette
-    // - Help menu search (Shortcut)
-    // - menu extras
-    NSWindow *keyWindow = [NSApp keyWindow], *thisWindow = [self window];
-    if (keyWindow != thisWindow && [keyWindow isKindOfClass: [NSPanel class]])
-	return NO; // exclude NSCarbonMenuWindow
-    return [thisWindow firstResponder] == self && [NSApp mainWindow] == mainWindow;
+    return [[self window] _isKeyWindowIgnoringFocus];
 }
 
@@ -46,9 +58,6 @@
 
     HIThemeMenuItemDrawInfo drawInfo = {0, kThemeMenuItemHierBackground | kThemeMenuItemPopUpBackground, kThemeMenuSelected};
-    NSLog(@"firstResponder %@ key %@ isKey %d main %@", [[self window] firstResponder], [NSApp keyWindow], [[self window] isKeyWindow], [NSApp mainWindow]);
-    if (![self shouldUseActiveHighlight]) {
-	instrumentObjcMessageSends(YES);
+    if (!ICCF_ViewHasKeyboardFocus(self)) {
 	[super highlightSelectionInClipRect: clipRect];
-	instrumentObjcMessageSends(NO);
 	return;
     }
Index: /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEServicePrefController.m
===================================================================
--- /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEServicePrefController.m	(revision 432)
+++ /trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEServicePrefController.m	(revision 433)
@@ -478,5 +478,5 @@
     
     if (![outlineView isRowSelected: [outlineView rowForItem: item]] ||
-	![(ICeCoffEEMenuOutlineView *)outlineView shouldUseActiveHighlight]) {
+	!ICCF_ViewHasKeyboardFocus(outlineView)) {
 	if (!isInverted)
 	    return;
