# HG changeset patch # User gpoirier # Date 1227785666 0 # Node ID 0a0f63090e608be7d0745549f560fd0932cc47a7 # Parent 1653ae9be02f9eb0ff452fe538082c087e0b5bb2 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 diff -r 1653ae9be02f -r 0a0f63090e60 libvo/vo_macosx.h --- a/libvo/vo_macosx.h Wed Nov 26 18:49:16 2008 +0000 +++ b/libvo/vo_macosx.h Thu Nov 27 11:34:26 2008 +0000 @@ -56,6 +56,10 @@ NSMenuItem *kAspectFullCmd; NSMenuItem *kAspectWideCmd; NSMenuItem *kPanScanCmd; + + //timestamps for disabling screensaver and mouse hiding + int lastMouseHide; + int lastScreensaverUpdate; } - (BOOL) acceptsFirstResponder; diff -r 1653ae9be02f -r 0a0f63090e60 libvo/vo_macosx.m --- a/libvo/vo_macosx.m Wed Nov 26 18:49:16 2008 +0000 +++ b/libvo/vo_macosx.m Thu Nov 27 11:34:26 2008 +0000 @@ -759,28 +759,25 @@ 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; } }