adium-1.4 2754:df722b0497ca: Set the focus element for all eleme...
commits at adium.im
commits at adium.im
Sat Nov 7 21:24:03 UTC 2009
details: http://hg.adium.im/adium-1.4/rev/df722b0497ca
revision: 2754:df722b0497ca
author: Zachary West <zacw at adium.im>
date: Sat Nov 07 16:24:00 2009 -0500
Set the focus element for all elements when out of focus. Fixes #13356.
This also fixes setting the mark location correctly, as well as sets the first non-focused message as having class "firstFocus".
diffs (61 lines):
diff -r 2451fa3d9e4d -r df722b0497ca Plugins/WebKit Message View/AIWebKitMessageViewController.m
--- a/Plugins/WebKit Message View/AIWebKitMessageViewController.m Sat Nov 07 15:42:01 2009 -0500
+++ b/Plugins/WebKit Message View/AIWebKitMessageViewController.m Sat Nov 07 16:24:00 2009 -0500
@@ -680,14 +680,19 @@
if (content.trackContent && [content.displayClasses containsObject:@"mention"]) {
[self markCurrentLocation];
}
-
- // Set it as a focus if appropriate.
- if (nextMessageFocus && [content.type isEqualToString:CONTENT_MESSAGE_TYPE]) {
- if (adium.interfaceController.activeChat != content.chat) {
- [content addDisplayClass:@"focus"];
+
+ if (adium.interfaceController.activeChat != content.chat && [content.type isEqualToString:CONTENT_MESSAGE_TYPE]) {
+ if (nextMessageFocus) {
+ [self.markedScroller addMarkAt:[self.currentOffsetHeight integerValue] withIdentifier:@"focus" withColor:[NSColor redColor]];
+
+ // Add a class for "first message to lose focus"
+ [content addDisplayClass:@"firstFocus"];
+
+ nextMessageFocus = NO;
}
-
- nextMessageFocus = NO;
+
+ // Add a class for "this message received while out of focus"
+ [content addDisplayClass:@"focus"];
}
//Add the content object
@@ -1456,12 +1461,10 @@
- (void)markForFocusChange
{
- JVMarkedScroller *scroller = self.markedScroller;
+ // We use the current Chat element's height to determine our mark location.
+ [self.markedScroller removeMarkWithIdentifier:@"focus"];
- // We use the current Chat element's height to determine our mark location.
- [scroller removeMarkWithIdentifier:@"focus"];
- [scroller addMarkAt:[self.currentOffsetHeight integerValue] withIdentifier:@"focus" withColor:[NSColor redColor]];
-
+ // The next message being inserted needs to add a mark.
nextMessageFocus = YES;
DOMNodeList *nodeList = [webView.mainFrameDocument querySelectorAll:@".focus"];
@@ -1472,13 +1475,13 @@
classes = [[node.className componentsSeparatedByString:@" "] mutableCopy];
[classes removeObject:@"focus"];
+ [classes removeObject:@"firstFocus"];
node.className = [classes componentsJoinedByString:@" "];
[classes release];
}
- nextMessageFocus = YES;
}
- (void)addMark
More information about the commits
mailing list