Ignore:
Timestamp:
03/03/08 08:59:32 (16 years ago)
Author:
Nicholas Riley
Message:

Fragile hack to determine whether we should draw the highlighted row as active.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEMenuOutlineView.m

    r429 r432  
    1818}
    1919
     20// maintains main window (e.g., window to which sheet is attached) for use by shouldUseActiveHighlight
     21- (void)viewDidMoveToWindow;
     22{
     23    mainWindow = [NSApp mainWindow];
     24    [super viewDidMoveToWindow];
     25}
     26
     27- (BOOL)shouldUseActiveHighlight;
     28{
     29    return NO;
     30    // test cases: - XXX there should be a better way to do this
     31    // see <http://lists.apple.com/archives/cocoa-dev/2008/Mar/msg00036.html>
     32    // - About System Preferences...
     33    // - focused character palette
     34    // - Help menu search (Shortcut)
     35    // - menu extras
     36    NSWindow *keyWindow = [NSApp keyWindow], *thisWindow = [self window];
     37    if (keyWindow != thisWindow && [keyWindow isKindOfClass: [NSPanel class]])
     38        return NO; // exclude NSCarbonMenuWindow
     39    return [thisWindow firstResponder] == self && [NSApp mainWindow] == mainWindow;
     40}
     41
    2042- (void)highlightSelectionInClipRect:(NSRect)clipRect;
    2143{
     
    2446
    2547    HIThemeMenuItemDrawInfo drawInfo = {0, kThemeMenuItemHierBackground | kThemeMenuItemPopUpBackground, kThemeMenuSelected};
    26     if ([[self window] firstResponder] != self || [NSApp keyWindow] != [self window]) {
    27         NSLog(@"firstResponder %@ key %@ main %@ this %@", [[self window] firstResponder], [NSApp keyWindow], [NSApp mainWindow], [self window]);
     48    NSLog(@"firstResponder %@ key %@ isKey %d main %@", [[self window] firstResponder], [NSApp keyWindow], [[self window] isKeyWindow], [NSApp mainWindow]);
     49    if (![self shouldUseActiveHighlight]) {
     50        instrumentObjcMessageSends(YES);
    2851        [super highlightSelectionInClipRect: clipRect];
     52        instrumentObjcMessageSends(NO);
    2953        return;
    3054    }
Note: See TracChangeset for help on using the changeset viewer.