make altf4/cmd-q propogate to the parent after MainWindow::CreateCanvas has set focus #1035

Merged
Squall-Leonhart merged 2 commits from makealtf4work into main 2024-02-18 01:52:11 -03:00
2 changed files with 15 additions and 0 deletions

View file

@ -1480,6 +1480,19 @@ void MainWindow::OnKeyUp(wxKeyEvent& event)
g_window_info.has_screenshot_request = true; // async screenshot request
}
void MainWindow::OnKeyDown(wxKeyEvent& event)
{
if ((event.AltDown() && event.GetKeyCode() == WXK_F4) ||
(event.CmdDown() && event.GetKeyCode() == 'Q'))
{
Close(true);
}
else
{
event.Skip();
}
}
void MainWindow::OnChar(wxKeyEvent& event)
{
if (swkbd_hasKeyboardInputHook())
@ -1585,6 +1598,7 @@ void MainWindow::CreateCanvas()
// key events
m_render_canvas->Bind(wxEVT_KEY_UP, &MainWindow::OnKeyUp, this);
m_render_canvas->Bind(wxEVT_KEY_DOWN, &MainWindow::OnKeyDown, this);
m_render_canvas->Bind(wxEVT_CHAR, &MainWindow::OnChar, this);
m_render_canvas->SetDropTarget(new wxAmiiboDropTarget(this));

View file

@ -124,6 +124,7 @@ public:
void OnSetWindowTitle(wxCommandEvent& event);
void OnKeyUp(wxKeyEvent& event);
void OnKeyDown(wxKeyEvent& event);
void OnChar(wxKeyEvent& event);
void OnToolsInput(wxCommandEvent& event);