UI: Disable Ctrl+Q shortcut on non-macOS platforms to prevent accidental exits during gameplay (#1565)
Some checks failed
Generate translation template / generate-pot (push) Failing after 1s
Build check / build (push) Has been cancelled

This commit is contained in:
Issa 2025-05-13 03:38:11 +02:00 committed by GitHub
parent 996539fce8
commit bed5fdb195
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1448,15 +1448,23 @@ void MainWindow::OnKeyUp(wxKeyEvent& event)
void MainWindow::OnKeyDown(wxKeyEvent& event)
{
if ((event.AltDown() && event.GetKeyCode() == WXK_F4) ||
(event.CmdDown() && event.GetKeyCode() == 'Q'))
{
Close(true);
}
else
{
event.Skip();
}
#if defined(__APPLE__)
// On macOS, allow Cmd+Q to quit the application
if (event.CmdDown() && event.GetKeyCode() == 'Q')
{
Close(true);
}
#else
// On Windows/Linux, only Alt+F4 is allowed for quitting
if (event.AltDown() && event.GetKeyCode() == WXK_F4)
{
Close(true);
}
#endif
else
{
event.Skip();
}
}
void MainWindow::OnChar(wxKeyEvent& event)