Skip to content

Commit

Permalink
Fix pause toggle keybinding when unmuting.
Browse files Browse the repository at this point in the history
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 fa77010
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/wx/cmdevents.cpp
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/wx/wxvbam.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit fa77010

Please sign in to comment.