From a7c16f1835b8daebe0bea55a5b37fc49bf2192db Mon Sep 17 00:00:00 2001 From: plombo Date: Sat, 19 Mar 2011 01:44:13 +0000 Subject: [PATCH] gtk: set Pause key as an accelerator and don't send the keypress event to SDL Now the Pause/Resume menu item changes state when the emulator is paused or unpaused using the Pause key. --- src/drivers/sdl/gui.cpp | 5 ++++- src/drivers/sdl/input.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/drivers/sdl/gui.cpp b/src/drivers/sdl/gui.cpp index 8896648c..fe4a9978 100644 --- a/src/drivers/sdl/gui.cpp +++ b/src/drivers/sdl/gui.cpp @@ -1768,6 +1768,9 @@ unsigned short GDKToSDLKeyval(int gdk_key) return 0; } + // ignore Pause hotkey since it is handled by GTK+ as an accelerator + if (sdl_key == Hotkeys[HK_PAUSE]) return 0; + return sdl_key; } @@ -1902,7 +1905,7 @@ static GtkActionEntry normal_entries[] = { {"EmulatorMenuAction", NULL, "_Emulator"}, {"PowerAction", NULL, "P_ower", NULL, NULL, G_CALLBACK(FCEUI_PowerNES)}, {"ResetAction", GTK_STOCK_REFRESH, "_Reset", NULL, NULL, G_CALLBACK(emuReset)}, - {"PauseToggleAction", GTK_STOCK_MEDIA_PAUSE, "_Pause", NULL, NULL, G_CALLBACK(togglePause)}, + {"PauseToggleAction", GTK_STOCK_MEDIA_PAUSE, "_Pause", "Pause", NULL, G_CALLBACK(togglePause)}, {"FdsMenuAction", GTK_STOCK_FLOPPY, "_FDS"}, {"SwitchDiskAction", "go-jump", "_Switch Disk", NULL, NULL, G_CALLBACK(FCEU_FDSSelect)}, {"EjectDiskAction", "media-eject", "_Eject Disk", NULL, NULL, G_CALLBACK(FCEU_FDSInsert)}, diff --git a/src/drivers/sdl/input.h b/src/drivers/sdl/input.h index a5923811..2e6fb35a 100644 --- a/src/drivers/sdl/input.h +++ b/src/drivers/sdl/input.h @@ -14,6 +14,7 @@ typedef struct { extern CFGSTRUCT InputConfig[]; extern ARGPSTRUCT InputArgs[]; +extern int Hotkeys[]; void ParseGIInput(FCEUGI *GI); void setHotKeys(); int ButtonConfigBegin();