feat: add double-tap Escape to exit when disable_escape_exit is enabled#124
Open
Guffawaffle wants to merge 1 commit intonetniV:mainfrom
Open
feat: add double-tap Escape to exit when disable_escape_exit is enabled#124Guffawaffle wants to merge 1 commit intonetniV:mainfrom
Guffawaffle wants to merge 1 commit intonetniV:mainfrom
Conversation
When disable_escape_exit is true, a single Escape press is swallowed as before. Pressing Escape twice within the configurable escape_exit_timer window falls through to the original handler, triggering the exit prompt. New config option [ui] escape_exit_timer (int, milliseconds): - Default: 0 (Escape fully blocked, preserves existing behavior) - Set to 500 for a 500ms double-tap window - Has no effect when disable_escape_exit is false Uses the same steady_clock double-tap pattern as ship selection (select_clock).
Author
QA ChecklistPrerequisites
Escape Behavior —
|
Owner
|
Code looks good, can see a reason for this, not sure I'd ever use it because I spam escape so it would get triggered, and that dastardly dialog would trigger me. At least by default it maintains the standard functionality, should probably add a comment that statess the same ms value for trigger as the double tap locate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a double-tap Escape mechanism to exit the game even when
disable_escape_exitis enabled.Currently, when
disable_escape_exit = true, all Escape key presses are unconditionally swallowed. This means users have no keyboard-only way to trigger the exit prompt — they must use the F10 hard kill (which callsTerminateProcesswith no cleanup).This PR adds a configurable double-tap window: press Escape twice within
escape_exit_timermilliseconds to fall through to the original handler and trigger the native exit dialog.New Config Option
Implementation
Uses the same
std::chrono::steady_clockdouble-tap pattern already established for ship selection (select_clockinhotkeys.ccline 75). A staticescape_clocktracks the last Escape press time — first press is swallowed, second press within the timer window falls through tooriginal(_this).Files Changed
mods/src/patches/parts/hotkeys.ccdisable_escape_exitguardmods/src/config.hescape_exit_timerfieldmods/src/config.ccescape_exit_timerfrom[ui]sectionmods/src/defaultconfig.h0(preserves existing behavior)example_community_patch_settings.tomlBehavior
disable_escape_exitescape_exit_timerfalsetrue0(default)true500Testing
Built and tested on Windows with
releasedbgmode. Confirmed:disable_escape_exit = trueescape_exit_timer = 0fully blocks Escape (backward compatible)disable_escape_exit = false