[MPlayer-cvslog] r28044 - in trunk/libvo: vo_macosx.h vo_macosx.m

gpoirier subversion at mplayerhq.hu
Thu Nov 27 12:34:27 CET 2008


Author: gpoirier
Date: Thu Nov 27 12:34:26 2008
New Revision: 28044

Log:
factorize mouse hiding and screensaver disabling code
Based on the patch posted in thread:
from  Gregor Riepl %onitake A gmail P com%
date: Wed, Oct 29, 2008 at 7:26 PM
subject: Re: [MPlayer-dev-eng] [PATCH] Replaced deprecated QuickDraw calls in vo_quartz


Modified:
   trunk/libvo/vo_macosx.h
   trunk/libvo/vo_macosx.m

Modified: trunk/libvo/vo_macosx.h
==============================================================================
--- trunk/libvo/vo_macosx.h	(original)
+++ trunk/libvo/vo_macosx.h	Thu Nov 27 12:34:26 2008
@@ -56,6 +56,10 @@
 	NSMenuItem *kAspectFullCmd;
 	NSMenuItem *kAspectWideCmd;
 	NSMenuItem *kPanScanCmd;
+	
+	//timestamps for disabling screensaver and mouse hiding
+	int lastMouseHide;
+	int lastScreensaverUpdate;
 }
 
 - (BOOL) acceptsFirstResponder;

Modified: trunk/libvo/vo_macosx.m
==============================================================================
--- trunk/libvo/vo_macosx.m	(original)
+++ trunk/libvo/vo_macosx.m	Thu Nov 27 12:34:26 2008
@@ -759,28 +759,25 @@ static int control(uint32_t request, voi
 	
 	glFlush();
 	
+	curTime  = TickCount()/60;
+
 	//auto hide mouse cursor (and future on-screen control?)
 	if(isFullscreen && !mouseHide && !isRootwin)
 	{
-		int curTime = TickCount()/60;
-		static int lastTime = 0;
-		
-		if( ((curTime - lastTime) >= 5) || (lastTime == 0) )
+		if( ((curTime - lastMouseHide) >= 5) || (lastMouseHide == 0) )
 		{
 			CGDisplayHideCursor(kCGDirectMainDisplay);
-			mouseHide = YES;
-			lastTime = curTime;
+			mouseHide = TRUE;
+			lastMouseHide = curTime;
 		}
 	}
 	
 	//update activity every 30 seconds to prevent
 	//screensaver from starting up.
-	curTime  = TickCount()/60;
-		
-	if( ((curTime - lastTime) >= 30) || (lastTime == 0) )
+	if( ((curTime - lastScreensaverUpdate) >= 30) || (lastScreensaverUpdate == 0) )
 	{
 		UpdateSystemActivity(UsrActivity);
-		lastTime = curTime;
+		lastScreensaverUpdate = curTime;
 	}
 }
 



More information about the MPlayer-cvslog mailing list