Bug fix for full screen mode update.

This commit is contained in:
Matthew Budd 2020-06-09 21:47:07 -04:00
parent cfbe2dc5f3
commit d086714040
2 changed files with 31 additions and 32 deletions

View File

@ -2366,10 +2366,11 @@ unsigned int GDKToSDLKeyval (int gdk_key)
} }
// ignore pause and screenshot hotkeys since they is handled by GTK+ as accelerators // ignore pause and screenshot hotkeys since they is handled by GTK+ as accelerators
if (sdl_key == Hotkeys[HK_PAUSE] || sdl_key == Hotkeys[HK_SCREENSHOT] || if ( (sdl_key == Hotkeys[HK_PAUSE]) || (sdl_key == Hotkeys[HK_SCREENSHOT]) ||
sdl_key == Hotkeys[HK_SAVE_STATE] (sdl_key == Hotkeys[HK_SAVE_STATE]) || (sdl_key == Hotkeys[HK_LOAD_STATE]) )
|| sdl_key == Hotkeys[HK_LOAD_STATE]) {
return 0; return 0;
}
return sdl_key; return sdl_key;
} }
@ -2416,7 +2417,23 @@ static gboolean convertKeypress (GtkWidget * grab, GdkEventKey * event,
// Create an SDL event from the keypress. // Create an SDL event from the keypress.
sdlev.key.keysym.scancode = SDL_GetScancodeFromKey(sdlkey); sdlev.key.keysym.scancode = SDL_GetScancodeFromKey(sdlkey);
sdlev.key.keysym.sym = sdlkey; sdlev.key.keysym.sym = sdlkey;
sdlev.key.keysym.mod = 0; sdlev.key.keysym.mod = 0;
if ( event->state & GDK_SHIFT_MASK )
{
sdlev.key.keysym.mod |= KMOD_SHIFT;
}
if ( event->state & GDK_CONTROL_MASK )
{
sdlev.key.keysym.mod |= KMOD_CTRL;
}
if ( event->state & GDK_MOD1_MASK )
{
sdlev.key.keysym.mod |= KMOD_ALT;
}
sdlev.key.repeat = 0;
if (sdlkey != 0) if (sdlkey != 0)
{ {
SDL_PushEvent (&sdlev); SDL_PushEvent (&sdlev);

View File

@ -49,7 +49,7 @@
#include <cstdio> #include <cstdio>
/** GLOBALS **/ /** GLOBALS **/
int NoWaiting = 1; int NoWaiting = 0;
extern Config *g_config; extern Config *g_config;
extern bool bindSavestate, frameAdvanceLagSkip, lagCounterDisplay; extern bool bindSavestate, frameAdvanceLagSkip, lagCounterDisplay;
@ -448,7 +448,7 @@ unsigned int *GetKeyboard(void)
/** /**
* Parse keyboard commands and execute accordingly. * Parse keyboard commands and execute accordingly.
*/ */
static void KeyboardCommands () static void KeyboardCommands (void)
{ {
int is_shift, is_alt; int is_shift, is_alt;
@ -474,11 +474,6 @@ static void KeyboardCommands ()
FCEUI_DispMessage ("Family Keyboard %sabled.", 0, FCEUI_DispMessage ("Family Keyboard %sabled.", 0,
g_fkbEnabled ? "en" : "dis"); g_fkbEnabled ? "en" : "dis");
} }
#if SDL_VERSION_ATLEAST(2, 0, 0)
// TODO - SDL2
#else
SDL_WM_GrabInput (g_fkbEnabled ? SDL_GRAB_ON : SDL_GRAB_OFF);
#endif
if (g_fkbEnabled) if (g_fkbEnabled)
{ {
return; return;
@ -502,23 +497,11 @@ static void KeyboardCommands ()
#endif #endif
{ {
is_alt = 1; is_alt = 1;
#if !SDL_VERSION_ATLEAST(2, 0, 0)
// workaround for GDK->SDL in GTK problems where ALT release is never
// getting sent
// I know this is sort of an ugly hack to fix this, but the bug is
// rather annoying
// prg318 10/23/11
int fullscreen;
g_config->getOption ("SDL.Fullscreen", &fullscreen);
if (!fullscreen)
{
g_keyState[SDLK_LALT] = 0;
g_keyState[SDLK_RALT] = 0;
}
#endif
} }
else else
{
is_alt = 0; is_alt = 0;
}
if (_keyonly (Hotkeys[HK_TOGGLE_BG])) if (_keyonly (Hotkeys[HK_TOGGLE_BG]))
@ -534,12 +517,11 @@ static void KeyboardCommands ()
} }
// Alt-Enter to toggle full-screen // Alt-Enter to toggle full-screen
if (keyonly (ENTER) && is_alt) // This is already handled by GTK Accelerator
{ //if (keyonly (ENTER) && is_alt)
ToggleFS (); //{
} // ToggleFS ();
//}
// Toggle Movie auto-backup // Toggle Movie auto-backup
if (keyonly (M) && is_shift) if (keyonly (M) && is_shift)
@ -687,10 +669,10 @@ static void KeyboardCommands ()
} }
// Toggle throttling // Toggle throttling
NoWaiting &= ~1;
if ( _keyonly(Hotkeys[HK_TURBO]) ) if ( _keyonly(Hotkeys[HK_TURBO]) )
{ {
NoWaiting |= 1; NoWaiting ^= 1;
//printf("NoWaiting: 0x%04x\n", NoWaiting );
} }
static bool frameAdvancing = false; static bool frameAdvancing = false;