Ticket #1134: Colloquy-1134-take2.patch

File Colloquy-1134-take2.patch, 3.1 kB (added by eschaton, 7 months ago)

A better version of Colloquy-1134.patch

  • Views/JVSideOutlineView.m

    old new  
    1010                outData[i] = ( 1. - a ) * dark[i] + a * light[i]; 
    1111} 
    1212 
     13@interface NSOutlineView (InternalMethodsColloquyOverridesPreLeopard) 
     14- (NSColor *)_highlightColorForCell:(NSCell *)cell; 
     15- (void)_highlightRow:(int)row clipRect:(NSRect)clip; 
     16@end 
     17 
    1318@implementation JVSideOutlineView 
    1419- (NSColor *) _highlightColorForCell:(NSCell *) cell { 
     20    if ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) && [NSOutlineView instancesRespondToSelector:@selector(_highlightColorForCell:)]) { 
     21        return [super _highlightColorForCell:cell]; 
     22    } 
     23 
    1524    // return nil to prevent normal selection drawing 
    1625    return nil; 
    1726} 
    1827 
    1928- (void) _highlightRow:(int) row clipRect:(NSRect) clip { 
     29        if ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) && [NSOutlineView instancesRespondToSelector:@selector(_highlightRow:clipRect:)]) { 
     30                [super _highlightRow:row clipRect:clip]; 
     31                return; 
     32        } 
     33         
    2034        NSRect highlight = [self rectOfRow:row]; 
    2135 
    2236        struct CGFunctionCallbacks callbacks = { 0, gradientInterpolate, NULL }; 
     
    4155} 
    4256 
    4357- (void) drawBackgroundInClipRect:(NSRect) clipRect { 
     58        if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) { 
     59                [super drawBackgroundInClipRect:clipRect]; 
     60                return; 
     61        } 
     62         
    4463        static NSColor *backgroundColor = nil; 
    4564        if( ! backgroundColor ) 
    4665                backgroundColor = [[NSColor colorWithCalibratedRed:( 229. / 255. ) green:( 237. / 255. ) blue:( 247. / 255. ) alpha:1.] retain]; 
  • Controllers/JVChatWindowController.m

    old new  
    1212NSString *JVToolbarToggleChatDrawerItemIdentifier = @"JVToolbarToggleChatDrawerItem"; 
    1313NSString *JVChatViewPboardType = @"Colloquy Chat View v1.0 pasteboard type"; 
    1414 
     15#pragma mark - 
     16 
     17#if !defined(MAC_OS_X_VERSION_10_5) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5) 
     18 
     19enum { 
     20        NSTableViewSelectionHighlightStyleRegular = 0, 
     21        NSTableViewSelectionHighlightStyleSourceList = 1, 
     22}; 
     23typedef int NSTableViewSelectionHighlightStyle; 
     24 
     25@interface NSTableView (LeopardMethodsForBuildingWithPreLeopardSDK) 
     26- (void)setSelectionHighlightStyle:(NSTableViewSelectionHighlightStyle)value; 
     27- (NSTableViewSelectionHighlightStyle)selectionHighlightStyle; 
     28@end 
     29#endif 
     30 
    1531@interface NSToolbar (NSToolbarPrivate) 
    1632- (NSView *) _toolbarView; 
    1733@end 
     
    7288        [chatViewsOutlineView registerForDraggedTypes:[NSArray arrayWithObjects:JVChatViewPboardType, NSFilenamesPboardType, nil]]; 
    7389        [chatViewsOutlineView setMenu:[[[NSMenu allocWithZone:nil] initWithTitle:@""] autorelease]]; 
    7490 
     91        if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) { 
     92                [chatViewsOutlineView setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList]; 
     93        } 
     94         
    7595        [favoritesButton setMenu:[MVConnectionsController favoritesMenu]]; 
    7696 
    7797        [self setShouldCascadeWindows:NO];