0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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
This commit is contained in:
gpoirier 2008-11-27 11:34:26 +00:00
parent 189995fb63
commit cfedb9374f
2 changed files with 11 additions and 10 deletions

View File

@ -56,6 +56,10 @@
NSMenuItem *kAspectFullCmd;
NSMenuItem *kAspectWideCmd;
NSMenuItem *kPanScanCmd;
//timestamps for disabling screensaver and mouse hiding
int lastMouseHide;
int lastScreensaverUpdate;
}
- (BOOL) acceptsFirstResponder;

View File

@ -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;
}
}