sdl: pause will now show/ungrab cursor in fullscreen. this can be disabled with the SDL.NoFullscreenCursor option

This commit is contained in:
punkrockguy318 2012-01-24 04:57:03 +00:00
parent a4d5e98ee7
commit 03ac9954a2
3 changed files with 40 additions and 3 deletions

View File

@ -1,4 +1,4 @@
23-jan-2012 - prg - sdl: pause will now show/ungrab cursor in fullscreen. this can be disabled with the SDL.NoFullscreenCursor option
12-jan-2012 - AnS - Tasedit: File->New Project, INPUT_TYPE_1P
12-jan-2012 - AnS - Tasedit: resizing TAS Editor window
08-jan-2012 - prg - sdl: switched advance one frame key from "\" to "`"

View File

@ -205,6 +205,8 @@ InitConfig()
config->addOption("subtitles", "SDL.SubtitleDisplay", 1);
config->addOption("fourscore", "SDL.FourScore", 0);
config->addOption("nofscursor", "SDL.NoFullscreenCursor", 0);
#ifdef _S9XLUA_H
// load lua script

View File

@ -181,6 +181,38 @@ void setHotKeys()
return;
}
/***
* This function is a wrapper for FCEUI_ToggleEmulationPause that handles
* releasing/capturing mouse pointer during pause toggles
* */
void TogglePause()
{
FCEUI_ToggleEmulationPause();
int x;
g_config->getOption("SDL.Fullscreen", &x);
if(x == 0)
return;
g_config->getOption("SDL.NoFullscreenCursor", &x);
if(x == 1)
return;
if (FCEUI_EmulationPaused() == 0)
{
SDL_ShowCursor(0);
SDL_WM_GrabInput (SDL_GRAB_ON);
}
else
{
SDL_ShowCursor(1);
SDL_WM_GrabInput (SDL_GRAB_OFF);
}
return;
}
/***
* This function opens a file chooser dialog and returns the filename the
* user selected.
@ -559,7 +591,10 @@ KeyboardCommands()
#endif
if(_keyonly(Hotkeys[HK_PAUSE])) {
FCEUI_ToggleEmulationPause();
//FCEUI_ToggleEmulationPause();
// use the wrapper function instead of the fceui function directly
// so we can handle cursor grabbage
TogglePause();
}
// Toggle throttling
@ -792,7 +827,7 @@ UpdatePhysicalInput()
case SDL_FCEU_HOTKEY_EVENT:
switch(event.user.code) {
case HK_PAUSE:
FCEUI_ToggleEmulationPause();
TogglePause();
break;
default:
FCEU_printf("Warning: unknown hotkey event %d\n", event.user.code);