From 6fa01fa8c5fc2969b18349cd71650eb211a0d58b Mon Sep 17 00:00:00 2001 From: Squall-Leonhart Date: Fri, 1 Dec 2023 16:06:01 +1100 Subject: [PATCH 1/2] make alt/command+f4 propogate to the parent after MainWindow::CreateCancvast has set focus Makes the force exit key combo for various OS work when Cemu is running a game. --- src/gui/MainWindow.cpp | 13 +++++++++++++ src/gui/MainWindow.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 92594d00e..7d280a6c3 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1480,6 +1480,18 @@ 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) + { + Close(true); + } + else + { + event.Skip(); + } +} + void MainWindow::OnChar(wxKeyEvent& event) { if (swkbd_hasKeyboardInputHook()) @@ -1585,6 +1597,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)); diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h index 07189b522..130dfb536 100644 --- a/src/gui/MainWindow.h +++ b/src/gui/MainWindow.h @@ -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); From c2d340ae287e08e2344198c09f923700dbb0fda3 Mon Sep 17 00:00:00 2001 From: Squall Leonhart Date: Fri, 26 Jan 2024 07:16:36 +1100 Subject: [PATCH 2/2] handle cmd-q for macos as well --- src/gui/MainWindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 7d280a6c3..5680eec4a 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1482,7 +1482,8 @@ void MainWindow::OnKeyUp(wxKeyEvent& event) void MainWindow::OnKeyDown(wxKeyEvent& event) { - if (event.AltDown() && event.GetKeyCode() == WXK_F4) + if ((event.AltDown() && event.GetKeyCode() == WXK_F4) || + (event.CmdDown() && event.GetKeyCode() == 'Q')) { Close(true); }