Commit Graph

5 Commits

Author SHA1 Message Date
Jakob Linke
ed4213a3be gui: close dialogs/frames on Esc, add Ctrl+Q exit shortcut
Several of Cemu's settings dialogs (GeneralSettings2, InputSettings2,
GraphicPacksWindow2, ...) and most of its tool wxFrames have no
Cancel/Close/OK button. On a Wayland compositor that doesn't draw
server-side decorations there is also no compositor-drawn close button,
so once opened these windows cannot be dismissed.

wxDialog's built-in Esc handling (wxDialogBase::OnCharHook in
src/common/dlgcmn.cpp) forwards Esc to a button with wxID_CANCEL or
the affirmative-id button via EmulateButtonClickIfPresent; with
neither button present, SendCloseButtonClickEvent returns false and
the handler just Skip()s. wxFrame has no Esc handling at all (the
event table in src/common/framecmn.cpp only carries menu-open/close
entries).

Add wxHelper::BindEscapeCloses(target), a one-liner that binds
WXK_ESCAPE on wxEVT_CHAR_HOOK to target->Close(). Close() goes
through the wxEVT_CLOSE_WINDOW path, where wxDialogBase::OnCloseWindow
does fall back to EndDialog(wxID_CANCEL) when no Cancel/OK button
is found - so the helper closes buttonless dialogs correctly. Apply
as the first statement of every wxDialog and wxFrame ctor in
src/gui/wxgui/, except:
  - MainWindow: Esc shouldn't quit Cemu.
  - PadViewFrame: already binds Esc to leave fullscreen.
  - HotkeySettings: inline variant guarded by !m_activeInputButton
    so an in-progress keyboard capture (whose cancel path is
    OnKeyUp + IsValidKeycodeUp rejecting WXK_ESCAPE) still wins.

Tag the File>Exit menu item label with "\tCtrl+Q"; wxMenuItemBase::
GetAccel() parses everything after the tab via wxAcceleratorEntry::
Create and wxMenuBar registers it as an accelerator.
2026-05-23 08:53:09 +02:00
oltolm
5cfebb4373
UI: Replace sprintf with wxString::Format (#1749)
Some checks failed
Build check / build (push) Has been cancelled
Generate translation template / generate-pot (push) Has been cancelled
2025-12-19 20:54:34 +01:00
oltolm
eb95e63d94
UI: Fix warnings (#1729)
Some checks are pending
Build check / build (push) Waiting to run
Generate translation template / generate-pot (push) Waiting to run
2025-11-23 11:51:44 +01:00
Crementif
08609591ae
UI: Upgrade to wxWidgets 3.3.1 and add dark mode support for Windows (#1647)
Some checks failed
Build check / build (push) Has been cancelled
Generate translation template / generate-pot (push) Has been cancelled
2025-07-23 11:07:24 +02:00
SSimco
67de63bed6
UI+build: Isolate wxWidgets code from non-GUI code (#1633) 2025-07-15 04:28:41 +02:00