adium-1.4 3485:e5fa9e2b19ae: Update tooltips when "scrollwheelin...
commits at adium.im
commits at adium.im
Fri May 6 00:17:50 UTC 2011
details: http://hg.adium.im/adium-1.4/rev/e5fa9e2b19ae
revision: 3485:e5fa9e2b19ae
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Fri May 06 03:17:32 2011 +0300
Update tooltips when "scrollwheeling" through the contact list. Refs #3480
Transplanted from 1.5hg [http://hg.adium.im/adium/rev/59f707927de3]
diffs (74 lines):
diff -r 7eb8dc9943b3 -r e5fa9e2b19ae Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.h
--- a/Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.h Thu May 05 16:53:07 2011 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.h Fri May 06 03:17:32 2011 +0300
@@ -51,6 +51,8 @@
NSPoint tooltipLocation; //Last tooltip location we told our delegate about
NSTrackingRectTag tooltipTrackingTag; //Tag for our tracking rect
int tooltipCount; //Used to determine how long before a tooltip appears
+
+ BOOL mouseIsScrolling;
}
/*!
diff -r 7eb8dc9943b3 -r e5fa9e2b19ae Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.m
--- a/Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.m Thu May 05 16:53:07 2011 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.m Fri May 06 03:17:32 2011 +0300
@@ -26,6 +26,8 @@
- (void)_startTrackingMouse;
- (void)_stopTrackingMouse;
- (void)_hideTooltip;
+
+- (void)contentViewBoundsDidChange;
@end
@interface NSWindow (SpacesDeterminationHackery)
@@ -46,6 +48,7 @@
delegate = inDelegate;
tooltipTrackingTag = -1;
tooltipLocation = NSZeroPoint;
+ mouseIsScrolling = NO;
//Reset cursor tracking when the view's frame changes
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -56,6 +59,14 @@
selector:@selector(resetCursorTracking)
name:AIWindowToolbarDidToggleVisibility
object:[view window]];
+
+ // Track contentView bounds changes (useful to detect scrolling)
+ if ([view isKindOfClass:[NSScrollView class]]) {
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(contentViewBoundsDidChange)
+ name:NSViewBoundsDidChangeNotification
+ object:[(NSScrollView *)view contentView]];
+ }
[self installCursorRect];
}
@@ -200,6 +211,12 @@
[self _stopTrackingMouse];
}
+// Handle scrolling
+- (void)contentViewBoundsDidChange
+{
+ mouseIsScrolling = YES;
+}
+
//Start tracking mouse movement
- (void)_startTrackingMouse
{
@@ -269,9 +286,12 @@
//the mouse is left still tooltipCount will eventually grow greater than TOOL_TIP_DELAY, and we will begin
//displaying the tooltips
if (tooltipCount > TOOL_TIP_DELAY) {
- if (!NSEqualPoints(tooltipLocation, mouseLocation)) {
+ if (!NSEqualPoints(tooltipLocation, mouseLocation) || mouseIsScrolling) {
[delegate showTooltipAtPoint:mouseLocation];
tooltipLocation = mouseLocation;
+
+ // Reset scrolling info
+ mouseIsScrolling = NO;
}
} else {
More information about the commits
mailing list