Limit amount of polls per second a bit on MAC OS X, as it was quite high otherwise.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4089
This commit is contained in:
parent
908b9ec03d
commit
81202c7dd3
1 changed files with 23 additions and 5 deletions
|
@ -1491,14 +1491,32 @@ bool GFX_IsFullscreen(void) {
|
|||
return sdl.desktop.fullscreen;
|
||||
}
|
||||
|
||||
#if defined(MACOSX)
|
||||
#define DB_POLLSKIP 3
|
||||
#else
|
||||
//Not used yet, see comment below
|
||||
#define DB_POLLSKIP 1
|
||||
#endif
|
||||
|
||||
void GFX_Events() {
|
||||
//Don't poll too often. This can be heavy on the OS, especially Macs.
|
||||
//In idle mode 3000-4000 polls are done per second without this check.
|
||||
//Macs, with this code, max 250 polls per second. (non-macs unused default max 500)
|
||||
//Currently not implemented for all platforms, given the ALT-TAB stuff for WIN32.
|
||||
#if defined (MACOSX)
|
||||
static int last_check = 0;
|
||||
int current_check = GetTicks();
|
||||
if (current_check - last_check <= DB_POLLSKIP) return;
|
||||
last_check = current_check;
|
||||
#endif
|
||||
|
||||
SDL_Event event;
|
||||
#if defined (REDUCE_JOYSTICK_POLLING)
|
||||
static int poll_delay=0;
|
||||
int time=GetTicks();
|
||||
if (time-poll_delay>20) {
|
||||
poll_delay=time;
|
||||
if (sdl.num_joysticks>0) SDL_JoystickUpdate();
|
||||
static int poll_delay = 0;
|
||||
int time = GetTicks();
|
||||
if (time - poll_delay > 20) {
|
||||
poll_delay = time;
|
||||
if (sdl.num_joysticks > 0) SDL_JoystickUpdate();
|
||||
MAPPER_UpdateJoysticks();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue