adium 3889:c098a4ad2bbc: Update tooltips when "scrollwheeling" t...

commits at adium.im commits at adium.im
Tue May 3 13:42:25 UTC 2011


details:	http://hg.adium.im/adium/rev/c098a4ad2bbc
revision:	3889:c098a4ad2bbc
branch:		(none)
author:		Adrian Godoroja <robotive at me.com>
date:		Tue May 03 16:41:23 2011 +0300

Update tooltips when "scrollwheeling" through the contact list. Fixes #3480

diffs (60 lines):

diff -r 45fa13123939 -r c098a4ad2bbc Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.h
--- a/Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.h	Sat Apr 30 17:23:31 2011 -0400
+++ b/Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.h	Tue May 03 16:41:23 2011 +0300
@@ -59,6 +59,9 @@
 	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
+	
+	id					scrollEventMonitor;				// Used to update a tooltip when mouse is scrolling
+	BOOL				mouseIsScrolling;				//
 }
 
 /*!
diff -r 45fa13123939 -r c098a4ad2bbc Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.m
--- a/Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.m	Sat Apr 30 17:23:31 2011 -0400
+++ b/Frameworks/AIUtilities Framework/Source/AISmoothTooltipTracker.m	Tue May 03 16:41:23 2011 +0300
@@ -222,6 +222,18 @@
 																	userInfo:nil
 																	 repeats:YES] retain];
 	}
+	
+	if (!scrollEventMonitor) {
+		scrollEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSScrollWheelMask handler:^(NSEvent *anEvent) {
+			if ([anEvent window] == [view window]) {
+				mouseIsScrolling = true;	
+			} else {
+				mouseIsScrolling = false;
+			}
+
+			return anEvent;
+		}];
+	}
 }
 
 //Stop tracking mouse movement
@@ -239,6 +251,10 @@
 		[theTimer invalidate];
 		[theTimer release]; theTimer = nil;
 	}
+	
+	if (scrollEventMonitor) {
+		[NSEvent removeMonitor:scrollEventMonitor], scrollEventMonitor = nil;
+	}
 }
 
 - (void)_hideTooltip
@@ -280,9 +296,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 data
+				mouseIsScrolling = false;
 			}
 			
 		} else {




More information about the commits mailing list