Adium

Ticket #131: transparentWebview.diff

File transparentWebview.diff, 5.5 kB (added by poisonousinsect, 3 years ago)

Lacks the permanent vertical scroll bar bgannin suggested in the forums (WebFrameView is not a descendent of NSScrollView). If it's not up to snuff, I'm happy to improve it.

  • Plugins/WebKit

    old new  
    107107 
    108108        //Observe preference changes and set our initial preferences 
    109109        [[adium preferenceController] registerPreferenceObserver:self forGroup:PREF_GROUP_WEBKIT_MESSAGE_DISPLAY]; 
     110         
     111        //Allow the alpha component to be set for our background color 
     112        [[NSColorPanel sharedColorPanel] setShowsAlpha:YES]; 
    110113} 
    111114 
    112115/*! 
     
    114117 */ 
    115118- (void)viewWillClose 
    116119{ 
     120        //Hide the alpha component 
     121        [[NSColorPanel sharedColorPanel] setShowsAlpha:NO]; 
     122         
    117123        [[adium notificationCenter] removeObserver:self]; 
    118124        [[adium preferenceController] unregisterPreferenceObserver:self]; 
    119125        [previewListObjectsDict release]; previewListObjectsDict = nil; 
  • Plugins/WebKit

    old new  
    3232 
    3333        return self; 
    3434} 
     35- (void)drawRect:(NSRect)rect 
     36{ 
     37        [super drawRect:rect]; 
     38        [[self window] performSelector:@selector(invalidateShadow) 
     39                                                withObject:nil 
     40                                                afterDelay:0 
     41                                                   inModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSEventTrackingRunLoopMode, nil]]; 
     42} 
     43 
    3544//Font Family ---------------------------------------------------------------------------------------------------------- 
    3645#pragma mark Font Family 
    3746- (void)setFontFamily:(NSString *)familyName 
  • Plugins/WebKit

    old new  
    4141 
    4242@class AIContentMessage, AIContentStatus, AIContentObject; 
    4343 
     44@interface WebView (PRIVATE) 
     45- (void)setDrawsBackground:(BOOL)flag; 
     46@end 
     47 
    4448@interface AIWebKitMessageViewController (PRIVATE) 
    4549- (id)initForChat:(AIChat *)inChat withPlugin:(AIWebKitMessageViewPlugin *)inPlugin; 
    4650- (void)_initWebView; 
     
    335339        [webView setUIDelegate:self]; 
    336340        [webView setDraggingDelegate:self]; 
    337341        [webView setMaintainsBackForwardList:NO]; 
    338          
     342        if ([webView respondsToSelector:@selector(setDrawsBackground:)]) [webView setDrawsBackground:NO]; 
     343 
    339344        if (!draggedTypes) { 
    340345                draggedTypes = [[NSArray alloc] initWithObjects: 
    341346                        NSFilenamesPboardType, 
  • Plugins/WebKit

    old new  
    10231023                                        } 
    10241024                                } 
    10251025                                if (customBackgroundColor) { 
    1026                                         [bodyTag appendString:[NSString stringWithFormat:@"background-color: #%@; ", [customBackgroundColor hexString]]]; 
     1026                                        float red, green, blue, alpha; 
     1027                                        [customBackgroundColor getRed:&red green:&green blue:&blue alpha:&alpha]; 
     1028                                        [bodyTag appendString:[NSString stringWithFormat:@"background-color: rgba(%i, %i, %i, %f); ", (int)(red * 255.0), (int)(green * 255.0), (int)(blue * 255.0), alpha]]; 
    10271029                                } 
    10281030                        } 
    10291031                         
  • Plugins/Dual

    old new  
    8888                 
    8989                //Load our window 
    9090                myWindow = [self window]; 
    91                  
     91 
     92                //Disable the optimization for opaque windows since ours might not be 
     93                [myWindow setOpaque:NO]; 
     94 
    9295                //Tab hiding suppression (used to force tab bars visible when a drag is occuring) 
    9396                tabBarIsVisible = YES; 
    9497                supressHiding = NO; 
     
    297300        } 
    298301         
    299302        [inTabViewItem setContainer:self]; 
     303         
     304        //Make the area under our tab view's message display view transparent 
     305//      [[[self window] contentView] makeTransparentUnderView:[[inTabViewItem messageViewController] messageDisplayView]]; 
    300306 
    301307        if (!silent) [[adium interfaceController] chatDidOpen:[inTabViewItem chat]]; 
    302308} 
     
    314320                [tabView_messages selectNextTabViewItem:nil]; 
    315321    } 
    316322         
     323        //Make the entire tab opaque again 
     324        //This includes the message display view we added before 
     325//      [[[self window] contentView] makeOpaqueUnderView:[inTabViewItem view]]; 
     326         
    317327    //Remove the tab and let the interface know a container closed 
    318328        [containedChats removeObject:[inTabViewItem chat]]; 
    319329        if (!silent) [[adium interfaceController] chatDidClose:[inTabViewItem chat]]; 
  • Plugins/Dual

    old new  
    272272        //scrollView_messages is originally a placeholder; replace it with controllerView_messages 
    273273        [controllerView_messages setFrame:[scrollView_messages documentVisibleRect]]; 
    274274        [[customView_messages superview] replaceSubview:customView_messages with:controllerView_messages]; 
     275 
     276        //This is what draws our transparent background 
     277        //Technically, it could be set in MessageView.nib, too 
     278        [scrollView_messages setBackgroundColor:[NSColor clearColor]]; 
     279 
    275280        [controllerView_messages setNextResponder:textView_outgoing]; 
    276281} 
    277282