Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions src/gui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class MainWindow : public wxFrame, public CafeSystem::SystemImplementation
void OnSetWindowTitle(wxCommandEvent& event);

void OnKeyUp(wxKeyEvent& event);
void OnKeyDown(wxKeyEvent& event);
void OnChar(wxKeyEvent& event);

void OnToolsInput(wxCommandEvent& event);
Expand Down
Loading