Skip to content
Permalink
Browse files

Fix pause toggle keybinding when unmuting.

We use the same event for both keybinding and `Emulation` > `Pause`
actions. The issue here is that the menu item is checkable, meaning
that you toggle its value and then run the handler.

The handler checks the value of the menu item `Emulation` > `Pause`,
and toggle the game pause accordingly. Such thing does not happen when
using the keybinding. Hence, it did not toggle the pause as expected.

- Related to #454.
  • Loading branch information
denisfa authored and rkitover committed Jun 29, 2019
1 parent 8b8efa1 commit fa77010f23069ff374a5abc8267500ca25b3908e
Showing with 15 additions and 2 deletions.
  1. +14 −1 src/wx/cmdevents.cpp
  2. +1 −1 src/wx/wxvbam.cpp
@@ -1353,7 +1353,20 @@ EVT_HANDLER(wxID_EXIT, "Exit")
// Emulation menu
EVT_HANDLER(Pause, "Pause (toggle)")
{
GetMenuOptionBool("Pause", paused);
bool menuPress;
GetMenuOptionBool("Pause", menuPress);

if (paused == menuPress)
{
// used accelerator
paused = !paused;
SetMenuOption("Pause", paused ? 1 : 0);
}
else
{
// used menu item
paused = menuPress;
}

if (paused)
panel->Pause();
@@ -818,7 +818,7 @@ void MainFrame::OnSize(wxSizeEvent& event)

int MainFrame::FilterEvent(wxEvent& event)
{
if (!IsPaused() && event.GetEventType() == wxEVT_KEY_DOWN)
if (event.GetEventType() == wxEVT_KEY_DOWN)
{
wxKeyEvent& ke = (wxKeyEvent&)event;
int keyCode = ke.GetKeyCode();

0 comments on commit fa77010

Please sign in to comment.
You can’t perform that action at this time.