summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorgpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-11-27 11:34:26 +0000
committergpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-11-27 11:34:26 +0000
commitcfedb9374f487a46c6e87b140f6664ee13085588 (patch)
tree0e1639e5e4a47bc9d514fbd17da0e604260a996d /libvo
parent189995fb63629eb10751dd15735adb9e30d37192 (diff)
downloadmpv-cfedb9374f487a46c6e87b140f6664ee13085588.tar.bz2
mpv-cfedb9374f487a46c6e87b140f6664ee13085588.tar.xz
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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28044 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_macosx.h4
-rw-r--r--libvo/vo_macosx.m17
2 files changed, 11 insertions, 10 deletions
diff --git a/libvo/vo_macosx.h b/libvo/vo_macosx.h
index 422a91a462..6320b49651 100644
--- a/libvo/vo_macosx.h
+++ b/libvo/vo_macosx.h
@@ -56,6 +56,10 @@
NSMenuItem *kAspectFullCmd;
NSMenuItem *kAspectWideCmd;
NSMenuItem *kPanScanCmd;
+
+ //timestamps for disabling screensaver and mouse hiding
+ int lastMouseHide;
+ int lastScreensaverUpdate;
}
- (BOOL) acceptsFirstResponder;
diff --git a/libvo/vo_macosx.m b/libvo/vo_macosx.m
index b70ccbc4e8..b756550ae3 100644
--- a/libvo/vo_macosx.m
+++ b/libvo/vo_macosx.m
@@ -759,28 +759,25 @@ static int control(uint32_t request, void *data, ...)
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;
}
}